Skip to content

PyTorch

PyTorch with gpu-support is available in the 2022r2 software stack. You need to load the following modules to enable PyTorch:

module load 2023r1 openmpi py-torch

You can check for the availability of a gpu card with PyTorch with the following python script:

howmanygpus.py
--8<-- "docs/howtos/pytorch/howmanygpus.py

This script can be run with sbatch as follows:

howmanygpus.slurm
#!/bin/bash
#SBATCH --job-name="pytorch/howmanygpus"
#SBATCH --output=howmanygpus.out
#SBATCH --time=00:10:00
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --gpus-per-task=1
#SBATCH --partition=gpu
#SBATCH --mem=4G
# make sure to add your account!
##SBATCH --account=<what>-<faculty>-<group>

module load 2023r1
module load openmpi
module load py-torch

srun python howmanygpus.py

If you have a more illustrative example that you would like to share, please post on mattermost or send it to info-DHPC@tudelft.nl.