Jupyter on the Brain Mapping Cluster

Daniel Tward, in Tutorials

Instructions to run jupyter notebooks on the brain mapping cluster


Step 1

Make sure you have a folder that is a subdirectory of your home folder, that other people can read. e.g. ~/Public.

e.g. mkdir ~\Public chmod a+rwx Public

Daniel will copy a file into this folder, called notebook2024intel.sh. You should be able to edit that file.

Step 2

We'll walk through the file.

The first line says #!/bin/bash , this means the program bash (bourne again shell) will interpret this file.

The next line starts with a #, which means comment in bash. Bash will ignore this line. But, it says #SBATCH. That means, our scheduler slurm, will read this line even though bash will ignore it. Lines of this form pass options to the scheduler.

You can see a few options that you are welcome to change. The most important will be memory and run time. Make sure you chose enough. Time should be about 1 day. make sure you write to disk. Anything in memory after one day will be deleted.

You can read about other options by looking up the sbatch command.

The next frame says tunneling info. We want to tell jupyter notebook server to serve on a certain port, and you will access that port from your laptop.

Step 1

Make sure you have a copy of the script, notebook2024intel.sh in your home folder.

Step 1

Make sure you have open ssh installed on your system. From a terminal type:

ssh

It will print out usage information.

Step 2

In your home folder, you should have a folder named .ssh. If you don't have it you should create it:

cd ~
mkdir .ssh

(note that ~ will expand to your home directory)

Type

ls -a

to display the contents of the folder. -a means display all, even hidden folders. A hidden folder starts with a .. This means it is not displayed by default, it doesn't mean it is incrypted or secret in any way.

Step 3

In the .ssh folder, you check for a file named config. If you don't have it, create it, e.g.:

cd ~ (tilde means your home folder)
cd .ssh
touch config

Then you can edit the file using a terminal text editor like nano:

nano config

Step 4

Put an entry for brain mapping in your config file.

Host bmap
     HostName clgui.bmap.ucla.edu
     User your_user_name

(whitespace does not matter)

Save the file. In nano you can write out ^O or exit ^X and then get prompted to save.

Step 5

Check you can log in. Type:

ssh bmap
```  You will be prompted for your password.


# Step 6
Start setting up security keys so you don't have to type in your password.

In your `.ssh` folder check if you have the files `id_rsa` and `id_rsa.pub`.

If you don't have them, run the command:
```shell
rsa-keygen -t rsa
```  Do not type in a passphrase when prompted, leave it blank. Save it in the default location (which will be your `.ssh` folder).

[Read](https://en.wikipedia.org/wiki/RSA_(cryptosystem)) about public/private keys in cryptography!  It's interesting.

# Step 7
Copy your public key to the brain mapping cluster.  Either, follow the tutorial [here](http://linuxproblem.org/art_9.html), or run the command:
```shell
ssh-copy-id bmap

Step 8

Double check you can log in without typing your password. Type

ssh bmap

Step 9

Check you havea home folder /ifshome/your_user_name

Check that you can access our shared data, /nafs/dtward.