You are located in service: RWTH High Performance Computing (Linux)





OpenCL support for NVIDIA GPUs comes with the CUDA Toolkit. Therefore you should load the CUDA module:

module load CUDA/<version>

You can find the header files (including C++ bindings) in the subfolder CL under $CUDA_ROOT/include/ and the libraries in $CUDA_ROOT/lib64.

You can compile and link an OpenCL C program by:

$CC pi.c -lOpenCL

You might have to include e.g. <CL/cl.h> or rather <CL/opencl.h> (the header files were restructured in Feb 2010). The single header file opencl.h now includes all the other headers (cl.h, cl_gl.h, cl_gl.ext.h, cl_ext.h) as appropriate for the target platform, and simply including opencl.h should be all that applications need to do. Then you have to specify the include path while compiling:

$CC pi.c -I$CUDA_ROOT/include/CL -lOpenCL

Attention: Whether your application can be compiled may depend on the compiler vendor, version, and flags supplied.

last changed on 04/04/2023

How did this content help you?

Creative Commons Lizenzvertrag
This work is licensed under a Creative Commons Attribution - Share Alike 3.0 Germany License