GPU Example
#!/bin/bash
#
#SBATCH --job-name=test_job
#SBATCH --account=gpu_gres # to access gpu resources
#SBATCH --partition=gpu
#SBATCH --nodes=1 # request to run job on single node
##SBATCH --ntasks=10 # request 10 CPU's (t3gpu01/02: balance between CPU and GPU : 5CPU/1GPU)
#SBATCH --gres=gpu:2 # request for two GPU's on machine, this is total amount of GPUs for job
##SBATCH --mem=4000M # memory (per job)
#SBATCH --time=0-00:30 # time in format DD-HH:MM
# each node has local /scratch space to be used during job run
mkdir -p /scratch/$USER/${SLURM_JOB_ID}
export TMPDIR=/scratch/$USER/${SLURM_JOB_ID}
# Slurm reserves two GPU's (according to requirement above), those ones that are recorded in shell variable CUDA_VISIBLE_DEVICES
echo CUDA_VISIBLE_DEVICES : $CUDA_VISIBLE_DEVICES
# python program script.py should use CUDA_VISIBLE_DEVICES variable (*NOT* hardcoded GPU's numbers)
python script.py
# cleaning of temporal working dir when job was completed:
rmdir -rf /scratch/$USER/${SLURM_JOB_ID}
--
NinaLoktionova - 2019-09-24