This page is under construction.

OpenCL with MPI

Unlike CUDA's Runtime API (with its triple chevron syntax), OpenCL only uses calls to library functions. Therefore, any C/C++ compiler can compile source files containing OpenCL function calls. Also, no special linker is needed for linking OpenCL programs, although you do need to include the OpenCL library on the link line (e.g., -lOpenCL).

Therefore, unlike the compiling and linking problems for CUDA+MPI programs, it is relatively easy to compile and link OpenCL+MPI programs.  We recommend using the MPI compiler driver (e.g., mpicc or mpicxx) to compile and link your OpenCL+MPI programs.  Note that you will have to use the -I flag to indicate to the compiler the location of the OpenCL headers, and possibly the -L flag to indicate the location of the OpenCL library.

On Keeneland we use the NVIDIA OpenCL implementation. This implementation is included as part of the CUDA Toolkit installation.  So, your -I flag should look something like -I/sw/keeneland/cuda/version/linux_binary/include, where version is something like 4.0.  NVIDIA's OpenCL implementation places the OpenCL libraries in a default system location (/usr/lib64) so no special -L flag is needed for the linker to find the OpenCL libraries.  The -lOpenCL flag is needed, however, so that the linker can resolve calls to the OpenCL API functions.