External Links:
CUDA toolkit and driver compatibility table
CUDA toolkit website
NVIDIA Easy Introduction to CUDA
The new gpus on the new_gpu queue have a different operating system, Rocky 9.2. As a result, there are a few differences in behavior that require some extra commands in order for conda activation to work, and for module commands to work. Also note that (a) only the bash shell works (#!/bin/tcsh will not work) and (b) mpi does not yet work on these nodes. See the sample job below.
#!/bin/bash #BSUB -n 1 #BSUB -W 30 #BSUB -q new_gpu #BSUB -R "select[a100]" #BSUB -gpu "num=4:mode=shared:mps=yes" #BSUB -o out.%J #BSUB -e err.%J source ~/.bashrc source /usr/share/Modules/init/bash 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.
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: March 27 2024 01:17:35.