Converting to OpenGL and OpenCL from Visual Studio Forms Application


I am looking to speed up a program, currently a Visual Studio Forms Application, C++, that uses NVIDIA CUDA, I believe, and has lots of parallel processing.

->If I would like to use OpenCL and OpenGL, would this speed it up? Or is it just doing the same thing but with different code?
->Would I have to start from scratch, or is it possible for me to perhaps integrate only parts of my program to OpenGL/CL? Basically, is it all one or the other?
->Any suggestions? Particularly if I can do any of these things, as to how I would actually do it.

I’m slightly confused: If the program already uses CUDA, I would assume it was already sped up. OpenCL basically is an alternative to CUDA, not something that you should use on top of a CUDA program. What you gain by using OpenCL instead of CUDA is CPU support (although there now is the PGI CUDA compiler, which can also run CUDA code on the CPU) and cross-vendor support.

You would gain nothing if all relevant parts in the program already use CUDA (in a proper way), see my statement above. While you can use OpenGL for GPGPU computing, I’d recommend to use OpenCL instead because you gain CPU support and OpenGL is tuned towards graphics, not GPGPU.

In theory, you can mix OpenGL, OpenCL and CUDA in a single application. So if there were parts in your program that do not yet benefit from multiple CPU cores / the GPU, you may rewrite that part using OpenCL, although other parts of the same program might already use CUDA to speed things up. But in general, it is more one or the other, except maybe if you piece-wise port your pure CUDA program to a pure OpenCL one.

That’s hard to say without knowing anything about the kind of calculations your program performs.

The vague “can I” questions are hard to answer without much experience. Therefore, thank you a lot, this certainly helps.

I guess if I want the 3-D functionality, I would use OpenCL rather than CUDA though. So that is an advantage.