Skip to content

Accessing an EESSI(like) repository

trz42 edited this page Feb 17, 2023 · 4 revisions

Using the eessi_container.sh script

Prerequisites

  • Linux machine
  • Singularity 3.7.x or newer
  • git
  • direct access to Internet

Get the script

git clone https://github.com/EESSI/software-layer.git
export PATH="${PATH}:${PWD}/software-layer" # possibly add it to your shell startup script

Simple run (--help)

eessi_container.sh --help

produces output

usage: $HOME/software-layer/eessi_container.sh [OPTIONS] [SCRIPT]
 OPTIONS:
  -a | --access {ro,rw} - ro (read-only), rw (read & write) [default: ro]
  -c | --container IMG  - image file or URL defining the container to use
                          [default: docker://ghcr.io/eessi/build-node:debian10]
  -h | --help           - display this usage information [default: false]
  -g | --storage DIR    - directory space on host machine (used for
                          temporary data) [default: 1. TMPDIR, 2. /tmp]
  -m | --mode MODE      - with MODE==shell (launch interactive shell) or
                          MODE==run (run a script) [default: shell]
  -r | --repository CFG - configuration file or identifier defining the
                          repository to use [default: EESSI-pilot]
  -u | --resume DIR/TGZ - resume a previous run from a directory or tarball,
                          where DIR points to a previously used tmp directory
                          (check for output 'Using DIR as tmp ...' of a previous
                          run) and TGZ is the path to a tarball which is
                          unpacked the tmp dir stored on the local storage space
                          (see option --storage above) [default: not set]
  -s | --save DIR/TGZ   - save contents of tmp directory to a tarball in
                          directory DIR or provided with the fixed full path TGZ
                          when a directory is provided, the format of the
                          tarball's name will be {REPO_ID}-{TIMESTAMP}.tgz
                          [default: not set]
  -v | --verbose        - display more information [default: false]


 If value for --mode is 'run', the SCRIPT provided is executed.

Simple run (get access to EESSI pilot, read-only mode)

eessi_container.sh

After a number of messages shows a prompt: Singularity> or Apptainer>. Source the EESSI pilot init script and wait until the EESSI prompt is shown.

Singularity> source /cvmfs/pilot.eessi-hpc.org/latest/init/bash
Found EESSI pilot repo @ /cvmfs/pilot.eessi-hpc.org/versions/2021.12!
archspec says x86_64/intel/skylake_avx512
Using x86_64/intel/skylake_avx512 as software subdirectory.
Using /cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/linux/x86_64/intel/skylake_avx512/modules/all as the directory to be added to MODULEPATH.
Found Lmod configuration file at /cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/linux/x86_64/intel/skylake_avx512/.lmod/lmodrc.lua
Initializing Lmod...
Prepending /cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/linux/x86_64/intel/skylake_avx512/modules/all to $MODULEPATH...
Environment set up to use EESSI pilot software stack, have fun!
[EESSI pilot 2021.12] $

Run module avail and load a module, say EasyBuild:

[EESSI pilot 2021.12] $ module avail
... lots of modules ...
[EESSI pilot 2021.12] $ module load EasyBuild
[EESSI pilot 2021.12] $ eb --version
This is EasyBuild 4.5.1 (framework: 4.5.1, easyblocks: 4.5.1) on host srl-login1.

Try to write to /cvmfs/pilot.eessi-hpc.org

[EESSI pilot 2021.12] $ touch /cvmfs/pilot.eessi-hpc.org/foo
touch: cannot touch '/cvmfs/pilot.eessi-hpc.org/foo': Function not implemented

Simple run (get access to EESSI pilot, read & write mode)

eessi_container.sh --access rw

After a number of messages shows a prompt: Singularity> or Apptainer>. Source the EESSI pilot init script and wait until the EESSI prompt is shown.

Singularity> source /cvmfs/pilot.eessi-hpc.org/latest/init/bash
Found EESSI pilot repo @ /cvmfs/pilot.eessi-hpc.org/versions/2021.12!
archspec says x86_64/intel/skylake_avx512
Using x86_64/intel/skylake_avx512 as software subdirectory.
Using /cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/linux/x86_64/intel/skylake_avx512/modules/all as the directory to be added to MODULEPATH.
Found Lmod configuration file at /cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/linux/x86_64/intel/skylake_avx512/.lmod/lmodrc.lua
Initializing Lmod...
Prepending /cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/linux/x86_64/intel/skylake_avx512/modules/all to $MODULEPATH...
Environment set up to use EESSI pilot software stack, have fun!
[EESSI pilot 2021.12] $

Try to write to /cvmfs/pilot.eessi-hpc.org

[EESSI pilot 2021.12] $ touch /cvmfs/pilot.eessi-hpc.org/foo
[EESSI pilot 2021.12] $ ls -ltr /cvmfs/pilot.eessi-hpc.org/
total 10
drwxr-xr-x 2 thomarob uib 4096 Jun 22  2021 2021.06
lrwxrwxrwx 1 thomarob uib   10 Jun 30  2021 host_injections -> /opt/eessi
drwxr-xr-x 3 thomarob uib 4096 Dec 10  2021 versions
lrwxrwxrwx 1 thomarob uib   16 May  4  2022 latest -> versions/2021.12
-rw-r--r-- 1 thomarob uib    0 Feb  1 23:11 foo

Configure it to use a specific CernVM-FS repository

To get access to a specific CernVM-FS repository a file repos.cfg and some config files for CernVM-FS are necessary.

The repository config file repos.cfg

Place the file repos.cfg in the same directory as eessi_container.sh. An example repos.cfg for the NESSI/2022.11 repository is shown below (replace FULL_PATH_TO_PR216 with the full path to the directory PR216, see step https://github.com/NorESSI/software-layer/wiki/Home/_edit#get-the-script)

[nessi.no-2022.11]
repo_name = pilot.nessi.no
repo_version = 2022.11
config_bundle = FULL_PATH_TO_SOFTWARE_LAYER/nessi.no-2022.11-cfg_files.tgz
config_map = { "nessi.no/pilot.nessi.no.pub":"/etc/cvmfs/keys/nessi.no/pilot.nessi.no.pub", "default.local":"/etc/cvmfs/default.local", "nessi.no.conf":"/etc/cvmfs/domain.d/nessi.no.conf"}
container = docker://ghcr.io/eessi/build-node:debian10

The config bundle (option config_bundle) contains the files that are mapped into the container to make the repository available. After storing the config bundle into the given directory, you get (read-only) access to the repository with the command

eessi_container.sh --repository nessi.no-2022.11

and read & write access with the command

eessi_container.sh --repository nessi.no-2022.11 --access rw

Source the init file

Singularity> source /cvmfs/pilot.nessi.no/latest/init/bash
Found EESSI pilot repo @ /cvmfs/pilot.nessi.no/versions/2022.11!
Using x86_64/intel/skylake_avx512 as software subdirectory.
Using /cvmfs/pilot.nessi.no/versions/2022.11/software/linux/x86_64/intel/skylake_avx512/modules/all as the directory to be added to MODULEPATH.
Found Lmod configuration file at /cvmfs/pilot.nessi.no/versions/2022.11/software/linux/x86_64/intel/skylake_avx512/.lmod/lmodrc.lua
Initializing Lmod...
Prepending /cvmfs/pilot.nessi.no/versions/2022.11/software/linux/x86_64/intel/skylake_avx512/modules/all to $MODULEPATH...
Environment set up to use EESSI pilot software stack, have fun!
[EESSI pilot 2022.11] $

Building for an EESSI stack

To set up the environment for building software for (or compatible with) EESSI you need to source configure_easybuild of the software-layer repo. This configures EasyBuild. Before you run configure_easybuild you need to define WORKDIR which is used for temporary data during build procedures. The following commands illustrate an example:

eessi_container.sh --repository nessi.no-2022.11 --access rw
...
Singularity> source /cvmfs/pilot.nessi.no/latest/init/bash
...
[EESSI pilot 2022.11] $ git clone https://github.com/EESSI/software-layer
...
[EESSI pilot 2022.11] $ cd software-layer
[EESSI pilot 2022.11] $ export WORKDIR=/tmp/workdir
[EESSI pilot 2022.11] $ mkdir -p ${WORKDIR}
[EESSI pilot 2022.11] $ source configure_easybuild
[EESSI pilot 2022.11] $ module load EasyBuild
[EESSI pilot 2022.11] $ eb --show-config