- What is a GPU?
A GPU is a co-processor to accelerate CPUs for general-purpose computing. - What is the difference between CPU and GPU?
GPUs contain more computing units than CPUs. - How many GPUs does NeSI have?
NeSI has 16 nvidia Tesla P100 GPU cards.
mahuika has 8 GPU cards distributed over 4 GPU nodes (2 by node).
maui ancil has 4 GPU cards distributed over 4 GPU nodes (1 per node).
4 GPU cards are used by NIWA for VM. -
SLURM job for GPU.
Add the option #SBATCH --gpus-per-node in a Slurm script.
#!/bin/bash -e
#SBATCH --job-name=GPUJob #job name (shows up in the queue)
#SBATCH --time=00:00:01 #Walltime (HH:MM:SS)
#SBATCH --gpus-per-node=1 #GPU resources required per node
srun pwd # Prints working directory
- SLURM interactive session for GPU
Add the option --gpus-per-node to the command salloc.@mahuika02]$ salloc --gpus-per-node=1
salloc: Pending job allocation XXXXX
salloc: job XXXXX queued and waiting for resources
salloc: Nodes wbg001 are ready for job
@mahuika02]$ ssh wbg001
@wbg001]$
See also: https://support.nesi.org.nz/hc/en-gb/articles/360001316356-Slurm-Interactive-Sessions
- Which is better for my code between CPU or GPU?
Run benchmarks to measure speedup with CPUs and GPUs. - Offload computation on the GPU
Use OpenMP, OpenCL, OpenACC or CUDA directive to offload computation on the GPU. - What is OpenMP?
OpenMP is a library that supports shared memory multiprocessing.
- What is OpenCL or OpenACC?
OpenCL or OpenACC are libraries that support accelerators like GPU. - What is CUDA?
CUDA is a library that supports nvidia GPUs.
- GPU monitoring
Use nvidia-smi on the command line to monitor directly on the GPU.
- CUDA compilation.
Use nvcc on the command line to compile a CUDA program.
$ ml CUDA
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
See also: https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html
- CUDA debugging.
Use cuda-gdb on the command line to debug a CUDA applications on the login node (for mahuika ) or directly on the GPU (for mahuika and maui ancil).
$ ml CUDA
$ cuda-gdb --version
NVIDIA (R) CUDA Debugger
See also: https://docs.nvidia.com/cuda/cuda-gdb/index.html
- CUDA profiling.
Use Nsight compute on the command line to profile a CUDA applications directly on the GPU.
$ ml CUDA
$ nv-nsight-cu-cli --version
NVIDIA (R) Nsight Compute Command Line Profiler
See also: https://docs.nvidia.com/nsight-compute/2020.1/NsightComputeCli/index.html