OpenCL on Cooley
OpenCL (Open Computing Language) is an open standard from the Khronos group that enables heterogeneous device programming (e.g. CPUS, GPUs, and FPGAs). Complete descriptions of the API, memory hierarchy, and usage can be found in OpenCL documentation and technical specifications found on the Khronos website.
Using OpenCL at ALCF
OpenCL is provided on Cooley via the NVIDIA GPU drivers for the Kepler K80 GPUs. OpenCL 1.2 is supported on Cooley. There is not an OpenCL CPU driver available on Cooley to launch OpenCL kernels on the CPUs.
Building on Cooley
To build an OpenCL application for the GPUs on Cooley, one can modify their software environment to load CUDA.
The following is an example to compile a simple OpenCL application.
Running jobs on Cooley
An example ‘test.sh’ job submission script follows.
To request a single node with 10 minutes of walltime, charging to the MyProject project, one can use the following command.
There is an OpenCL tutorial available from the ALCF on GitHub that provides a walk through on several concepts of the programming model: introduction to API, querying device info, compiling kernels, using buffers, profiling, etc… The repo can be cloned to your working directory with one of the following commands.
The tutorial provides examples for C, C++, Python, and Ruby. Individual C and C++ examples can be built and run, from their respective directories using ‘make’ and the name of the example (e.g. platform).