About OpenCL, CUDA and shaders

Started by
1 comment, last by Bacterius 10 years, 6 months ago

Not a long time ago I read article about OpenCL. The article said, OpenCL is different from CUDA in independent of the hardware ability. OpenCL is independent of the hardware side, and CUDA is depends of the hardware? Hah, It's crazy thought. No of course! Am I right? And I believe that OpenCL/CUDA use for a NO graphical compute, but shaders use for a graphical compute. Am I right? Please, will advice. What use CUDA/OpenCL? What are their differences?

Advertisement

AFAIK, CUDA was something cooked up by NVIDIA specifically to do GPU programming for their hardware. OpenCL is Khronos Group's implementation of a hardware independent GPU programming library, so that you can write it once and port it to all graphics cards (in theory), kinda like OpenGL does for graphics.

AFAIK, CUDA was something cooked up by NVIDIA specifically to do GPU programming for their hardware. OpenCL is Khronos Group's implementation of a hardware independent GPU programming library, so that you can write it once and port it to all graphics cards (in theory), kinda like OpenGL does for graphics.

Correction: OpenCL is a specification, and vendors design hardware and implement their drivers to conform to the specification. CUDA is not the same, since it is available from only one vendor it is just a GPGPU API very similar to OpenCL. In fact, the NVIDIA driver used to implement OpenCL by translating it to CUDA behind the scenes, though nowadays they have just stopped supporting later versions of OpenCL iirc. It makes better use of NVIDIA hardware by virtue of being designed specifically for it.

OpenCL and CUDA can both do graphics-related tasks, they both have a concept of textures and can use the sampling units, and can interoperate (to some extent) with OpenGL and DirectX resources. Whether it is worth using them in your application is up to you to decide. Note some graphics API's already provide their own tightly-coupled "compute languages", e.g. DirectX's compute shaders with HLSL which are easier to manage if you are already using DirectX to start off with. But people have written raytracers in CUDA and OpenCL, so it's completely possible.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

This topic is closed to new replies.

Advertisement