Skip to content

Instantly share code, notes, and snippets.

@bikcrum
Created October 30, 2022 05:34
Show Gist options
  • Save bikcrum/faab307f403e9265ade491f87e0570f3 to your computer and use it in GitHub Desktop.
Save bikcrum/faab307f403e9265ade491f87e0570f3 to your computer and use it in GitHub Desktop.
Jupyter port forwarding from HPC node to a local machine [Oregon State University]
1. I set this on my local machine and flip
`alias port_map='f(){ ssh -N -L "$2":localhost:"$2" panditb@"$1".engr.oregonstate.edu; unset -f f; }; f'`
2. Enter into flip3 (use same node to re-establish connection to HPC if lost, eg '3' here)
`ssh panditb@flip3.engr.oregonstate.edu`
3. Enter HPC and whatever node thereafter (For example if you connect to cn-gpu5, hostname will be gpu5).
`ssh panditb@compute-{hostname}.hpc.engr.oregonstate.edu`
4. I start the jupyter on node
`jupyter lab --no-browser --port 8888`
5. I go back to flip and forward HPC node to itself
`port_map compute-{hostname} 8888`
6. I go back to local machine and forward flip node to itself
`port_map flip3 8888`
7. Now access `localhost:8888` for jupyter lab on your local machine. *Make sure to change your username above. Also use tmux go to back and forth easily*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment