GPU job
Below a simple batch job is shown that runs on a single GPU node. The job does not start a real GPU program but rather nvidia-smi
(NVIDIA System Management Interface program) which prints information on the GPU(s) found in the node.
line no. |
gpu-job.sh |
1 2 3 4 5 6 7 8 9 10 |
#!/bin/bash #SBATCH --partition=gpu #SBATCH --time=00:02:00 #SBATCH --export=NONE
source /sw/batch/init.sh
nvidia-smi
exit |
---|
Note that on Hummel batch jobs use nodes exclusively. As a consequence a GPU job shall use both CUDA devices available on each GPU node. A simple way to achieve this, is to run two CUDA binaries concurrently:
CUDA_VISIBLE_DEVICES=0 cudaBinary1 [arguments1] & CUDA_VISIBLE_DEVICES=1 cudaBinary2 [arguments2] & wait
(The wait
command is necessary to wait for completion of both background processes.)