Using GPUs from Applications¶
Compiling CUDA Enabled Programs¶
The most direct way to develop a custom GPU accelerated algorithm is with the CUDA programming, please refer to the Nvidia CUDA Toolkit page. The current CUDA environment is cuda/12. However, C++ or Python packages numba and PyCuda are other ways to program GPU algorithms.
Conda Environments with GPU¶
To make sure your code will run on GPUs from a conda environment install a CUDA
toolkit package. The current releases for CUDA 12 and 13 are called
cuda-toolkit whereas the previous monolithic package was named cudatoolkit
and was retired after CUDA-11 version. The cuda-toolkit package ensures
compatibility with the NVIDIA drivers on HPG (currently or CUDA 13 and 12)
alongside the pytorch or tensorflow packages. See the RC provided tensorflow or
pytorch environment modules installs for examples if needed. Conda or Mamba can detect if there is
a gpu in the environment, so the easiest approach is to run the conda or mamba
install command in a gpu session.
You can also visit Conda for more information.
To access GPUs from Apptainer (or Singularity) containers the Apptainer exec command requires a --nv flag to mount NVIDIA drivers, libraries, and devices. Because the container's
Inter-Process Communication (IPC) namespace is isolated, we need to mount the
GPU node's path for multi-gpu in order to take advantage of the available shared
memory. Use the following flags to run apptainer containers on GPU nodes:
--nv (all gpu jobs)
--ipc=host or --bind /dev/shm (multi-gpu RTX6000 or B200 jobs)