GPU Support in Apptainer
GPU-accelerated applications are common in HPC, and on a system like Vista, Apptainer can run them in containers, which simplifies installation of complex software and dependencies on the file system. Enabling GPU support with Apptainer is a matter of including the appropriate flags for the device and finding a container image that matches the host's CPU architecture, GPU architecture, and GPU driver capabilities.
Enabling GPU support in Apptainer
In Apptainer, you can enable either NVIDIA or AMD GPU support by using the --nv or --rocm flag, respectively, when running a container with apptainer run, apptainer exec, or apptainer shell. Apptainer runs the GPU-enabled containers by locating and binding the host's NVIDIA or AMD GPU drivers and CUDA or ROCm libraries (through LD_LIBRARY_PATH) at launch. The application inside the container, for example PyTorch, is then enabled to use the GPU device present on the host computer.
By default, the flag --nv exposes all NVIDIA GPUs on the host to the container. If restricting which devices are visible is desired, it is possible to selectively expose individual GPUs by setting CUDA_VISIBLE_DEVICES inside the container or APPTAINERENV_CUDA_VISIBLE_DEVICES before starting the container. For example, if you have 4 NVIDIA devices on the host computer, the following command exposes the devices with indices 0 and 1 to the container:
On Vista, for a container to be compatible with the host system, there are several requirements. First, since emulation is unavailable, the container image must be built for the arm64 architecture. Second, the software or program inside the container must be built against a CUDA version supported by the host's current NVIDIA driver.
Example GPU Container
Below, we will pull a PyTorch container from the NVIDIA NGC Catalog, which provides a variety of GPU-enabled Docker containers. The image is built for arm64, and its GPU components are compatible with the NVIDIA driver and CUDA libraries on Vista's Grace Hopper nodes.
nvidia-smi should display the GH200 in the output.
CVW material development is supported by NSF OAC awards 1854828, 2321040, 2323116 (UT Austin) and 2005506 (Indiana University)