I’m reading through the OpenGL and OpenCL specification in order to find few informations about the memory model and how exactly they corresponds to each other.
I’m aware OpenGL and OpenCL use essentially the same memory model. What I struggle to understand however, given the namings don’t map 1-to-1 (at least it seems to me in that way) is what exactly can be mapped to what (in terms of terminology) between the two.
Any reference would be appreciated.
Under the assumption we have the same GPU as device for both OpenCL and OpenGL the specific question/questions is/are:
- How for example VBO actually maps to OpenCL? Does a VBO essentially correspond to a chunk of global memory in the OpenCL terminology?
- What about OpenGL Texture object? my understanding is that this corresponds exactly to an image object in OpenCL, and they both map to texture memory.
- What about Shared Storage Buffer Object (specifically in the context of Compute Shaders) what does this corresponds to?
Also, even on this site, I find few debates on which one is more performant (between OpenCL and OpenGL). It seems to me that OpenGL Compute Shaders for example should be preferred over OpenCL kernels only if the nature of the problem maps nicely to something graphics related, OpenCL instead is preferred if you have some heavily numerical which is not necessarily graphics related (such as a heavy simulation for example).
What I struggle a bit to understand is why this is the case given that the memory model, and resources, are essentially the same. Apart from experimenting I wonder what is the actual difference justifying the difference. With specific reference to Compute Shaders I’m aware they allow to implement any algorithm you would be able to implement in OpenCL with OpenGL, so why is there a performance difference then?
The kind of problem I’m thinking of would be some relatively heavy optimisation based on level 3 Blas routines (such as GEMM or GEMV).
How well would OpenGL and OpenCL scale for these kind of problems?
The reason I’m asking is because I struggle a bit to find relatively recent information and benchmarks that might answer the question.
Source: Windows Questions C++