Skip to content

Deep Learning with GPUs

In order to get your job set up properly and test your environment, you will want to allocate a compute node that has a GPU. Here are a couple examples:

srun --pty -p gpu -c 2 -t 12:00:00 --gres=gpu:1 bash

or, if the gpu queue is busy, try to scavenge some private GPUs:

srun --pty -p scavenge -c 2 -t 12:00:00 --gres=gpu:1 bash

Next, we'll walk though the setup and activation of your environment.

One time Setup


Load the appropriate modules for either Farnam or Grace.

# load modules for Farnam
module purge
module load GCC/7.3.0-2.30
module load cuDNN/7.1.4-CUDA-9.0.176
module load Python/miniconda

# or load modules for Grace
module purge
module load Langs/GCC/5.2.0
module load GPU/cuDNN/9.0-v7
module load Langs/Python/miniconda

Then save your modules as a collection.

# save module environment
module save cuda
module purge

Create Your Python Environment

You will want to create a virtual environment for your GPU enabled code. For more details on Conda environments, see our Conda documentation.

# create conda environment for deep learning/neural networks
conda create -y -n dlnn python=3.6 anaconda
source activate dlnn

#install libraries
pip install --force --upgrade setuptools
pip install keras
pip install Theano
pip install
pip install
pip install torchvision

Use Your Environment

Now, to re-enter your Deep Neural Network environment, you just need the following:

module restore cuda
source activate dlnn