PyTorch Installation
0.0.1 PyTorch
PyTorch is a popular open-source deep learning framework widely used for research and production applications. Developed by Facebookâs AI Research lab, PyTorch offers a dynamic computational graph, making it a flexible choice for deep learning tasks. It provides an extensive collection of tools and libraries for building and training neural networks.
0.0.2 PyTorch Software Environment Setup
It is recommended to use Conda to install PyTorch package. For detailed instructions on how to use Conda, please refer to the following link for instructions: https://www.carc.usc.edu/user-guides/data-science/building-conda-environment
0.0.2.1 Step 1: Request for an interactive Session
[user@discovery1 ~]$ salloc --partition=gpu --gres=gpu:1 --cpus-per-task=8 --mem=32GB --time=1:00:00
salloc: Pending job allocation 15731446
salloc: job 15731446 queued and waiting for resources
salloc: job 15731446 has been allocated resources
salloc: Granted job allocation 15731446
salloc: Waiting for resource configuration
salloc: Nodes a02-15 are ready for job
[user@a02-15 ~]$
0.0.2.2 Step 2: Load Conda module and initialize shell to use Conda and Mamba (Step 2 is only needed if it is the first time you are using Conda on the cluster)
Note: Mamba is a drop-in replacement for most conda commands that enables faster package solving, downloading, and installing
module purge
module load conda
mamba init bash
source ~/.bashrc
module purge
0.0.2.3 Step 3: Create a virtual environment & install PyTorch package
After you finish initialization of shell in Step 2, you can start the PyTorch installation process using Conda with the following commands:
mamba create --name torch-env
mamba activate torch-env
mamba install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia