Programming GPU, CUDA or OpenCL?

I am new to GPU programming. I have a laptop with an NVIDIA GeForce GT 640 card. I ran into two dilemmas, suggestions are welcome.

  • If I upgrade to CUDA - Ubuntu or Windows . Clearly, CUDA is more suitable for windows, although it can be a serious problem to install on Ubuntu. I saw some blogposts that claim to install CUDA 5 on Ubuntu 11.10 and Ubuntu 12.04 . However, I could not get them to work. In addition, standard CUDA tutorials prefer to work in a Windows domain and are more or less silent about installing and running Unix / Ubuntu.

  • CUDA or OpenCL . Now this is probably more complicated than my first question! I mostly come across GPGPU projects using CUDA / Nvidia, but OpenCL is probably the next best option in open source and installing on Ubuntu will probably not be a problem, although some suggestions here will be most useful. Can I sacrifice any functionality if I go for OpenCL and NOT CUDA?

Any help or suggestions?

+54
gpu gpgpu cuda gpu-programming
Aug 02 '13 at
source share
2 answers
  • If you use OpenCL, you can easily use it on both Windows and Linux, because it is enough to display the drivers to run OpenCL programs, and for programming you just need to install the SDK. CUDA has more requirements for specific versions of GCC, etc. But installing it on Linux is also not so difficult.

  • On Linux, CUDA has strange requirements, such as using GCC 4.6 or 4.7. If you use a different version of GCC, you can no longer compile it. If you use OpenCL, you can use any compiler, because you just need to link to the shared OpenCL library. Thus, OpenCL is easier to configure, use, and compile. Once you compile the OpenCL program, it can be run on any hardware (if it is encoded for this), even if it was compiled using another OpenCL SDK brand.

You can write OpenCL programs that will run on Nvidia, AMD, and Intel devices, on GPUs, processors, and accelerators. Moreover, Altera is working on OpenCL support on FPGA! If you use CUDA, you will have to use only Nvidia GPUs and re-write your code again in OpenCL or in another language for other platforms. A serious limitation on the use of CUDA and a serious waste of time in the long run.

I see that someone posted some old links between CUDA and OpenCL, but they are old! When these documents were missing, only AMD correctly supported OpenCL. Since 2013, OpenCL has been supported by ARM, Altera, Intel, etc., and has become an industry standard.

The only drawback is that since OpenCL is so flexible, you come across a lot of options and methods for allocating memory, transferring, etc. in your program. Therefore, perhaps he may feel more complex.

+75
Oct 11 '13 at
source share

I think it is not very difficult to set up a cuda environment on ubuntu, you can try.

As a student of computational architecture, I think you need to study both OpenCL and CUDA. And you should learn cuda first, because CUDA provides more hardware and runtime information, and hardware awareness is very important when you want to optimize your GPUs.

+5
Aug 02 '13 at 14:52
source share



All Articles