Created
September 25, 2019 22:12
-
-
Save raeidsaqur/3db28344d751e985675f1394ec7bf8b5 to your computer and use it in GitHub Desktop.
nb.slurm is a slurm script to launch a Jupyter notebook server on ionic. You can connect to it by tunneling using SSH from your local machine -- Follow the instructions in the corresponding slurm output file after the job gets scheduled.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#SBATCH --partition general | |
#SBATCH --nodes 1 | |
#SBATCH --ntasks-per-node 1 | |
#SBATCH --mem 16G | |
#SBATCH --gres gpu:1 | |
#SBATCH --time 1-0:00:00 | |
#SBATCH --job-name jupyter-notebook | |
#SBATCH --output jupyter-notebook-%J.log | |
# get tunneling info | |
XDG_RUNTIME_DIR="" | |
port=$(shuf -i8000-9999 -n1) | |
node=$(hostname -s) | |
user=$(whoami) | |
cluster=$(hostname -f | awk -F"." '{print $2}') | |
# print tunneling instructions jupyter-log | |
echo -e " | |
MacOS or linux terminal command to create your ssh tunnel | |
ssh -N -L ${port}:${node}:${port} ${user}@${cluster}.cs.princeton.edu | |
Windows MobaXterm info | |
Forwarded port:same as remote port | |
Remote server: ${node} | |
Remote port: ${port} | |
SSH server: ${cluster}.hpc.yale.edu | |
SSH login: $user | |
SSH port: 22 | |
Use a Browser on your local machine to go to: | |
localhost:${port} (prefix w/ https:// if using password) | |
" | |
# load modules or conda environments here | |
# uncomment the following two lines to use your conda environment called notebook_env | |
# module load miniconda | |
# source activate notebook_env | |
# DON'T USE ADDRESS BELOW. | |
# DO USE TOKEN BELOW | |
jupyter notebook --no-browser --port=${port} --ip=${node} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment