I know compute shaders use HLSL, Nvidia has CUDA etc and so on. My question is can C++ be made to run on GPU? If yes, will it be faster than HLSL and CUDA ?
Questions about GPGPU
L. Spiro is the man, one word and you got the answer.
You have to bind the compiled shader and the graphic card knows what he has to do, no other way.
I know compute shaders use HLSL, Nvidia has CUDA etc and so on. My question is can C++ be made to run on GPU?
Microsoft has a language extension called C++ AMP, which allows you to write C++ code where some parts run on the CPU and some parts run on the GPU.
It's designed for people writing C++ programs that crunch a large amount of data, who want an easy way to take advantage of GPU power available in their PCs.
It's not designed for use in games.
If yes, will it be faster than HLSL and CUDA ?
No.
In a similar vein to C++ AMP, there's SYCL, a khronos standard to embed opencl code directly into c++ code.
It's also worth noting that opencl 2.1 adopted a subset of c++14 as a compute kernel language (basically all of c++ except what you'd expect not to be possible on a GPU)
It's also worth noting that opencl 2.1 adopted a subset of c++14 as a compute kernel language (basically all of c++ except what you'd expect not to be possible on a GPU)
Cuda and opencl 2.1 (no driver supports it atm) allow you to write c++ kernel.
But you can't write function in pure c++ (or even c) code that will execute on the gpu transparently, except maybe with c++ amp.
But you can't write function in pure c++ (or even c) code that will execute on the gpu transparently, except maybe with c++ amp.
I have one more question - Which will be more quicker? C++ amp or direct compute
And direct compute can do all those things that C++ amp can do?
The algorithms you use, and your own knowledge of GPUs will have 100x more performance impact than your choice of language.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement