|
| 1 | +# Non-standard ways to use EESSI |
| 2 | + |
| 3 | +In case that an EESSI installation is not possible or desirable, there are a couple of "non-standard" ways to access EESSI. |
| 4 | + |
| 5 | +## Using cvmfsexec |
| 6 | + |
| 7 | +This option relies on the [cvmfsexec package](https://github.com/cvmfs/cvmfsexec) provided by CernVM-FS team. It will allow you to mount cvmfs as an unprivileged user, so no need to have a native cvmfs installation. |
| 8 | + |
| 9 | +### `cvmfsexec_eessi.sh` wrapper script |
| 10 | + |
| 11 | + |
| 12 | +This wrapper script, `cvmfsexec_eessi.sh`, can be used to run a command in a subshell in which the EESSI CernVM-FS repository (`software.eessi.io`) is mounted via cvmfsexec`. |
| 13 | + |
| 14 | +```bash |
| 15 | +#!/bin/bash |
| 16 | +if [ -d /cvmfs/software.eessi.io ]; then |
| 17 | + # run command directly, EESSI CernVM-FS repository is already mounted |
| 18 | + "$@" |
| 19 | +else |
| 20 | + # run command via in subshell where EESSI CernVM-FS repository is mounted, |
| 21 | + # via cvmfsexec which is set up in a unique temporary directory |
| 22 | + orig_workdir=$(pwd) |
| 23 | + mkdir -p /tmp/$USER |
| 24 | + tmpdir=$(mktemp -p /tmp/$USER -d) |
| 25 | + cd $tmpdir |
| 26 | + git clone https://github.com/cvmfs/cvmfsexec.git > $tmpdir/git_clone.out 2>&1 |
| 27 | + cd cvmfsexec |
| 28 | + ./makedist default > $tmpdir/cvmfsexec_makedist.out 2>&1 |
| 29 | + cd $orig_workdir |
| 30 | + $tmpdir/cvmfsexec/cvmfsexec software.eessi.io -- "$@" |
| 31 | + # cleanup |
| 32 | + rm -rf $tmpdir |
| 33 | +fi |
| 34 | + |
| 35 | +``` |
| 36 | + |
| 37 | +Do make sure that this script is executable: |
| 38 | + |
| 39 | +```bash |
| 40 | + chmod u+x ~/bin/cvmfsexec_eessi.sh |
| 41 | +``` |
| 42 | + |
| 43 | +A simple way to test this script is to use it to inspect the contents of the EESSI repository: |
| 44 | + |
| 45 | +```bash |
| 46 | + ~/bin/cvmfsexec_eessi.sh ls /cvmfs/software.eessi.io |
| 47 | +``` |
| 48 | + |
| 49 | +or to start an interactive shell in which the EESSI repository is mounted: |
| 50 | + |
| 51 | +```bash |
| 52 | + # Expected output from a machine without a cvmfs installation |
| 53 | + $ ls /cvmfs |
| 54 | + ls: cannot access '/cvmfs': No such file or directory |
| 55 | + |
| 56 | + # Starting interactive shell |
| 57 | + $ ~/bin/cvmfsexec_eessi.sh /bin/bash -l |
| 58 | + CernVM-FS: loading Fuse module... done |
| 59 | + CernVM-FS: mounted cvmfs on /tmp/hvela/tmp.iH6e993Adw/cvmfsexec/dist/cvmfs/cvmfs-config.cern.ch |
| 60 | + CernVM-FS: loading Fuse module... done |
| 61 | + CernVM-FS: mounted cvmfs on /tmp/hvela/tmp.iH6e993Adw/cvmfsexec/dist/cvmfs/software.eessi.io |
| 62 | + |
| 63 | + # Now it's mounted! |
| 64 | + $ ls /cvmfs/ |
| 65 | + cvmfs-config.cern.ch software.eessi.io |
| 66 | + |
| 67 | +``` |
| 68 | + |
| 69 | +Notice how now that EESSI is mounted, you will need to [set up the environment](https://www.eessi.io/docs/using_eessi/setting_up_environment/) in order to access the software itself. |
| 70 | + |
| 71 | +### `orted` wrapper script |
| 72 | + |
| 73 | +In order to get multi-node runs of software working without having EESSI available system-wide, we also had to create a small wrapper script for the `orted` command that is used by Open MPI to start processes on remote nodes. This is necessary because `mpirun` launches `orted`, which must be run in an environment in which the EESSI repository is mounted. If not, MPI startup will fail with an error like |
| 74 | + |
| 75 | +```bash |
| 76 | +"error: execve(): orted: No such file or directory". |
| 77 | +``` |
| 78 | + |
| 79 | +This wrapper script must be named `orted`, and must be located in a path that is listed in `$PATH`. |
| 80 | + |
| 81 | +We placed it in `~/bin/orted`, and you can add `export PATH=$HOME/bin:$PATH` to your `~/.bashrc` login script. |
| 82 | + |
| 83 | +Contents of ~/bin/orted: |
| 84 | + |
| 85 | +```bash |
| 86 | +#!/bin/bash |
| 87 | + |
| 88 | +# first remove path to this orted wrapper from $PATH, to avoid infinite loop |
| 89 | +orted_wrapper_dir=$(dirname $0) |
| 90 | +export PATH=$(echo $PATH | tr ':' '\n' | grep -v $orted_wrapper_dir | tr '\n' ':') |
| 91 | + |
| 92 | +~/bin/cvmfsexec_eessi.sh orted "$@" |
| 93 | +``` |
| 94 | + |
| 95 | +Again, do make sure that also this `orted` wrapper script is executable: |
| 96 | + |
| 97 | +```bash |
| 98 | +chmod u+x ~/bin/orted |
| 99 | +``` |
| 100 | + |
| 101 | +If not, you will likely run into an error that starts with: |
| 102 | + |
| 103 | + |
| 104 | +```bash |
| 105 | +An ORTE daemon has unexpectedly failed after launch ... |
| 106 | +``` |
| 107 | + |
| 108 | +### Slurm job script |
| 109 | + |
| 110 | +The `cvmfsexec_eessi.sh` can be used insided a Slurm job script inside your HPC system to initialize the EESSI environment in a subshell which the EESSI CernVM-FS repository is mounted. Thus, you will be able to load any module from EESSI you might need. |
| 111 | + |
| 112 | +Example job script: |
| 113 | + |
| 114 | +```bash |
| 115 | +#!/bin/bash |
| 116 | +#SBATCH --ntasks=4 |
| 117 | +#SBATCH --ntasks-per-node=2 |
| 118 | +#SBATCH --cpus-per-task=1 |
| 119 | +#SBATCH --time=5:0:0 |
| 120 | +#SBATCH --export=None |
| 121 | +#SBATCH --mem=30000M |
| 122 | +~/bin/cvmfsexec_eessi.sh << EOF |
| 123 | +source /cvmfs/software.eessi.io/versions/2023.06/init/bash |
| 124 | +module load TensorFlow/2.13.0-foss-2023a |
| 125 | +export SLURM_EXPORT_ENV=HOME,PATH,LD_LIBRARY_PATH,PYTHONPATH |
| 126 | +mpirun -np 4 python test.py |
| 127 | +EOF |
| 128 | + |
| 129 | +``` |
| 130 | +You can see the original blog post on how they used this solution in Deucalion [here](https://www.eessi.io/docs/blog/2024/06/28/espresso-portable-test-run-eurohpc/#running-espresso-on-deucalion-via-eessi-cvmfsexec). |
0 commit comments