4

I want to do some GPU programming. What's the way to go here? I want to learn something that is "open" , cross platform and a "higher" language. I don't want to be lock into just GPU vendor nor OS, platform, etc.

What are my choices here? Cuda, OpenCL, OpenMP, other? What's the pros/cons for them?

What about G/HLSL and PhysX?

I'm looking at doing "general purpose" programming, some math, number crunching, simulations, etc. Maybe spit out some pretty graphics, but not specifically graphics programming.

asked Apr 13, 2011 at 16:58
1
  • I spent about a year doing OpenCL. Forgot how to program in C++ because of it. It turns out most of the claims about GPU performance are way off. For double floating point you might as well forget about it. For single floating point there is an advantage over the CPU by a factor up maybe 5. That's still significant but it requires a lot of investment. I don't know about integers. AMD GPUs are popular in bitcoining for a reason. I now mostly do OpenMP and SIMD on the CPU. AVX-512 will be out in a few years and I think Intel will close the gap on single float and dominate on double. Commented Apr 15, 2014 at 10:41

6 Answers 6

9

The answer marked correct is now outdated and incorrect. In particular OpenMP 4.0 supports GPU acceleration.

answered Apr 7, 2015 at 21:11
Sign up to request clarification or add additional context in comments.

Comments

4

OpenMP is cpu only, but easy to implement, CUDA is basically GPU only. Ati Stream supports both, but only on Ati/AMD gpu's. OpenCL is your only "open" option that supports both.

answered Apr 13, 2011 at 17:03

3 Comments

The OpenMP spec currently only covers homogeneous SMP systems. However, when the OpenMP V4.0 spec comes out (in about a year), it will most likely cover heterogeneous systems (which should include GPUs). CUDA is currently limited to Nvidia, as far as I know. OpenCL seems like the best bet for now.
There are people working on code translators for like C and Fortran + OpenMP to CUDA.
This answer is now outdated. OpenMP 4.0 supports GPU acceleration.
1

Nowadays - 2013/2014 - there is C++ Accelerated Massive Parallelism (AMP) of Microsoft. This is a high level language that compiles to High Level Shader Language (HLSL) so you do not have to write kernel code etc.

A simple and easy to read comparison between OpenCL and C++ AMP is done by the AMD folks and is found here (click!).

answered Apr 15, 2014 at 9:08

Comments

1

The GPU support for openMP will be available in near future:

http://openmp.org/sc14/Booth-Sam-IBM.pdf

answered Aug 25, 2015 at 5:22

Comments

0

If you want to get involve with GPU and at higher level than OpenCL you might have a look to Matlab. There is a chance to program GPUs via Matlab and you do not need to learn lower models such as OpenCL and CUDA. CUDA it will be more efficient as you probably are going to program a NVIDIA card. However, openCL is the standard for GPGPUs and the way to code is pretty similar. Although you might find not very difficult to use CUDA or openCL, you will really find much harder to optimize them.

I hope it helps.

answered Apr 29, 2011 at 15:08

Comments

0

Open CL is open but I've heard that a downside to this is the lack of documentation. ATI might be a better between NVIDIA and ATI since it was reportedly faster in 2009 but I'm not sure if those stats are still correct.

answered Aug 17, 2011 at 20:50

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.