PyTorch
PyTorch is an optimized tensor library for deep learning using GPUs and CPUs.
Installing PyTorch on the HPC#
PyTorch is not provided through the system-wide Python installation on the HPC. Users should install PyTorch in a user-managed Python environment. We recommend using either uv (a fast Python package and environment manager) or a Python virtual environment (venv).
Installing PyTorch with uv#
uv is a fast, modern Python package and environment manager that replaces tools such as pip, and virtualenv.
First, load the uv module:
Then create and activate a uv environment:
Next, install PyTorch using uv:
Installing PyTorch with a Python Virtual Environment (venv)#
First, load the Python module:
Then create and Activate a virtual environment:
Next, install PyTorch using pip:
Using PyTorch on the HPC#
Use the sample code from the Verification section of the PyTorch guide:
Using GPUs with PyTorch#
To run a PyTorch job on a GPU node, you need to submit a job to our job scheduler, and indicate that you want to run using GPUs.
Warning
Running torch.cuda.is_available() on the login node will return False. It will return True on a GPU node.