I am a newbie to GPU programming. I have a laptop with NVIDIA GeForce GT 640 card. I am faced with 2 dilemmas, suggestions are most welcome.
If I go for CUDA -- Ubuntu or Windows Clearly CUDA is more suitable to windows while it can be a severe issue to install on Ubuntu. I have seen some blogposts which claim to have installed CUDA 5 on Ubuntu 11.10 and Ubuntu 12.04. However, I have not been able to get them to work. Also, standard CUDA textbooks prefer to work in the windows domain and are more or less silent in concern with Unix/Ubuntu installation and working.
CUDA or OpenCL -- Now this is probably more trickier than my first question ! I have mostly come across GPGPU projects using CUDA/Nvidia but OpenCL is probably is the next best option in open source and installing in Ubuntu probably will not be an issue, though some suggestions here will be most useful. Am I sacrificing any functionality if I go for OpenCL and NOT CUDA ?
Any help or suggestions ?
The general consensus is that if your app of choice supports both CUDA and OpenCL, go with CUDA as it will generate better performance results. The main reason for this is that Nvidia provide top quality support to app developers who choose to use CUDA acceleration, therefore the integration is always fantastic.
Developers cannot directly implement proprietary hardware technologies like inline Parallel Thread Execution (PTX) on NVIDIA GPUs without sacrificing portability. A study that directly compared CUDA programs with OpenCL on NVIDIA GPUs showed that CUDA was 30% faster than OpenCL.
It depends if you want to use only your GPU for rendering or GPU + CPU. You will have to test what gives you a better rendering performance. Using a fast GPU with a slow CPU may result in longer render times than using the GPU alone, while a combination with fast CPU may improve the performance.
They only read and write global memory, each thread different location. The launch configuration for CUDA is 200 blocks of 250 threads (1D) , which corresponds directly to the configuration for OpenCL - 50,000 global work size and 250 local work size . The OpenCL code runs faster.
If you use OpenCL, you can easily use it both on Windows and Linux because having display drivers is enough to run OpenCL programs and for programming you would simply need to install the SDK. CUDA has more requirements on specific GCC versions etc. But it is not much more difficult to install on Linux also.
In Linux CUDA has strange requirements such as using GCC 4.6 or 4.7. If you use a different version of GCC, you won't be able to compile your program anymore. If you use OpenCL, you can use any compiler because you would just need to link with the common OpenCL library. So OpenCL is easier to setup, use and compile for. Once you compile an OpenCL program it can be run on any hardware (as long as it is coded to do so) even if it was compiled using another brand's OpenCL SDK.
You can write OpenCL programs which will function on Nvidia, AMD, and Intel hardware, on GPUs, CPUs, and Accelerators. Even more, Altera is working on supporting OpenCL on FPGAs! If you use CUDA, you will have to use Nvidia GPUs only and re-write your code again in OpenCL or other language for other platforms. A serious limitation of using CUDA and cause of serious waste of time in the long run.
I see that somebody posted some old references between CUDA and OpenCL, but they are old! When those documents were out, only AMD properly supported OpenCL. Since 2013, OpenCL is supported by ARM, Altera, Intel etc. and became an industry standard.
The only downside is that since OpenCL is so flexible, you are faced with more options and ways to code memory allocations, transfers etc. in your program. Therefore it may feel more complicated perhaps.
I think it is not very difficult to set up cuda environment on ubuntu, you can give it a try.
As a computing architecture student, I think you need to learn both of OpenCL and CUDA. And you should learn cuda first because CUDA exposes more hardware and runtime info, hardware awareness is very important when you want to optimize your GPU codes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With