48
Can anybody explain why CUDA and Rocm are necessary and why OpenCL isn't the solution?
(self.programming)
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities [email protected]
Because CUDA and ROCm/HIP are far easier to program.
The Khronos competitor to CUDA/ROCm is SYCL not OpenCL.
SYCL vs these other options is a fun theoretical problem, but only Intel seems to be pushing SYCL at all. OpenCL got stuck in OCL1.2 (the 2.0 release was dead. 3.0+ OpenCL ignores OCL2.0 but it's too late, OpenCL is seen as a dead end tech these days).
The biggest issue is that OpenCL is a different language, while CUDA/HIP/SYCL are 'just' C++ extensions. This means that if you ever shared data between CPU and GPU in OpenCL (or DirectX or Vulkan for that matter), you have to carefully write and rewrite structs{} to line up between the two languages.
Meanwhile, CUDA/HIP support passing structs, classes and more between CPU and GPU (subject to conditions of course. GPUs can't do function pointers or vtables for example, but cpu-only classes can have vtables)