A recipe for interactive computing using custom Jupyter kernels on Stanford's Sherlock. Contributed by @zqfang
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
# install
bash Miniconda3-latest-Linux-x86_64.sh
conda config --set always_yes yes
# install the default py3 kernel for jupyter notebook
conda install ipython jupyter notebook jupyterlab
# add password
jupyter notebook password
conda create -n fastai ipython ipykernel
# add the custom to Jupyter notebook
conda activate fastai
python -m ipykernel install --user --name fastai --display-name FastAI
you could also add R, Julia etc kernel.
You should select the existed cuda version which installed in Sherlock
conda install -c pytorch pytorch torchvision cudatoolkit=10.1
tensorflow
conda install tensorflow-gpu cudatoolkit=10.1
# this is my version
module load cuda/10.1.168
module load cudnn/7.6.4
module load nccl
import torch
print(torch.cuda.is_available())
if print out is True
, then you'er OK to use GPUs.
see details here.
git clone https://github.com/vsoch/forward
cd forward
bash setup.sh
Select Sherlock partition: gpu
bash hosts/sherlock_ssh.sh >> ~/.ssh/config
This recipe is also provided in the repository here.
#!/bin/bash
PORT=$1
NOTEBOOK_DIR=$2
if [ -z "$NOTEBOOK_DIR" ]; then
cd $SCRATCH
else
cd $NOTEBOOK_DIR
fi
## to compile libtorch C++ code, load these modules
# module load gcc/7.3.0
# module load gdb
# module load cmake
# export CC=$(which gcc)
# export CXX=$(which g++)
# select cuda version you need
module load cuda/10.1.168
module load cudnn/7.6.4
module load nccl
# activate fastai env
source activate fastai
jupyter lab --no-browser --port=$PORT
The default working directory is $SCRATCH
bash start.sh jupyter-gpu
change the working directory
bash start.sh jupyter /path/to/dir
if your port is 51888, then
http://localhost:51888/
here is my jupyter lab computing environment. Have fun!
bash resume.sh jupyter-gpu
# or
bash resume.sh jupyter-gpu /path/to/dir
bash end.sh jupyter-gpu
# or
bash end.sh jupyter-gpu /path/to/dir