Take the 2-minute tour ×

CUDA, OpenCL, and the GPU options offered by the Portland Group are intriguing... Results are impresive (125-times speedup for some groups). It sounds like the next wave of GPGPU tools are poised to dominate the scientific computing world. However, I recall the same fanfare when GLSL and Cg were announced.

What ever happened to GLSL and Cg? Has support been dropped? Do people still use GLSL & Cg for general-purpose computing on GPU's?

share|improve this question
add comment

3 Answers

up vote 12 down vote accepted

The days of using Cg or GLSL for GPGPU are nearly over. However, they are heavily used for 3D graphics and will continue to be used in this way for the foreseeable future. GLSL and Cg were only used for scientific computation because they were the only game in town. There was no other alternative to do general purpose computation on the GPU.

The only real reason to use GLSL for GPGPU right now is to be platform agnostic. If you absolutely must be able to run your software on a variety of GPUs, it is, for now, still the way to go. OpenCL will change this in the near future, though.

The reason that scientific computing is moving on to things like CUDA and OpenCL are many. These libraries give you better access to the GPU hardware and much more transparancy about performance bottlenecks. This makes it easier to get the maximum performance from the GPU. CUDA and OpenCL also offer features (e.g. shared memory) that are simply not available in GLSL or Cg but are crucial for getting good performance in many algorithms (e.g. matrix transpose). Another reason is that CUDA and OpenCL give you access to the GPU without needing a graphics context, which lets you, among other things, remotely use a computer's GPU for computation.

share|improve this answer
add comment
  • Cg/HLSL if you are a game dev.
  • OpenCL if you are a very adventurous game dev.

For anyone else on the desktop you cannot even guarantee that they will have the required hardware.

The future of all of these solutions looks dim. We are likely to see at least 1 or 2 more generations of languages before GPGPU catches up to the desktop and merges.

share|improve this answer
add comment

You're comparing apples to oranges. CUDA and OpenCL are meant for doing general purpose computing on GPUs. GLSL and Cg are shader languages. They are primarily meant for writing shaders, not doing general purpose computing.

I don't know about the actual status of GLSL, but I do know about Cg. It's been years since I've used it, but my friend who just worked on a new 3d game, did use Cg to write his shaders. Even if there isn't the same community and industry support behind Cg that there once was, it is still out there, and you can still use it.

share|improve this answer
"...there isn't the same community and industry support behind Cg that there once was..." This is part of the reason I ask: CUDA, OpenCL, etc. has a big push right now... will it go away one year from now? It sure would suck if I invest a ton of time porting my application over & then the software or hardware gets little to no support! –  Pete Jun 11 '09 at 19:50
I have a feeling that at least one, if not both, CUDA and OpenCL will still have strong support in the future. Using GPUs for general purpose computing is something that a lot more people have uses for than the smaller number of people who make shaders. –  Apreche Jun 11 '09 at 20:59
If "will it go away one year from now?" is your concern, then OpenCL is the safest bet. CUDA will only run on NVidia hardware; AMD/ATI's Stream SDK (aka CAL) will only run on their hardware; neither one will run on Larrabee; DirectX 11 compute shaders should run on multiple manufacturer's hardware, but only on Vista or Windows 7, not Windows XP or Linux or Mac OS. OpenCL promises to be the first toolset that really is standard across all platforms, so the conventional wisdom is that it will survive and the others will die out. –  Die in Sente Jun 12 '09 at 16:09
add comment

Your Answer


