CUDA C is an extenstion to ANSI C that NVIDIA has created to compile
programs containing CUDA kernel code into executables that can use the
GPU on a target device.
the LC GPU
Web page to familiarize yourself with the LLNL
Machines and Versions:
CUDA C is available everywhere the CUDA
Toolkit is installed. See LC graphics
page. There are no GPUs on the login nodes. Onlyl
batch nodes have GPUs.
Location: The CUDA toolkits are located in /opt/cudatoolkit* . To make one available, you
must load the cudatoolkit module for the version desired. The following
command loads version7.5 of the CUDA toolkit, placing nvcc in your PATH
and set LD_LIBRARY_PATH to run the resulting binaries correctly:
module load cudatoolkit/7.5
Available modules can be shown by typing
module avail cuda
and module details can be shown by typing, e.g.,
module show cudatoolkit/7.5
Settings: None required beyond loading the module.
To write a CUDA C program, you create a sourcefile that has the .cu
extension and compile it using the nvcc compiler, which has similar
semantics to gcc and other compilers. The resulting binary will contain
code to run on the GPU. Example:
nvcc myfile.cu -o myprogram
Debugging with NVVP: To run nvvp, you need to be explicit about choosing the right java JRE on our clusters:
module load java/1.8.0
If you do not do this, then you will very likely get a java error.
For help with the CUDA C API, see the Help section below.
Recommended reading: CUDA By Example by Sanders and