Create an account (do it once)

Register on https://perseus.univ-grenoble-alpes.fr using your institutional email address. When your account is activated, you will receive an email.

Preliminary steps for Windows10 users (last updated May 2020)

If you use Linux or Mac OSX, skip this section. For Windows10, you will need to activate OpenSSH (“Settings”, then “Apps and features”, then “Manage optional features”, then “Add a feature” and look for “OpenSSH Client”, then install it). Then, install Ubuntu20 from the Windows Store (see this page). Then, launch the Ubuntu app in Windows.

You can enable copy/paste through Ctrl+Maj+C/v somewhere in the menu.

Then, to enable remote display, do:

echo "export DISPLAY=localhost:0.0" >> ~/.bashrc
source ~/.bashrc
sudo apt-get update
sudo apt-get install xterm

Check connections

export MYLOGIN='munkw'  ## replace munkw with your GRICAD login
ssh ${MYLOGIN}@access-rr-ciment.imag.fr

This will connect you on one of the gateways (either rotule or trinity), from which you should be able to connect to luke or dahu:

ssh luke
exit

Set up an SSH tunel to directly connect to luke or dahu (do it once)

See full documentation here.

Do this on your computer (provide a relatively complex pass phrase):

ssh-keygen
export MYLOGIN='munkw'  ## replace munkw your GRICAD login
cat ~/.ssh/id_rsa.pub | ssh ${MYLOGIN}@access-ciment.univ-grenoble-alpes.fr 'cat >> .ssh/authorized_keys'

If you want to enter the pass phrase only once per session on your computer:

cat << EOF >> ~/.bashrc

if [ $? -eq 2 ]
then
  echo launch ssh-agent
  eval $(ssh-agent)
  ssh-add
fi
EOF
source ~/.bashrc

Now, to set up a tunel connection:

cat << EOF >> ~/.ssh/config
Host luke* cargo* dahu*
  User ${MYLOGIN}
  ProxyCommand ssh -q ${MYLOGIN}@access-gricad.univ-grenoble-alpes.fr "nc -w 60 `basename %h .ciment` %p"
  GatewayPorts yes

Host *
  ServerAliveInterval 60
  TCPKeepAlive yes
  ForwardX11Trusted yes
EOF

You should now be able to connect directly from your computer to luke or dahu, entering your pass phrase for the first connection but no password:

ssh -X luke

NB: For Windows10 users, it is possible that permissions are not set correctly by default, so you may need to change them once .ssh/config is created:

chmod ugo-rwx ~/.ssh/config
chmod u+rw ~/.ssh/config

Prepare a workable environment (do it once)

To activatre the module environment on luke or dahu:

cat << EOF >> ~/.bashrc

# to access module commands : 
source /applis/ciment/v2/env.bash
EOF
source ~/.bashrc

To check that it works:

module avail
module load nco
which ncks

You can also define some aliases:

cat << EOF >> ~/.bashrc

# Aliases:
alias ll='ls -l'
alias lr='ls -lrt'
alias h='history'
alias whereami='echo `whoami`@luke:`pwd`'
alias qs='oarstat -u `whoami` --format 2'
alias bet='cd /bettik/`whoami`'
alias gfortran='/usr/bin/gfortran -ffixed-line-length-none -ffree-line-length-none'
EOF
source ~/.bashrc

Set up a conda environment (do it once)

ssh -X luke

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
sh Miniconda3-latest-Linux-x86_64.sh
. ~/.bashrc
conda info
conda create --name py37  python=3.7
conda activate py37
conda install numpy ipython netcdf4 xarray matplotlib scipy pandas pillow

Other possibly useful libraries include:

conda install dask 
conda install zarr
pip install watermark # load with '%load_ext watermark' # print versions with '%watermark -v -iv'
conda install cartopy
conda install -c conda-forge cmocean # nice colors for ocean plots

If you use Jupyter (inspired by the MEOM page:

conda install jupyter jupyterlab numba ipykernel nodejs
conda install -c conda-forge papermill # to run notebooks like scripts
conda install -c conda-forge gsw
python -m ipykernel install --user --name py37 --display-name py37

For dask dashboard in jupyter lab:

pip install dask_labextension
jupyter labextension install dask-labextension
jupyter serverextension enable --py --sys-prefix dask_labextension

To enable running notebooks on the cluster:

jupyter notebook --generate-config
echo "c.NotebookApp.open_browser = False" >> ~/.jupyter/jupyter_notebook_config.py
echo "c.NotebookApp.ip = '0.0.0.0'" >> ~/.jupyter/jupyter_notebook_config.py
exit

Run Jupyter Notebook in conda environment (do every time)

In a first terminal, do (here assuming that you belong to group ice_speed and have access to node luke62):

ssh -X luke
oarsub -I -l nodes=1/core=1,walltime=00:29:00 --project ice_speed -p "network_address='luke62'"
conda activate py37
jupyter notebook

It should give you a web address http://127.0.0.1:…

NB: the oarsub command allocates a number of cores for a certain amount of time. If you work on large files, you will need to increase the core number in the oarsub command (e.g. core=4). You can increase the walltime to e.g. 24:00:00, although you may have to wait some time in the queue before obtaining access.

In a second terminal:

ssh -fNL 8888:luke62:8888 luke

NB: if port 8888 is already being used, the jupyter notebookcommand will give you another port number (e.g. 8889).

Then, in a web browser (e.g. Firefox, Chrome…), copy/paste the aforementioned address starting as http://127.0.0.1. This should open Jupyter notebook.

Once you are done, you need to free the port (here 8888):

lsof -ti:8888   # indicates a number
kill -9 <number>