You are located in service: RWTH Compute Cluster Linux (HPC)

OpenCL

OpenCL

Kurzinformation

OpenCL for NVIDIA GPUs

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 could be compiled may depend on the compiler vendor, version, and flags supplied.

last changed on 29.01.2021

How did this content help you?