PyTorch
Description
PyTorch is a machine learning library with strong support for neural networks and deep learning. PyTorch also has a large user base and software ecosystem.
Environment Modules
To use PyTorch on HiPerGator, you first need to load one of the PyTorch environment modules.
Run module spider pytorch
to find out what environment modules are available for PyTorch.
Once you determine which module you want to use, load it as follows (using pytorch/1.7.1
as an example):
module load pytorch/1.7.1
Without a version number, the latest installed version will load. ngc-pytorch is the pytorch software environment from the Nvidia GPU Cloud (NGC) with Apex optimizers.
Additional Information
To use PyTorch with a GPU or GPUs on HiPerGator, you must request the --gpus
or --gpus-per-task
resource and specify the gpu
partition in your job script or on the command line as described in the GPU Access help page. For example, to start an interactive session with access to a single GPU, you might run the following command.
srun --partition=gpu --gpus=1 --ntasks=1 --mem=4gb --time=08:00:00 --pty bash -i
Job Script Examples
To help you get started, here is an example SLURM script for running a PyTorch application on a single GPU on HiPerGator. If you are new to writing SLURM scripts and scheduling SLURM jobs, you will want to first read our help information on using SLURM and writing SLURM scripts. For information about using GPUs on HiPerGator, please see GPU Access.
Note that lines beginning with #SBATCH
are instructions to the SLURM scheduler. Lines beginning with #
are comments to help you understand the script; feel free to delete them if you adapt this script for your own use.
Expand to view example script.