Last active
December 19, 2024 20:20
-
-
Save smsharma/5a2cab9ae5487dd46a3944c681bc27a8 to your computer and use it in GitHub Desktop.
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 -N 1 # node count | |
#SBATCH --ntasks-per-node=1 | |
#SBATCH -t 96:00:00 | |
#SBATCH --mem=4GB | |
#SBATCH --mail-type=begin | |
#SBATCH --mail-type=end | |
#SBATCH [email protected] | |
source ~/.bashrc | |
port=$(shuf -i 6000-9999 -n 1) | |
/usr/bin/ssh -N -f -R $port:localhost:$port log-0 | |
/usr/bin/ssh -N -f -R $port:localhost:$port log-1 | |
cat<<EOF | |
Jupyter server is running on: $(hostname) | |
Job starts at: $(date) | |
Step 1 : | |
If you are working in NYU campus, please open an iTerm window, run command | |
ssh -L $port:localhost:$port [email protected] | |
If you are working off campus, you should already have ssh tunneling setup through HPC bastion host, | |
that you can directly login to prince with command | |
ssh $USER@prince | |
Please open an iTerm window, run command | |
ssh -L $port:localhost:$port $USER@prince | |
Step 2: | |
Keep the iTerm windows in the previouse step open. Now open browser, find the line with | |
The Jupyter Notebook is running at: $(hostname) | |
the URL is something: http://localhost:${port}/?token=XXXXXXXX (see your token below) | |
you should be able to connect to jupyter notebook running remotly on prince compute node with above url | |
EOF | |
unset XDG_RUNTIME_DIR | |
if [ "$SLURM_JOBTMP" != "" ]; then | |
export XDG_RUNTIME_DIR=$SLURM_JOBTMP | |
fi | |
conda activate | |
jupyter lab --no-browser --port $port --notebook-dir=$(pwd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment