To run access a remote jupyter notebook, you will need to do the following:
- Setting ssh config file (
~/.ssh/config
):
Host FLIP # access point server
HostName access.engr.oregonstate.edu
User ONIDusername
Host DGX # target server
HostName submit-b.hpc.engr.oregonstate.edu
User ONIDusername
ProxyJump FLIP
Context: at OSU, FLIP server is our access point server and DGX server is a cluster server that I would like to access, so in order to access the DGX server, I would need to access the FLIP server first. The ProxyJump
configuration states that if I want to access the DGX server, I would need to access the FLIP server first. This step is needed for VS code's extension, Remote - SSH
, to have access to the DGX server.
Note: Steps 1.b-c
and 2.b-c
assuming the DGX server uses SLURM to manage jobs, so if your target server doesn't use SLURM, please skip them.
-
Setting Port Forwarding
a. Ssh to the
DGX
serverb. Load SLURM using the following command:
module load slurm
c. Start a job using the following command:
srun -A eecs -p dgx2 --gres=gpu:1 --pty bash
(group=eecs, machine=dgx2, shell=bash), replace any flag value as neededd. Install ngrok and follow their setup (https://ngrok.com/)
e. Start the ngrok server:
./ngrok http PORT
, replace PORT with any portf. Copy the generated URL, for example
https://ad32ef7ad45e.ngrok.io
-
Setting the Jupyter's Kernel
a. Ssh to the
DGX
serverb. Load SLURM using the following command:
module load slurm
c. Access the node used in
1.c
using this following command:ssh NODE
(NODE is what is written in the left, e.g. dgx2-5)d. Access your conda/pip environment if needed
e. Generate a Jupyter configuration file:
jupyter notebook --generate-config
f. Set Jupyter's configuration:
echo "c.NotebookApp.allow_remote_access = True" >> ~/.jupyter/jupyter_notebook_config.py
g. Start Jupyter's server:
jupyter notebook --no-browser --port=PORT
, replace PORT with the same PORT used in1.e
h. Copy the URL token parameter, for example
?token=...
-
Connecting everything together! (in VS code)
a. Install
Remote - SSH
VS code's extensionb. Connect to the
DGX
server usingRemote - SSH
c. Open a Folder and select the folder of your project
d. CTRL+SHIFT+P then type
Jupyter: Specify local or remote ...
f. Select
Existing
then paste ngrok's url + token parameter, for examplehttps://ad32ef7ad45e.ngrok.io/?token=...
Props to Austin L.
for sharing ngrok
and Aayam S.
for sharing how ngrok
and jupyter notebook
could be used together.
You got me going man, I've been banging my head on this one. Many thanks, let me know if I can help you in any respectful way!