External Links:
CUDA toolkit and driver compatibility table
CUDA toolkit website
NVIDIA Easy Introduction to CUDA
All GPU nodes are now running Red Hat Enterprise Linux 9. Following is an example job script to request use of four A100 GPUs:
#!/bin/bash #BSUB -n 1 #BSUB -W 30 #BSUB -q gpu #BSUB -R "select[a100]" #BSUB -gpu "num=4:mode=shared:mps=yes" #BSUB -o out.%J #BSUB -e err.%J nvidia-smi
lsload -gpuload
There are various versions of CUDA on Hazel. To see the various versions available, type
module avail cuda
and
ls /usr/local/apps/cuda/*
.
To set the environment, either source the appropriate script or load the default module
module load cudaLoading the module cuda will put the CUDA compiler nvcc in the path, as well as setting the path to the CUDA libraries.
-gpu "mps=yes:mode=exclusive_process"With this setting, your job will use the GPU exclusively. Your other jobs and other user's jobs will be able to share the same node, but not that/those GPUs. Other jobs (yours and others') will be able to use the other free GPUs on that node. For example, the setting
-gpu "num=1:mps=yes:mode=exclusive_process"
will allow you to run a total of 4 GPU jobs on a node with 4 GPUs. The setting -gpu "num=4:mps=yes:mode=exclusive_process"
, on a node with 4 GPUs, will not allow any other jobs to run, because all 4 GPUs will be used exclusively.
-gpu "mps=yes:mode=shared"
With mps on (mps=yes:mode=exclusive_process
), the NVIDIA MPS architecture is designed to allow a user to run many jobs using the same mps server, even though the mode is set to exclusive_process. However, our LSF is not set up to allow that, effectively meaning that if mode=exclusive_process
, a job will use the GPU exclusively, and not share with other jobs from the same user.
This means that mps=yes:mode=exclusive_process
and mps=no:mode=exclusive_process
operate the same, where sharing is concerned.
Note that users would rarely need to do this, and should not use this capability without serious consideration. Use
#BSUB -x
if the queue allows this. If not, for a 4 GPU node, use
-gpu "num=4:mps=yes:mode=exclusive_process"
or
-gpu "num=4:mps=no:mode=exclusive_process"
module avail cudashows all of the cuda toolkit packages available. These should cover any application. So for example, if the application requires cuda toolkit 10.1, then
module load cuda/10.1will prepare the environment variables so that when you compile your code, the appropriate nvcc, cuda libraries and cuda include files can be found.
#!/bin/bash #BSUB -n 1 #BSUB -W 30 #BSUB -q gpu #BSUB -R "select[rtx2080]" #BSUB -gpu "num=1:mode=shared:mps=yes" #BSUB -o out.%J #BSUB -e err.%J module load PrgEnv-pgi module load cuda/10.1 ./nnetworks.exe
module load cuda/12.0since that is available on our system. Also make sure that the code is compiled with cc = 6.0.
#!/bin/bash #BSUB -n 1 #BSUB -W 30 #BSUB -q gpu #BSUB -R "select[gtx1080]" #BSUB -gpu "num=1:mode=shared:mps=yes" #BSUB -o out.%J #BSUB -e err.%J module load PrgEnv-pgi module load cuda/12.0 ./nnetworks.exe
This information can be obtained with
lshosts -gpuResource type Description cc Driver
Use of CUDA on the GPUs is demonstrated with the following example code that adds two vectors.
CUDA C/C++ Example:
ReadMe
C/C++ Makefile
vectorAdd.cu
CUDA for Fortran Example:
ReadMe
Fortran Makefile
Fortran file
Cuda File
Last modified: January 16 2025 10:02:25.