Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

  • 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top