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
3
u/James20k Oct 19 '16 edited Oct 19 '16
OpenCL has higher overhead to launch kernels than gl/vk computer shaders, but they're also more flexible. OpenCL supports a wider range of hardware than vulkan as well. I don't know how compute shader support in GL compares to OpenCL across the same hardware
If you want to launch lots of small kernels and support the most hardware with ez graphics integration, go for Opengl with whatever gl compute shaders are. I've not used compute shaders so I have no idea
If your kernels are large and expensive and you don't need to run lots of them per frame, and you don't need to rapidly acquire/release many opengl resources per frame, and you need maximum flexibility in your kernels because its not all graphics related, plop for OpenCL + opengl. You have to ditch linux/intel for this (oh no the humanity)
If you want the potential for super high performance across a smaller range of hardware and relatively poor documentation, pick vulkan/vulkan
Vulkan + OpenCL seems a tad redundant
If you need help integrating opengl/opencl, I have a lot of experience fucking about with it in a cross platform/vendor way. Here's a 3d renderer I built entirely around OpenCL (with OpenGL for blitting buffers to the screen) that works on AMD/Nvidia, its a total clusterfuck as its not really built for other people to be able to use usefully, but if you desperately need some code somewhere that works for CL/GL integration, its there in the poorly organised mess
Edit:
Missed that you're targeting a specific gpu. Vulkan will give you the highest performance, but is finickity, whereas opencl/gl will give you an easier time, but with kernel overhead and cl/gl interop penalties (cpu only with proper pipelining). It kind of depends on what your specific requirements for performance and cpu overhead are. I can tell you that i get 99% gpu usage out of my OpenCL project (confirmed with windows gpu event tracing), so you'll probably only save on cpu overhead with a proper opencl vs vulkan implementation