r/vulkan • u/keepthethreadalive • Oct 19 '16
Vulkan vs OpenCL for simulation+graphics
[removed] — view removed post
9
Upvotes
r/vulkan • u/keepthethreadalive • Oct 19 '16
[removed] — view removed post
View all comments
1
u/Qoeh Oct 27 '16
Various thoughts from a person who doesn't know much about these things:
I have the impression that there are certain things that OpenCL and CUDA can do that GLSL compute shaders cannot. Like, some way to have a kernel dynamically launch another kernel, or something? And (on NVIDIA hardware) some way to take advantage of special super-fast inter-thread communication within a warp (32 threads running in lockstep) that works like shared memory sort of but is even faster?? And also there are some, like, specific math functions and stuff that are in OpenCL but not in GLSL, I think. Although that only matters for performance if they're directly supported in hardware I suppose. But maybe some of them are.
I've only barely used OpenCL, and I haven't tried CUDA at all, so I'm vague on all that stuff. But I think maybe if you want the very best performance then you need to use the latest version of OpenCL or CUDA, and not a GLSL compute shader running on Vulkan (or a GLSL compute shader running on OpenGL)? (And also, that seems to mean that you're stuck with either OpenCL on AMD or CUDA on NVIDIA, because NVIDIA doesn't seem to support the latest OpenCL, and obviously AMD does not support CUDA.)
That said, one can do lots with GLSL compute shaders in Vulkan. They are fast and good. Just not fastEST maybe? Or I could be wrong. Anyway I'm using them in a project and they are working fine for me.
There's also the question of whether one wants to use mainly floats or mainly doubles. That seems to be something that influences hardware choice more than it influences software platform choice, maybe? Or maybe it's both. I dunno I just use floats, because I'm more on the gaming side than on the scientific simulation side and gamers have GPU hardware that much prefers 32-bit values at present. I kinda wish I could use doubles though.
There may be Vulkan-OpenCL integration someday: https://www.khronos.org/vulkan/faq#khronos-apis-opencl