Skip to content

Commit d4d7165

Browse files
committed
Reworked the exercises for the basic usage section.
1 parent 1dc7c5d commit d4d7165

1 file changed

Lines changed: 129 additions & 150 deletions

File tree

docs/2022-CSC_and_LO/1_Intro/1_08_basic_usage.md

Lines changed: 129 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -976,80 +976,94 @@ Do yourself a favor: don't peek at the solution until you have made an attempt t
976976
977977
Please do not spoil solutions to others before they have been discussed by the tutorial organisers.
978978
979-
The exercises are based on the easyconfig files included with EasyBuild 4.3.3.
979+
The exercises are based on the easyconfig files available on LUMI during the tutorial of
980+
May 2022.
980981
981982
---
982983
983-
***Exercise U.0**** - Making installed software available*
984-
985-
Before working on the exercises for this part of the tutorial,
986-
make sure that the software that is already installed in the prepared environment is available.
987-
988-
We will assume that you have a small software stack installed using the `2020b` version of the `foss` toolchain.
984+
***Exercise U.1**** - Searching easyconfigs*
989985
990-
**Tip:** execute a "`module use`" command, and verify with "`module avail`" that a bunch of software modules
991-
are available for loading.
986+
See if EasyBuild on LUMI provides any easyconfig files for installing PLUMED in one of the 2.7 versions.
992987
993988
??? success "(click to show solution)"
989+
To check for available easyconfig files, we can use `eb --search` or `eb -S`:
994990
995-
Use the following command to make the modules for the software available that is pre-installed
996-
in the prepared environment:
997991
```shell
998-
module use /easybuild/modules/all
992+
eb -S PLUMED-2.7
993+
CFGS1=/appl/lumi/LUMI-EasyBuild-contrib/easybuild/easyconfigs
994+
* $CFGS1/g/GROMACS/GROMACS-2020.6-cpeCray-21.08-PLUMED-2.7.2-CPU.eb
995+
* $CFGS1/g/GROMACS/GROMACS-2020.6-cpeGNU-21.08-PLUMED-2.7.2-CPU.eb
996+
* $CFGS1/g/GROMACS/GROMACS-2021-cpeCray-21.08-PLUMED-2.7.2-CPU.eb
997+
* $CFGS1/g/GROMACS/GROMACS-2021-cpeGNU-21.08-PLUMED-2.7.2-CPU.eb
998+
* $CFGS1/g/GROMACS/GROMACS-2021.4-cpeAOCC-21.12-PLUMED-2.7.4-CPU.eb
999+
* $CFGS1/g/GROMACS/GROMACS-2021.4-cpeCray-21.12-PLUMED-2.7.4-CPU.eb
1000+
* $CFGS1/g/GROMACS/GROMACS-2021.4-cpeGNU-21.12-PLUMED-2.7.4-CPU.eb
1001+
* $CFGS1/p/PLUMED/PLUMED-2.7.2-cpeAMD-21.08.eb
1002+
* $CFGS1/p/PLUMED/PLUMED-2.7.2-cpeCray-21.08.eb
1003+
* $CFGS1/p/PLUMED/PLUMED-2.7.2-cpeGNU-21.08.eb
1004+
* $CFGS1/p/PLUMED/PLUMED-2.7.2-cpeGNU-21.12.eb
1005+
* $CFGS1/p/PLUMED/PLUMED-2.7.4-cpeAOCC-21.12.eb
1006+
* $CFGS1/p/PLUMED/PLUMED-2.7.4-cpeCray-21.12.eb
1007+
* $CFGS1/p/PLUMED/PLUMED-2.7.4-cpeGNU-21.12.eb
9991008
```
10001009
1001-
If software is installed in a different location than `/easybuild/` in your environment,
1002-
you should adjust the command accordingly.
1003-
1004-
1005-
---
1010+
We do get more output than we were hoping for as it also shows the GROMACS
1011+
versions using PLUMED. One way around this is to use regular expressions:
10061012
1007-
***Exercise U.1**** - Searching easyconfigs*
1008-
1009-
See if EasyBuild provides any easyconfig files for installing GROMACS version 2020/5.
1010-
1011-
??? success "(click to show solution)"
1012-
To check for available easyconfig files, we can use `eb --search` or `eb -S`:
10131013
```shell
1014-
$ eb -S gromacs-2020.5
1015-
== found valid index for /home/example/.local/easybuild/easyconfigs, so using it...
1016-
CFGS1=/home/example/.local/easybuild/easyconfigs/g/GROMACS
1017-
* $CFGS1/GROMACS-2020.5-fosscuda-2020a-Python-3.8.2.eb
1018-
* $CFGS1/GROMACS-2020.5_fix_threads_gpu_Gmxapitests.patch
1014+
$ eb -S ^PLUMED-2.7
1015+
CFGS1=/appl/lumi/LUMI-EasyBuild-contrib/easybuild/easyconfigs/p/PLUMED
1016+
* $CFGS1/PLUMED-2.7.2-cpeAMD-21.08.eb
1017+
* $CFGS1/PLUMED-2.7.2-cpeCray-21.08.eb
1018+
* $CFGS1/PLUMED-2.7.2-cpeGNU-21.08.eb
1019+
* $CFGS1/PLUMED-2.7.2-cpeGNU-21.12.eb
1020+
* $CFGS1/PLUMED-2.7.4-cpeAOCC-21.12.eb
1021+
* $CFGS1/PLUMED-2.7.4-cpeCray-21.12.eb
1022+
* $CFGS1/PLUMED-2.7.4-cpeGNU-21.12.eb
10191023
```
1020-
This actually shows one easyconfig file but also a patch file. We can also search specifically
1021-
for GROMACS 2020.5 in the `foss` and `fosscuda` toolchains using
1022-
```shell
1023-
$ eb -S gromacs-2020.5-foss
1024-
== found valid index for /home/example/.local/easybuild/easyconfigs, so using it...
1025-
CFGS1=/home/example/.local/easybuild/easyconfigs/g/GROMACS
1026-
* $CFGS1/GROMACS-2020.5-fosscuda-2020a-Python-3.8.2.eb
1024+
1025+
It is also possible to check for all 2.7 variants for the cpeGNU toolchain but
1026+
this requires a bit more care in composing the regular expression to ensure that
1027+
the shell does not try to expand the expression:
1028+
10271029
```
1028-
and now we find a single easyconfig file.
1030+
eb -S '^PLUMED-2.7.*-cpeGNU'
1031+
CFGS1=/appl/lumi/LUMI-EasyBuild-contrib/easybuild/easyconfigs/p/PLUMED
1032+
* $CFGS1/PLUMED-2.7.2-cpeGNU-21.08.eb
1033+
* $CFGS1/PLUMED-2.7.2-cpeGNU-21.12.eb
1034+
* $CFGS1/PLUMED-2.7.4-cpeGNU-21.12.eb
1035+
```
10291036
10301037
---
10311038
10321039
***Exercise U.2**** - Checking dependencies*
10331040
1034-
Check which dependencies are missing to install QuantumESPRESSO version 6.6 with the `2020b` version of the `foss` toolchain.
1041+
Check which dependencies are missing to install GROMACS 2021.4 with the
1042+
`cpeGNU` toolchain and with the PLUMED plugin in the
1043+
most recent version available in the LUMI recipes.
10351044
10361045
??? success "(click to show solution)"
1037-
First, we need to determine the name of the easyconfig file for QuantumESPRESSO version 6.6:
1046+
First, we need to determine the name of the easyconfig file for the required
1047+
version of GROMACS. Easyconfigs would start with `GROMACS-2021.4-cpeGNU` so
1048+
let's simply search for that:
1049+
10381050
```shell
1039-
$ eb -S 'QuantumESPRESSO-6.6.*foss-2020b'
1040-
== found valid index for /home/example/.local/easybuild/easyconfigs, so using it...
1041-
CFGS1=/home/example/.local/easybuild/easyconfigs/q/QuantumESPRESSO
1042-
* $CFGS1/QuantumESPRESSO-6.6-foss-2020b.eb
1051+
$ eb -S GROMACS-2021.4-cpeGNU
1052+
CFGS1=/appl/lumi/LUMI-EasyBuild-contrib/easybuild/easyconfigs/g/GROMACS
1053+
* $CFGS1/GROMACS-2021.4-cpeGNU-21.12-PLUMED-2.7.4-CPU.eb
1054+
* $CFGS1/GROMACS-2021.4-cpeGNU-21.12-PLUMED-2.8.0-CPU.eb
10431055
```
1044-
To determine which dependencies are missing to install this QuantumESPRESSO easyconfig file, we can use `--missing`:
1045-
```shell
1046-
$ eb QuantumESPRESSO-6.6-foss-2020b.eb --missing
10471056
1048-
3 out of 58 required modules missing:
1057+
We want the one for the most recent `PLUMED` toolchian, hence the second one.
1058+
1059+
To determine which dependencies are missing to install this GROMACS easyconfig file, we can use `--missing`:
1060+
```shell
1061+
$ eb GROMACS-2021.4-cpeGNU-21.12-PLUMED-2.8.0-CPU.eb --missing
10491062
1050-
* libxc/4.3.4-GCC-10.2.0 (libxc-4.3.4-GCC-10.2.0.eb)
1051-
* ELPA/2020.11.001-foss-2020b (ELPA-2020.11.001-foss-2020b.eb)
1052-
* QuantumESPRESSO/6.6-foss-2020b (QuantumESPRESSO-6.6-foss-2020b.eb)
1063+
2 out of 15 required modules missing:
1064+
1065+
* PLUMED/2.8.0-cpeGNU-21.12 (PLUMED-2.8.0-cpeGNU-21.12.eb)
1066+
* GROMACS/2021.4-cpeGNU-21.12-PLUMED-2.8.0-CPU (GROMACS-2021.4-cpeGNU-21.12-PLUMED-2.8.0-CPU.eb)
10531067
```
10541068
(some nonessential output removed).
10551069
@@ -1058,154 +1072,119 @@ Check which dependencies are missing to install QuantumESPRESSO version 6.6 with
10581072
***Exercise U.3**** - Performing a dry run*
10591073
10601074
Figure out which command EasyBuild would use to compile
1061-
the software provided by the `Bowtie2-2.4.2-GCC-9.3.0.eb` easyconfig file,
1062-
without actually installing `Bowtie2`.
1075+
the software provided by the `SAMtools-1.14-cpeGNU-21.12.eb` easyconfig file,
1076+
without actually installing `SAMtools`.
10631077
10641078
Also, which binaries will EasyBuild check for to sanity check the installation?
10651079
10661080
??? success "(click to show solution)"
1067-
To inspect the installation procedure, we can use `eb -x Bowtie2-2.4.2-GCC-9.3.0.eb`.
1081+
To inspect the installation procedure, we can use `SAMtools-1.14-cpeGNU-21.12.eb`.
10681082
10691083
The output for the build step shows the actual compilation command that would be performed (`make ...`):
10701084
10711085
```shell
10721086
[build_step method]
1073-
>> running command:
1074-
[started at: 2021-03-08 20:15:08]
1075-
[working dir: /local_scratch/hkenneth/eb-1wodfohg/__ROOT__/local_scratch/hkenneth/Bowtie2/2.4.2/GCC-9.3.0/Bowtie2-2.4.2]
1076-
[output logged in /local_scratch/hkenneth/eb-1wodfohg/easybuild-run_cmd-haojzisn.log]
1077-
make -j 48 CC="gcc" CPP="g++" CXX="g++" RELEASE_FLAGS="-O2 -ftree-vectorize -march=native -fno-math-errno -fPIC -std=gnu++98"
1078-
(in /local_scratch/hkenneth/Bowtie2/2.4.2/GCC-9.3.0/Bowtie2-2.4.2)
1087+
running command "make -j 256 CC="cc" CXX="CC" CFLAGS="-O2 -ftree-vectorize -fno-math-errno -fPIC" CXXFLAGS="-O2 -ftree-vectorize -fno-math-errno -fPIC""
1088+
(in /XXXX/build/SAMtools/1.14/cpeGNU-21.12/SAMtools-1.14)
10791089
```
10801090
1081-
If the output you get is less detailed, you may not have set `export EASYBUILD_TRACE=1`.
1091+
(And if you also add `--trace` the output will even be a bit more detailed).
10821092
10831093
The output for the sanity check step shows which binaries are expected to be installed:
10841094
```
10851095
[sanity_check_step method]
10861096
Sanity check paths - file ['files']
1087-
* bin/bowtie2
1088-
* bin/bowtie2-align-l
1089-
* bin/bowtie2-align-s
1090-
* bin/bowtie2-build
1091-
* bin/bowtie2-build-l
1092-
* bin/bowtie2-build-s
1093-
* bin/bowtie2-inspect
1094-
* bin/bowtie2-inspect-l
1095-
* bin/bowtie2-inspect-s
1097+
* bin/ace2sam
1098+
* bin/blast2sam.pl
1099+
* bin/bowtie2sam.pl
1100+
* bin/export2sam.pl
1101+
* bin/interpolate_sam.pl
1102+
* bin/maq2sam-long
1103+
* bin/maq2sam-short
1104+
* bin/md5fa
1105+
* bin/md5sum-lite
1106+
* bin/novo2sam.pl
1107+
* bin/plot-bamstats
1108+
* bin/psl2sam.pl
1109+
* bin/r2plot.lua
1110+
* bin/sam2vcf.pl
1111+
* bin/samtools
1112+
* bin/samtools.pl
1113+
* bin/seq_cache_populate.pl
1114+
* bin/soap2sam.pl
1115+
* bin/vcfutils.lua
1116+
* bin/wgsim
1117+
* bin/wgsim_eval.pl
1118+
* bin/zoom2sam.pl
1119+
* include/bam/bam.h
1120+
* include/bam/bam2bcf.h
1121+
* include/bam/sample.h
10961122
```
10971123
10981124
---
10991125
11001126
***Exercise U.4**** - Installing software*
11011127
1102-
Install version 3.1.0 of the `h5py` Python package and all missing dependencies,
1103-
using the `foss/2020b` toolchain, into `/tmp/$USER/easybuild`,
1104-
while leveraging the already installed software available from `/easybuild`.
1128+
Install version 2.0.5 of CDO using the cpeGNU toolchain (21.12 version)
1129+
including all missing dependencies.
11051130
11061131
Enable trace output so you can see which parts of the installation take a while.
11071132
11081133
??? success "(click to show solution)"
11091134
First, determine the easyconfig file we can use for this:
11101135
```shell
1111-
$ eb -S 'h5py-3.1.0.*foss-2020b'
1112-
CFGS1=/home/example/.local/easybuild/easyconfigs/h/h5py
1113-
* $CFGS1/h5py-3.1.0-foss-2020b.eb
1114-
```
1115-
1116-
Make sure the pre-install software in `/easybuild/` is available:
1117-
```shell
1118-
module use /easybuild/modules/all
1136+
$ eb -S '^CDO.*cpeGNU-21.12'
1137+
CFGS1=/appl/lumi/LUMI-EasyBuild-contrib/easybuild/easyconfigs/c/CDO
1138+
* $CFGS1/CDO-2.0.5-cpeGNU-21.12.eb
11191139
```
11201140
1121-
Check which dependencies are missing to install this `h5py` easyconfig:
1141+
Check which dependencies are missing to install this CDO easyconfig:
11221142
```shell
1123-
$ eb h5py-3.1.0-foss-2020b.eb --missing
1143+
$ eb CDO-2.0.5-cpeGNU-21.12.eb
11241144
1125-
2 out of 63 required modules missing:
1145+
4 out of 32 required modules missing:
11261146
1127-
* pkgconfig/1.5.1-GCCcore-10.2.0-python (pkgconfig-1.5.1-GCCcore-10.2.0-python.eb)
1128-
* h5py/3.1.0-foss-2020b (h5py-3.1.0-foss-2020b.eb)
1147+
* json-c/0.16-cpeGNU-21.12 (json-c-0.16-cpeGNU-21.12.eb)
1148+
* ecCodes/2.25.0-cpeGNU-21.12 (ecCodes-2.25.0-cpeGNU-21.12.eb)
1149+
* CMOR/3.6.1-cpeGNU-21.12 (CMOR-3.6.1-cpeGNU-21.12.eb)
1150+
* CDO/2.0.5-cpeGNU-21.12 (CDO-2.0.5-cpeGNU-21.12.eb)
11291151
```
11301152
1131-
Install `h5py` by specifying the easyconfig file and enabling dependency resolution via `--robot`,
1132-
while indicating that we want to install the software into `/tmp/$USER/easybuild` using the `--installpath`
1133-
option. Also make sure that trace mode is enabled by defining the `$EASYBUILD_TRACE` environment variable.
1153+
Install CDO by specifying the easyconfig file and enabling dependency resolution via `--robot`,
1154+
Also make sure that trace mode is enabled by defining the `$EASYBUILD_TRACE` environment variable.
11341155
```shell
11351156
$ export EASYBUILD_TRACE=1
1136-
$ eb h5py-3.1.0-foss-2020b.eb --robot --installpath /tmp/$USER/easybuild
1157+
$ eb CDO-2.0.5-cpeGNU-21.12.eb --robot
1158+
...
1159+
== building and installing ecCodes/2.25.0-cpeGNU-21.12...
1160+
...
1161+
== building and installing json-c/0.16-cpeGNU-21.12...
11371162
...
1138-
== building and installing pkgconfig/1.5.1-GCCcore-10.2.0-python...
1163+
== building and installing CMOR/3.6.1-cpeGNU-21.12...
11391164
...
1140-
== building and installing h5py/3.1.0-foss-2020b...
1165+
== building and installing CDO/2.0.5-cpeGNU-21.12...
11411166
...
1167+
== configuring...
1168+
>> running command:
1169+
...
1170+
>> command completed: exit 0, ran in 00h01m52s
1171+
== ... (took 1 min 52 secs)
11421172
== building...
11431173
>> running command:
1144-
[started at: 2020-06-10 21:47:32]
1145-
[working dir: /tmp/example/h5py/3.1.0/foss-2020b/h5py-3.1.0]
1146-
[output logged in /tmp/eb-rjjkbqe1/easybuild-run_cmd-d_dkc4iz.log]
1147-
python setup.py configure --mpi --hdf5=$EBROOTHDF5 && /easybuild/software/Python/3.8.6-GCCcore-10.2.0/bin/python setup.py build
1148-
>> command completed: exit 0, ran in 00h01m27s
1174+
[started at: 2022-05-09 20:07:44]
1175+
[working dir: /run/user/10012026/easybuild/build/CDO/2.0.5/cpeGNU-21.12/cdo-2.0.5]
1176+
[output logged in /run/user/10012026/easybuild/tmp/eb-0ihsqw7j/easybuild-run_cmd-pnuot3pi.log]
1177+
make -j 256
1178+
>> command completed: exit 0, ran in 00h00m57s
11491179
...
1150-
== COMPLETED: Installation ended successfully (took 2 min 46 sec)
1180+
== COMPLETED: Installation ended successfully (took 3 mins 14 secs)
11511181
...
1152-
== Build succeeded for 2 out of 2
1182+
== Build succeeded for 4 out of 4
11531183
```
11541184
1155-
The trace output shows that most time is spent in the build command,
1156-
which runs both `python setup.py configure` and `python setup.py build`.
1157-
1158-
---
1159-
1160-
***Exercise U.5**** - Using installed software*
1161-
1162-
Using the `h5py` installation from the previous exercise to create an empty HDF5 file,
1163-
using the following Python statements:
1164-
1165-
```python
1166-
import h5py
1167-
f = h5py.File("empty.hdf5", "w")
1168-
f.close()
1169-
```
1170-
1171-
Check the resulting file using the `h5stat` command.
1172-
1173-
??? success "(click to show solution)"
1174-
First, we need to make the modules tool aware of the module files that were installed into `/tmp/$USER/easybuild`:
1175-
```shell
1176-
module use /tmp/$USER/easybuild/modules/all
1177-
```
1185+
The trace output shows that most time is spent in the configure phase (and this is also the
1186+
case for some of the dependencies).
11781187
1179-
Then we can check the `h5py` module is available, and load it:
1180-
```shell
1181-
$ module avail h5py
1182-
------------ /tmp/example/easybuild/modules/all ------------
1183-
h5py/3.1.0-foss-2020b
1184-
```
1185-
1186-
```shell
1187-
module load h5py/3.1.0-foss-2020b
1188-
```
1189-
1190-
The Python code snippet can be run directly on the command line using "`python -c '...'`", since it's tiny:
1191-
```shell
1192-
python -c 'import h5py; f = h5py.File("empty.hdf5", "w"); f.close()'
1193-
```
1194-
Of course you can also copy the Python code snippet in a file named `test_h5py.py`,
1195-
and then run it with `python test_h5py.py`.
1196-
1197-
Checking with the `h5stat` command shows that the resulting `empty.hdf5` is indeed a valid HDF5 file:
1198-
```shell
1199-
$ ls -l empty.hdf5
1200-
-rw-rw-r-- 1 example example 800 Jun 10 21:54 empty.hdf5
1201-
1202-
$ h5stat empty.hdf5
1203-
Filename: empty.hdf5
1204-
File information
1205-
# of unique groups: 1
1206-
# of unique datasets: 0
1207-
...
1208-
```
12091188
12101189
---
12111190

0 commit comments

Comments
 (0)