Sie befinden sich im 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.

zuletzt geändert am 04.04.2023

Wie hat Ihnen dieser Inhalt geholfen?

Creative Commons Lizenzvertrag
Dieses Werk ist lizenziert unter einer Creative Commons Namensnennung - Weitergabe unter gleichen Bedingungen 3.0 Deutschland Lizenz