Besides the present tutorial other material is available in the following links:
- Presentation by Albert Gutiérrez and Tomasz Żok entitled "Remote submission on Marconi with SUMI and uDocker" presented on the WPCD Code Camp at Innsbruck on 18th December 2018.
- Webinar by Albert Gutiérrez and Tomasz Żok based on the previous presentation.
1. Introduction
Remote submission of IMAS HPC workflows may be challenging due to main factors: connecting and communicating with heterogenous supercomputers, and being able to run the IMAS environment inside a supercomputer within the user space. To approach these issues, an approach with virtualized environment with IMAS installed and a remote submission system has been designed.
The use case considered is: an IMAS developer working on a environment with IMAS installed wants to run an IMAS workflow on a big supercomputer. The environment were the developer will be working will be mainly the Marconi Gateway paritiond, ITER cluster and occasionally a local user computer. From there, the workflow will be submitted from a remote supercomputer (mainly PRACE HPC facilities).
Fig. 1 describes the scheme of the methodology developed to submit remote workflows. Working on the Gateway, ITER cluster or local machine, we configure SUMI tools (SUbmission Manager for IMAS) which allow the submission of jobs to remote queuing systems of supercomputers. These supercomputers will run the IMAS workflow using a Docker image which will be running on top of uDocker.
Figure 1. Scheme for the remote submission of IMAS workflows involving HPC codes.
2. Getting started
This tutorial describes the steps to submit an example uDocker IMAS workflow workflow image from Gateway or ITER cluster to a remote supercomputer. To do so we will make usage of uDocker and SUMI (SUbmission Manager for IMAS).
These work on different sides of the system: local machine and remote HPC system:
- Connect from a local computer to a remote cluster to submit my workflow: IMAS
- Bring IMAS environment to supercomputer heterogenous systems: uDocker image
The following tutorial has been tested with the following machines.
- ITER cluster @ITER
- Marconi @Cineca
- Marconi Gatway @Cineca
- Eagle @PSNC
The tutorial follows the next steps
- Install SUMI.
- Passwordless connection with Marconi.
- Install uDocker on Marconi
- SCP Docker image from Gateway to Marconi and create container
- Test image on Marconi.
- Configure and submit workflow, then check output on GW.
3. Install SUMI
SUMI is a tool capable of submitting jobs to remote HPC clusters and upload and retrieve data from them. The code is available in the following link:
https://bitbucket.org/albertbsc/sumi/
New releases of the code can be found in the following link:
https://bitbucket.org/albertbsc/sumi/downloads/
The following subsections describe how to install it for Gateway and ITER cluster.
3.1. Install SUMI on Marconi Gateway
This subsection describes how to install SUMI on Marconi Gateway. If you want to install it on ITER cluster, please move to the following subsection.
Given that SUMI uses 2.7 python version, first we will load the correspondent module
module load python/2.7.12
SUMI depends on two powerful libraries to perform its tasks. These are Paramiko (data transfer) and SAGA (remote job submission). To install the dependencies we need to download python libraries, but given that we do not have root permissions we will make usage of a virtual environment which will allow to install these libraries locally. For this purpose we will use "virtualenv". It creates a python environment in local folders and allows to create a virtual python environment where we can install libraries locally. To set it up we run the following commands:
mkdir sumi-virtualenv virtualenv sumi-virtualenv
Once the virtualenv folder has been configured, we can load the environment.
In the case of TCSH shells as Gateway
source sumi-virtualenv/bin/activate.csh
Our terminal prompt will now show the folder name in front of out username in the following way:
[sumi-virtualenv] <g2user@s65
To install the dependencies, now we can run the "pip" command which will install the python libraries in our local virtualenv
pip install saga-python==0.50.01 paramiko
Once the dependencies have been installed, we can download and configure SUMI. To retrieve the code run the following command
wget -qO- https://bitbucket.org/albertbsc/sumi/downloads/sumi-0.1.0.tar.gz | tar xvz
This will create a local folder named "sumi". To include it in the $PATH environment variable we need to run the software.
For TCSH shell systems (as Gateway)
setenv PATH $PATH\:$HOME/sumi/bin
SUMI requires two configuration job files which contain the information of the jobs to be submitted and the HPC cluster where we are going to submit. For this we need to create the configuration folder and copy the configuration files jobs.conf and servers.conf from sumi/conf/ directory.
mkdir $HOME/.sumi cp sumi/conf/*.conf $HOME/.sumi
Now, we are ready to run SUMI. Execute the option "-h" to see all the options
$ sumi -h usage: sumi.py [-h] [-r] [-u UP] [-d DOWN] [-m MACHINE [MACHINE ...]] [-j JOBS [JOBS ...]] Submission Manager for IMAS optional arguments: -h, --help show this help message and exit -r, --run Run the configured job on a specific cluster -u UP, --upload UP Upload local file -d DOWN, --download DOWN Download remote file -m MACHINE [MACHINE ...], --machine MACHINE [MACHINE ...] List of machines were to submit -j JOBS [JOBS ...], --job JOBS [JOBS ...] List of jobs to be submitted
Then, SUMI has been installed successfully.
3.2. Install SUMI on ITER cluster
This subsection describes how to install SUMI on ITER cluster. If you want to install it on Marconi Gateway, please move to the previous subsection.
In this tutorial the local computer used will be Marconi Gateway. Given that SUMI uses 2.7 python version, first we will load the correspondent module
module load python/2.7.15
SUMI depends on two powerful libraries to perform its tasks. These are Paramiko (data transfer) and SAGA (remote job submission). To install the dependencies we need to download python libraries, but given that we do not have root permissions we will make usage of the option "–user" for pip, which will install these libraries locally. To install the dependencies, now we can run the "pip" command which will install the python libraries
pip install saga-python==0.50.01 --user pip install paramiko --user
Once the dependencies have been installed, we can download and configure SUMI. To retrieve the code run the following command
wget -qO- https://bitbucket.org/albertbsc/sumi/downloads/sumi-0.1.0.tar.gz | tar xvz
This will create a local folder named "sumi". To include it in the $PATH environment variable we need to run the software.
For Bash shells
export PATH=$PATH:$PWD/sumi/bin/
SUMI requires two configuration job files which contain the information of the jobs to be submitted and the HPC cluster where we are going to submit. For this we need to create the configuration folder and copy the configuration files jobs.conf and servers.conf from sumi/conf/ directory.
mkdir $HOME/.sumi cp sumi/conf/*.conf $HOME/.sumi
Now, we are ready to run SUMI. Execute the option "-h" to see all the
$ sumi -h usage: sumi.py [-h] [-r] [-u UP] [-d DOWN] [-m MACHINE [MACHINE ...]] [-j JOBS [JOBS ...]] Submission Manager for IMAS optional arguments: -h, --help show this help message and exit -r, --run Run the configured job on a specific cluster -u UP, --upload UP Upload local file -d DOWN, --download DOWN Download remote file -m MACHINE [MACHINE ...], --machine MACHINE [MACHINE ...] List of machines were to submit -j JOBS [JOBS ...], --job JOBS [JOBS ...] List of jobs to be submitted
Then, SUMI has been installed successfully on ITER cluster.
4. Passwordless configuration with Marconi
Because SUMI uses SSH channels to submit jobs and to transfer data we need a passwordless connection to avoid the password requirement for every step. To achieve so the targeted HPC machine needs to have the public key of our account at Gateway on the list of allowed keys. If we don't have a ~/.ssh/id_rsa.* file in our Gateway/ITER account we have to generate our keys
ssh-keygen
This will generate ~/.ssh/id_rsa files. To copy our public key in the list of allowed connections we will make usage of the "ssh-copy-id" command to copy to Marconi
ssh-copy-id username@login.marconi.cineca.it
Now, if we establish an SSH connection, the prompt will not ask for any password and will give us a terminal inside Marconi.
ssh username@login.marconi.cineca.it
5. Install uDocker on Marconi
For this step follow the instructions the will be found on the uDocker documentation.
5.1. Known issues
When setting up a Docker image locally be sure that there is enough quota for your user. Otherwise it may crash or show untar related problems as the following when running the udocker load command.
Error: failed to extract container:
Error: loading failed
6. SCP Docker image from Gateway to Marconi and create container
The Docker image is avaiable at Gateway and you can use it on any machine
ls ~g2tomz/public/imas-installer*
To copy the image from Gateway to Marconi we run scp command
scp ~g2tomz/public/imas-installer-20180921112143.tar.xz username@login.marconi.cineca.it:
Once it has been copied we log in Marconi and run the following commands to load the image and create the container
$HOME/.local/bin/udocker load -i imas-installer-20180921112143.tar.xz $HOME/.local/bin/udocker create --name=imas imas-installer:20180921112143
7. Test image on Marconi
Once the image has been loaded we can interact with it and get a bash inside the container. To interact with the image we can get a bash with the following command
$HOME/.local/bin/udocker run imas /bin/bash
The commands that we are going to run for our example case are the following (same as used in uDocker documentation)
module load imas kepler module load keplerdir imasdb test export USER=imas kepler -runwf -nogui -user imas /home/imas/simple-workflow.xml
Running these commands inside the terminal will make the workflow start running. This will mean that we will be running a Kepler workflow inside a PRACE machine which does not have the IMAS environment installed. But we will be running inside the Docker image. This is a sample of the output:
8. Configure and submit workflow, then check output on GW
To configure a job we have to edit the files copied on the
mkdir $HOME/.sumi cp sumi/conf/*.conf $HOME/.sumi
8.1. jobs.conf
The configuration file jobs.conf located at local directory $HOME/.sumi/ contains the configuration for the jobs to be run. The sample configuration file located at $SUMI_DIR/conf/jobs.conf has the following content.
[test] udocker = udocker.py arguments = cpus = 1 time = 1 threads_per_process = 1
8.2. servers.conf
The configuration file servers.conf located at local directory $HOME/.sumi/ contains the configuration for the servers where SUMI will connect The sample configuration file located at $SUMI_DIR/conf/servers.conf has the following content.
[machine] server = example.com user = username manager = slurm protocol = ssh upload_files = upload_to = download_files = download_to =
To configure the login node of y our cluster just specify the login node address, your user name and the name of the resource manager where the accepted are sge, slurm and pbs.
SUMI allows to upload and download files automatically. For this we can assume a directory "mywf" in our remote Marconi directory and another one in our local Gateway account, as well as a mywfresults folder on Gateway. This will
[marconi] server = login.marconi.cineca.it user = my_username manager = slurm protocol = ssh upload_files = /afs/eufus.eu/g2itmdev/user/my_username/mywf/* upload_to = /marconi/home/userexternal/agutierr/mywf/ download_files = /marconi/home/userexternal/agutierr/mywf/test* download_to = /afs/eufus.eu/g2itmdev/user/g2agutie/mywfresults/
Once the job has been configured we can run it using the following command
sumi -r -j test -m marconi
This will copy the files, run the workflow and retrieve the output results. Once we have them we can check whether the
idsdump 1 1 pf_active
And this will show the correct structre of the IDS generated.