Skip to content

Instantly share code, notes, and snippets.

@zonca
Last active September 30, 2015 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zonca/357d36347fd5addca8f0 to your computer and use it in GitHub Desktop.
Save zonca/357d36347fd5addca8f0 to your computer and use it in GitHub Desktop.
Jupyter/IPython notebook setup on NERSC Edison
#!/bin/bash
# this is execute by the batch jon on the computing node
# choose a unique port number between 7000 and 9999
export PORT=8181
# tunnel between the computing node and one edison login node
ssh -o StrictHostKeyChecking=no -f -N -p 22 -R $PORT:localhost:$PORT $PBS_O_HOST
# launch IPython notebook
ipython notebook --port=$PORT --no-browser
#!/bin/bash -l
#### use ccm_queue for longer jobs, queuing slower
####PBS -q ccm_queue
#### can use ccm_int for short 30 min jobs, queue is quicker
####PBS -q ccm_int
#PBS -l mppwidth=24
#PBS -l walltime=0:30:00
# send email when job starts, finishes or on error
#PBS -m abe
#PBS -o notebook.log
cd $PBS_O_WORKDIR
# need CCM to have access to SSH
module load ccm
# set full path to the launch_notebook_and_tunnel_to_login.sh script
ccmrun sh ~/notebook/launch_notebook_and_tunnel_to_login.sh
#!/bin/bash
# run this on your laptop
# tunnels via SSH a port between laptop and Edison login node
# then you can connect to localhost:8181 and access 8181 on
# edison login node
# change YOURUSERNAME with your username on Edison
# call the script as bash tunnel_laptop_login.sh ##
# where ## is the 2 digits edison login node number, e.g. 03
[ $# -eq 0 ] && { echo "Usage: bash $0 ##; where ## is 2 digits edison login node number, e.g. 03"; exit 1; }
ssh -f -N -L 8181:localhost:8181 YOURUSERNAME@edison${1}-eth5.nersc.gov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment