Last active
March 4, 2025 20:32
-
-
Save raeidsaqur/58e52ad18b6be28e7b76a58cf59caae3 to your computer and use it in GitHub Desktop.
SLURM script for opening a Jupyter Notebook tunnel
This file contains hidden or 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 -p p100 | |
#SBATCH --gres=gpu:1 | |
#SBATCH -c 4 | |
#SBATCH --mem=16G | |
#SBATCH --nodes=1 | |
#SBATCH --ntasks=1 | |
##SBATCH --ntasks-per-node=1 | |
#SBATCH --time=04:00:00 | |
#SBATCH --job-name=jupyter-notebook | |
#SBATCH --output=jupyter-notebook-%j.log | |
date;hostname;pwd | |
## Get Tunneling Info ## | |
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}.vectorinstitute.ai | |
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) | |
" | |
cd $SLURM_SUBMIT_DIR | |
##. jupyter.env | |
export PATH=/pkgs/anaconda3/bin:$PATH | |
export XDG_RUNTIME_DIR="" | |
# DON'T USE ADDRESS BELOW. | |
# DO USE TOKEN BELOW | |
##jupyter notebook --ip 0.0.0.0 --port 8888 | |
jupyter notebook --no-browser --port=${port} --ip=${node} | |
## Compare with Vector jupyter instructions: | |
## https://support.vectorinstitute.ai/jupyter_notebook |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment