PyTorch

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 cuda/9.0 intel/mkl/2017.4
    $ module load python-3.6.1-gcc-5.4.0-64u3a4w py-numpy-1.12.1-gcc-5.4.0-cjrgw2k py-matplotlib-2.2.2-gcc-5.4.0-6oe6fph
    $ module load py-virtualenv-15.1.0-gcc-5.4.0-gu4wi6c
    
  • 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 https://download.pytorch.org/whl/cpu/torch-1.1.0-cp36-cp36m-linux_x86_64.whl
    $ pip install https://download.pytorch.org/whl/cpu/torchvision-0.3.0-cp36-cp36m-linux_x86_64.whl
    $ pip install kiwisolver
    
  • download and run an example program:

    $ wget https://pytorch.org/tutorials/_downloads/cifar10_tutorial.py
    $ python cifar10_tutorial.py
    

Running a PyTorch program

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

CPU submission script:

#/bin/bash
#SBATCH -A MYACCOUNT-CPU
#SBATCH -p skylake
#SBATCH -N 1
#SBATCH --exclusive

python myprogram.py

GPU submission script:

#/bin/bash
#SBATCH -A MYACCOUNT-GPU
#SBATCH -p pascal
#SBATCH -N 1
#SBATCH --gres=gpu:1
#SBATCH --exclusive

python myprogram.py