The PyTorch website describes the library as:

Tensors and Dynamic neural networks in Python with strong GPU acceleration.

Setup PyTorch on CSD3

  • load a recent python and the pytorch dependencies:

    $ module load python/3.6 cuda/10.0 cudnn/7.5_cuda-10.0
  • create and activate a virtual environment:

    $ virtualenv --system-site-packages ~/pytorch-env
    $ source ~/pytorch-env/bin/activate
  • install pytorch into your virtual env:

    $ pip install torch torchvision
  • download and run an example program:

    $ wget
    $ python

Running a PyTorch program

PyTorch will be able to run on both CPU and GPU.

CPU submission script:

#SBATCH --partition skylake
#SBATCH --nodes 1
#SBATCH --exclusive

unset OMP_NUM_THREADS #let pytorch & MKLDNN use all available CPU cores

GPU submission script:

#SBATCH --pascal pascal
#SBATCH --nodes 1
#SBATCH --gres=gpu:1
#SBATCH --exclusive