-
Notifications
You must be signed in to change notification settings - Fork 1
/
04-env-modules.Rmd
53 lines (35 loc) · 2.02 KB
/
04-env-modules.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Libraries and Environment Modules {#libraries}
## Introduction
Environment modules are needed to make certain libraries (e.g. R) available across all nodes in the cluster.
Environment variables are installed and maintained via [Spack](spack.io).
```{block, type='rmdcaution'}
Please note that RStudio Workbench is decoupled from Slurm.
Everything which should be run on the nodes via Slurm requires to have the respective environment modules loaded in the Slurm template file whereas if you run something in RStudio Workbench, the libraries installed in the underlying Ubuntu 20.04 container will be used.
```
The following part only deals with the Spack configuration side as everything in the container should just work (with respect to R).
Available env modules can be queried in the terminal via `modules avail`.
To be able to load modules, put the following at the top of your `~/.bashrc` file:
```sh
export SPACK_ROOT=/opt/spack
. $SPACK_ROOT/share/spack/setup-env.sh
export MODULEPATH=/opt/spack/share/spack/modules/linux-centos7-x86_64
```
(The export of the `MODULEPATH` env var should actually be done by the spack setup script but failed in the past for some users. Adding it manually should do no harm.)
Here is a sample output of `module avail`:
```sh
------------------------- /opt/spack/share/spack/modules/linux-centos7-x86_64 --------------------------
byobu-5.127-gcc-9.2.0-by2qc2g (L) python-3.7.4-gcc-9.2.0-nbjbfzi (L)
ccache-3.3.4-gcc-9.2.0-v3xzqqh (L) r-3.5.2-gcc-9.2.0-oxo76vo
curl-7.63.0-gcc-9.2.0-cq4w37y (L) r-3.6.1-gcc-9.2.0-j25wr6z
fish-3.0.0-gcc-9.2.0-gdyab6r
```
## Loading modules
Modules can be loaded via `module load <module>`.
First, a C compiler need to be loaded as most other libraries depend on it.
```sh
module load gcc-9.2.0-gcc-4.8.5-wqdecm4
```
Next, load all libraries your analysis/R packages need, for example GDAL, PROJ, etc.
```{block, type='rmdcaution'}
You should load the modules both within `~/.bashrc` and within your SLURM template.
```