Getting started with Jupyter Notebooks
Contents
1. Request an interactive session on a GPU compute node
bsub -Is -gpu - bash
2. Start a python2 Jupyter notebook
Start the notebook
jupyter notebook --no-browser --ip=0.0.0.0
Sample output
[I 13:32:23.937 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 13:32:23.937 NotebookApp] Copy/paste this URL into your browser when you connect for the first time, to login with a token: http://ds-cmgpu-04:8888/?token=68042f40a10b500f3747ae0a232ee209fa4bf1aa384d29ba&token=68042f40a10b500f3747ae0a232ee209fa4bf1aa384d29ba
Copy the URL, host, and port
Copy the URL but don’t paste it in your browser yet.
Make a note of which compute host and port the notebook is running on (e.g. host ds-cmgpu-04 and port 8888 in this case)
3. Port Forwarding
In a separate terminal window from your local computer, forward your local port to the remote host.
ssh command port forwarding
ssh -l <username> login1.deepsense.ca -L <local_port>:<remote_host>:<remote_port>
for example, ssh -l user1 login1.deepsense.ca -L 8888:ds-cmgpu-04:8888
Note that you may need to use a different <local_port> than 8888 if you have other web services running on your local computer. In particular, if you run a jupyter notebook locally then it will use port 8888 and you will try to connect to the local jupyter notebook instead of the cluster notebook. In this case close your port forwarding and try again with 8889 or another unused port.
PuTTY port forwarding on Windows
If you are using a PuTTY terminal from a Windows computer to access DeepSense then you can still forward ports.
Before starting your session, scroll down to the option Connection->SSH->Tunnels
in the Category pane.
Enter the local_port
in the Source port
field. For example, 8888
.
Enter <remote_host>:<remote_port>
in the Destination field. For example, ds-cmgpu-04:8888
.
Press the Add
button to add the port forwarding rule to your PuTTY session.
Finally, open the session as usual.
4. Open the desired sample notebook
Enter the copied URL in your web browser but change the remote host name to “localhost” before pressing enter.
Note: On our macs, this worked in Chrome, but not in Safari. Unfortunately, there was no error reported, it simply could not connect.
Enjoy Deep Learning on DeepSense!