Instructions for installing pytorch on the NPL cluster. These directions for PyTorch assume you have a working Conda install. Pytorch is picky on the Python version, we currently recommend python=3.10.13
Load CUDA¶
module load gcc cuda
Install¶
The regular meta package should now detect cuda support and you will see a package name that includes cuda such as conda-forge/linux-64::pytorch-2.1.2-cuda120_py310h327d3bc_301 in the list to be installed. You no longer need to specify that you want cuda with pytorch::pytorch-cuda .
conda install pytorch
Confirm CUDA is enabled¶
Confirm your pytorch install is working and CUDA is available. Performance is terrible if CUDA is not enabled.
python
Then enter the following code
import torch
torch.cuda.is_available()