Update Reproducible SW environment with Spack authored by Stefano Corda's avatar Stefano Corda
...@@ -4,3 +4,100 @@ Clone and source spack (you can skip the clone step if spack is already install ...@@ -4,3 +4,100 @@ Clone and source spack (you can skip the clone step if spack is already install
git clone https://github.com/spack/spack.git -b v0.17.1 ~/spack git clone https://github.com/spack/spack.git -b v0.17.1 ~/spack
source ~/spack/share/spack/setup-env.sh source ~/spack/share/spack/setup-env.sh
``` ```
**NOTE**: it is crucial to fix the `spack` version to have the identical SW packages versions (different Spack versions will have different preferred versions of packages, .e.g Spack v0.17.1 will install cuda@11.5.0, while the current spack master will install cuda@11.6.1).
The above command will clone Spack in the directory you have created beforehand (you can clone it in a different directory).
# Generate a specific version of gcc:
Now, we will install a specific compiler (e.g. `gcc@9.4.0`) using the default compiler available in the system employed.
```
spack install -j 32 gcc@9.4.0
```
Then, we add the generated compiler to spack :
```
spack load gcc@9.4.0
spack compiler find
```
Finally, we generate the definitive (the one we will use), by installing it again using itself as a seed:
```
spack install -j 32 gcc@9.4.0 %gcc@9.4.0
```
# Create a Spack environment for WSClean (+IDG)
Clone the `schaap-spack` repo in the repos folder of spack:
```
git clone https://git.astron.nl/RD/schaap-spack.git ~/spack/var/spack/repos/schaap-spack
```
Create and activate a spack environment:
```
spack env create wsclean-940
spack env activate wsclean-940 -p
```
This results in a ~/spack/var/spack/environments/gcc-940/spack.yaml file. **Fill it as follows (fill the field inside the angular brackets with the appropriate content**):
```
spack:
specs: [wsclean@3.0.1%gcc@9.4.0 ^idg+report@0.8.1]
view: true
repos:
- ~spack/var/spack/repos/schaap-spack
concretization: together
compilers:
- compiler:
spec: gcc@9.4.0
paths:
cc: ~/spack/opt/spack/<os_arch>/gcc-9.4.0/gcc-9.4.0-<hash>/bin/gcc
cxx: ~/spack/opt/spack/<os_arch>/gcc-9.4.0/gcc-9.4.0-<hash>/bin/g++
f77: ~/spack/opt/spack/<os_arch>/gcc-9.4.0/gcc-9.4.0-<hash>/bin/gfortran
fc: ~/spack/opt/spack/l<os_arch>/gcc-9.4.0/gcc-9.4.0-<hash>/bin/gfortran
flags: {}
operating_system: debian11
target: x86_64
modules: []
environment: {}
extra_rpaths: []
modules:
enable:
- tcl
tcl:
hash_length: 0
naming_scheme: ${COMPILERNAME}/${COMPILERVER}/${PACKAGE}/${VERSION}
all:
environment:
set:
'{name}_ROOT': '{prefix}'
```
`<os_arch>` can be something similar: `linux-debian11-zen2` or `linux-rhel7-cascadelake` depending on the OS version and architecture.
`<hash>` it changes at each installation (it should be something like: `y3wfadv4z2odyqrlrljbd6tefvidx4gn`).
Now, install the environment (for certain make-based packages like `ciftsio` you should remove the `-j 32` because it will throw an error):
```
spack install -j 32
```
Source again spack to add the new modules to `MODULEPATH` :
```
source ~/spack/share/spack/setup-env.sh
```
You will be able to load wsclean with:
```
module load gcc/9.4.0/wsclean/3.0.1
```
Typically the other modules will not be available, use the following command to refresh them:
```
spack module tcl refresh --delete-tree -y
```
# Additional notes
If the modules are not available or the names still contain the hash. Try to use:
```
module --ignore_cache av
```
Sometimes, the default `module.yaml` file creates conflict. Remove it and update the modules:
```
rm ~/spack/etc/spack/defaults/modules.yaml
spack module tcl refresh --delete-tree -y
module --ignore_cache av
```
\ No newline at end of file