May 2019
Intermediate to advanced
452 pages
12h 16m
English
Apart from CUDA-C, CUDA toolkits also come with OpenCL support. The only extra step to take care of here is to install the OpenCL headers package:
sudo apt install opencl-headers
Following this, you will be able to compile a .c or .cpp file containing OpenCL code by running the gcc or g++ compiler with the –lOpenCL flag. The command to compile a .c file using gcc is as follows:
gcc openclprogram.c –lOpenCL
The corresponding command for a .cpp file using g++ is as follows:
g++ openclprogram.cpp -lOpenCL
As we discussed earlier, the basic difference between CUDA and OpenCL is cross-platform compatibility and code syntax. Their generic applicability remains the same. We will explore these similarities and differences through Chapter ...
Read now
Unlock full access