The Jupyter Notebook is a web-based interactive computing platform. The notebook combines live code, equations, narrative text, visualizations etc. Chances are that you would like to use it in the cluster.
To do so you have to:
You must create something like this:
#!/bin/bash #SBATCH --job-name jupy #SBATCH --nodes 1 #SBATCH --ntasks-per-node 1 #SBATCH --cpus-per-task 64 #SBATCH --mem 64G #SBATCH --time 1-00:00:00 #SBATCH --output jupy.log cd /yourdir/ module purge module load your_modules conda activate your_env jupyter notebook --no-browser --ip=0.0.0.0 --port=PortNumber
Where PortNumber is a free port for your Notebook to run, I will use 1357 here as an example.
IMPORTANT: If another process or another Jupyter Notebook is running on the port number you specified, your job will be either die or will be queued waiting for the previous job to finish. Please change the port number.
Then you have to launch your job with:
sbatch yourjob.sh
In the log file you specified in your script you will find a line with a token:
[I 10:23:58.726 NotebookApp] http://computingnode:1357/?token=8e184c4fa1ec5d60e31fb721adc3202317aac0adca177127
Write it down. It will change every time.
Create an SSH tunnel from your local machine to the computing node via the headnode:
ssh -N -L 1357:computingnode.unicph.domain:1357 youruser@headnode
Any traffic you send to port 1357 on your local machine will be securely forwarded through the headnode and then on to port 1357 on the computing node.
This is useful if you need to access a service on the computing node that you can't reach directly, but you can reach through the head node.
To connect to your notebook you have just to point your browser to
http://localhost:1357
and write down the token you got before (8e184c4...) in the password field.