Skip to content

Commit c097d16

Browse files
authored
Add skylab-1.0.0-public template to avoid license issues, complete documentation on chaining spack environments (#233)
* Add instructions for building openmpi@4.1.3 with gcc@10.1.0 on Discover * Add configs/templates/skylab-1.0.0-public/spack.yaml * Complete documentation for spack-stack-1.0.0 release * [skip ci] Update version numbers of solo, r2d2, ewok * [skip-ci] Update .gitmodules and submodule pointer for spack
1 parent b929046 commit c097d16

10 files changed

Lines changed: 219 additions & 97 deletions

File tree

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#url = https://github.com/spack/spack
44
#branch = develop
55
url = https://github.com/NOAA-EMC/spack
6-
branch = release/jcsda_emc_release_v1
6+
branch = spack-stack-1.0.0
77
[submodule "doc/CMakeModules"]
88
path = doc/CMakeModules
99
url = https://github.com/noaa-emc/cmakemodules
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
spack:
2+
concretizer:
3+
unify: when_possible
4+
5+
view: false
6+
7+
#packages:
8+
# fiat:
9+
# version: [1.0.0]
10+
# ectrans:
11+
# version: [1.0.0]
12+
13+
include: []
14+
15+
specs:
16+
17+
# Virtual environment packages
18+
- base-env@1.0.0
19+
- jedi-base-env@1.0.0 ~fftw
20+
- jedi-ewok-env@1.0.0
21+
- jedi-fv3-env@1.0.0
22+
- jedi-mpas-env@1.0.0
23+
- jedi-ufs-env@1.0.0
24+
#- jedi-um-env@1.0.0
25+
#- soca-env@1.0.0
26+
- ufs-weather-model-env@1.0.0
27+
28+
# Individual packages
29+
- bacio@2.4.1
30+
- bison@3.8.2
31+
- bufr@11.7.0
32+
- crtm@2.3.0
33+
- ecbuild@3.6.5
34+
- eccodes@2.25.0
35+
- ecflow@5
36+
- eckit@1.19.0
37+
- ecmwf-atlas@0.29.0 ~trans ~fftw
38+
# DH* fake version number
39+
#- ectrans@1.0.0
40+
- eigen@3.4.0
41+
- esmf@8.3.0b09
42+
# DH* fake version number
43+
- ewok@0.0.1
44+
- fckit@0.9.5
45+
# DH* fake version number
46+
#- fiat@1.0.0
47+
- flex@2.6.4
48+
- fms@2022.01
49+
# DH* fake version number
50+
- fms@release-jcsda
51+
- g2@3.4.5
52+
- g2tmpl@1.10.0
53+
#- gdal@3.4.3
54+
#- geos@3.9.1
55+
- gftl-shared@1.5.0
56+
- hdf5@1.12.1
57+
- hdf@4.2.15
58+
- ip@3.3.3
59+
- jasper@2.0.32
60+
- jedi-cmake@1.3.0
61+
- libpng@1.6.37
62+
- mapl@2.12.3
63+
- nccmp@1.9.0.1
64+
- netcdf-c@4.8.1
65+
- netcdf-cxx4@4.3.1
66+
- netcdf-fortran@4.5.4
67+
- nlohmann-json-schema-validator@2.1.0
68+
- nlohmann-json@3.10.5
69+
- parallel-netcdf@1.12.2
70+
- parallelio@2.5.4
71+
- py-numpy@1.22.3
72+
- py-pandas@1.4.0
73+
- py-scipy@1.8.0
74+
- py-shapely@1.8.0
75+
# DH* fake version number
76+
- r2d2@0.0.1
77+
# DH* fake version number
78+
#- shumlib@macos_clang_linux_intel_port
79+
- solo@1.0.0
80+
- sp@2.3.3
81+
- udunits@2.2.28
82+
- w3nco@2.4.1
83+
- yafyaml@0.5.1
84+
- zlib@1.2.12

configs/templates/skylab-1.0.0/spack.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ spack:
4040
- eigen@3.4.0
4141
- esmf@8.3.0b09
4242
# DH* fake version number
43-
- ewok@1.0.0
43+
- ewok@0.0.1
4444
- fckit@0.9.5
4545
# DH* fake version number
4646
- fiat@1.0.0
@@ -73,10 +73,9 @@ spack:
7373
- py-scipy@1.8.0
7474
- py-shapely@1.8.0
7575
# DH* fake version number
76-
- r2d2@1.0.0
76+
- r2d2@0.0.1
7777
# DH* fake version number
7878
- shumlib@macos_clang_linux_intel_port
79-
# DH* fake version number
8079
- solo@1.0.0
8180
- sp@2.3.3
8281
- udunits@2.2.28

doc/source/Environments.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Environments can be constructed in two ways in spack-stack:
1111

1212
- Configure the environment as shown in :numref:`Sections %s <Quickstart>` and :numref:`%s <Platforms>`.
1313

14-
- Add spack packages (also referred to as ``specs``) to the environment using ``spack add``. These packages can be virtual environments described in :numref:`Section %s <EnvironmentsVirtualEnvironments>` below, or individual packages, e.g. ``esmf`` or ``atlas``. Examples:
14+
- Add spack packages (also referred to as ``specs``) to the environment using ``spack add``. These packages can be virtual environments described in :numref:`Section %s <EnvironmentsVirtualPackages>` below, or individual packages, e.g. ``esmf`` or ``atlas``. Examples:
1515

1616
.. code-block:: console
1717

doc/source/MaintainersSection.rst

Lines changed: 71 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ On Gaea, ``qt`` needs to be installed as a one-off before spack can be used.
109109

110110
qt (qt@5)
111111
The default ``qt@5`` in ``/usr`` is incomplete and thus insufficient for building ``ecflow``. After loading/unloading the modules as shown below, refer to
112-
:numref:`Section %s <Prerequisites_Qt5>` to install ``qt@5.15.3`` in ``/lustre/f2/pdata/esrl/gsd/spack-stack/qt-5.15.3``.
112+
:numref:`Section %s <Prerequisites_Qt5>` to install ``qt@5.15.2`` in ``/lustre/f2/pdata/esrl/gsd/spack-stack/qt-5.15.2``.
113113

114114
.. code-block:: console
115115
@@ -127,7 +127,7 @@ miniconda
127127

128128
qt (qt@5)
129129
The default ``qt@5`` in ``/usr`` is incomplete and thus insufficient for building ``ecflow``. After loading/unloading the modules as shown below, refer to
130-
:numref:`Section %s <Prerequisites_Qt5>` to install ``qt@5.15.3`` in ``/scratch1/NCEPDEV/jcsda/jedipara/spack-stack/qt-5.15.3``.
130+
:numref:`Section %s <Prerequisites_Qt5>` to install ``qt@5.15.2`` in ``/scratch1/NCEPDEV/jcsda/jedipara/spack-stack/qt-5.15.2``.
131131

132132
.. code-block:: console
133133
@@ -153,17 +153,6 @@ TACC Stampede2
153153

154154
Several packages need to be installed as a one-off before spack can be used.
155155

156-
Intel oneAPI compilers
157-
The latest version of the Intel compiler on Stampede2 is 19.1.1, and the default modulefile created by the system administrators ties it to `gcc-9.1.0`. The way the module file has been written is incompatible with spack. We therefore recommend installing the latest Intel oneAPI compiler suite (Intel oneAPI Base and HPC Toolkits). The following instructions install Intel oneAPI 2022.2 in ``/work2/06146/tg854455/stampede2/spack-stack``.
158-
159-
.. code-block:: console
160-
161-
wget https://registrationcenter-download.intel.com/akdlm/irc_nas/18679/l_HPCKit_p_2022.2.0.191.sh
162-
wget https://registrationcenter-download.intel.com/akdlm/irc_nas/18673/l_BaseKit_p_2022.2.0.262.sh
163-
# Customize the installations to install in /work2/06146/tg854455/stampede2/spack-stack/intel-oneapi-2022.2
164-
sh l_BaseKit_p_2022.2.0.262.sh
165-
sh l_HPCKit_p_2022.2.0.191.sh
166-
167156
miniconda
168157
Follow the instructions in :numref:`Section %s <Prerequisites_Miniconda>` to create a basic ``miniconda`` installation and associated modulefile for working with spack. Don't forget to log off and back on to forget about the conda environment.
169158

@@ -180,7 +169,7 @@ git-lfs
180169
rpm2cpio git-lfs-1.2.1-1.el7.x86_64.rpm | cpio -idmv
181170
mv usr/* ../
182171
183-
Create modulefile ``/work2/06146/tg854455/stampede2/spack-stack/modulefiles/git-lfs/1.2.1`` from template ``doc/modulefile_templates/git-lfs`` and update ``GITLFS_PATH`` in this file.
172+
Create modulefile ``/work2/06146/tg854455/stampede2/spack-stack/modulefiles/git-lfs/1.2.1`` from template ``doc/modulefile_templates/git-lfs`` and update ``GITLFS_PATH`` in this file.
184173

185174
.. _MaintainersSection_S4:
186175

@@ -193,7 +182,7 @@ miniconda
193182

194183
qt (qt@5)
195184
The default ``qt@5`` in ``/usr`` is incomplete and thus insufficient for building ``ecflow``. After loading/unloading the modules as shown below, refer to
196-
:numref:`Section %s <Prerequisites_Qt5>` to install ``qt@5.15.3`` in ``/data/prod/jedi/spack-stack/qt-5.15.3``.
185+
:numref:`Section %s <Prerequisites_Qt5>` to install ``qt@5.15.2`` in ``/data/prod/jedi/spack-stack/qt-5.15.2``.
197186

198187
.. code-block:: console
199188
@@ -217,9 +206,60 @@ Using spack to test/add packages
217206

218207
The simplest case of adding new packages that are available in spack-stack is described in :numref:`Section %s <QuickstartExtendingEnvironments>`. As mentioned there, it is advised to take a backup of the spack environment (and install directories if outside the spack environment directory tree). It is also possible to chain spack installations, which means creating a test environment that uses installed packages and modulefiles from another (e.g. authoritative) spack environment and build the packages to be tested in isolation.
219208

220-
**WORK IN PROGRESS**
209+
Chaining spack-stack installations
210+
----------------------------------
211+
212+
Chaining spack-stack installations is a powerful way to test adding new packages without affecting the existing packages. The idea is to define one or more upstream spack installations that the environment can use as dependencies. One possible way to do this is:
213+
214+
1. Mirror the environment config of the upstream repository, i.e. copy the entire directory without the ``install`` and ``.spack_env`` directories and without `spack.lock`. For example:
215+
216+
.. code-block:: console
217+
218+
rsync -av --exclude='install' --exclude='.spack-env' --exclude='spack.lock' \
219+
envs/jedi-ufs/ \
220+
envs/jedi-ufs-chain-test/
221221
222-
More details and a few words of caution can be found in the `Spack documentation <https://spack.readthedocs.io/en/latest/chain.html?highlight=chaining%20spack%20installations>`_
222+
2. Edit `envs/jedi-ufs-chain-test/spack.yaml`` and add an upstream configuration entry directly under the ``spack:`` config so that the contents looks like:
223+
224+
.. code-block:: console
225+
226+
spack:
227+
upstreams:
228+
spack-instance-1:
229+
install_tree: /path/to/spack-stack-1.0.0/envs/jedi-ufs/install
230+
concretizer:
231+
unify: when_possible
232+
...
233+
234+
3. Activate the environment
235+
236+
4. Install the new packages, for example:
237+
238+
.. code-block:: console
239+
240+
spack install -v --reuse esmf@8.3.0b09+debug
241+
242+
5. Create modulefiles
243+
244+
.. code-block:: console
245+
246+
spack module [lmod|tcl] refresh
247+
248+
6. When using ``tcl`` module files, run the ``spack stack setup-meta-modules`` script. This is not needed when using ``lmod`` modulefiles, because the meta modules in ``/path/to/spack-stack-1.0.0/envs/jedi-ufs-chain-test/install/modulefiles/Core`` will be ignored entirely.
249+
250+
To use the chained spack environment, first load the usual modules from the upstream spack environment. Then add the full path to the newly created modules manually, ignoring the meta modules (``.../Core``), for example:
251+
252+
.. code-block:: console
253+
254+
module use /path/to/spack-stack-1.0.0/envs/jedi-ufs-chain-test/install/modulefiles/openmpi/4.1.3/apple-clang/13.1.6
255+
256+
7. Load the newly created modules. When using `tcl` module files, make sure that conflicting modules are unloaded (`lmod` takes care of this).
257+
258+
.. note::
259+
After activating the chained environment, ``spack find`` doesn't show the packages installed in upstream, unfortunately.
260+
261+
.. note::
262+
More details and a few words of caution can be found in the `Spack documentation <https://spack.readthedocs.io/en/latest/chain.html?highlight=chaining%20spack%20installations>`_. Those words of caution need to be taken seriously, especially those referring to not deleting modulefiles and dependencies in the upstream spack environment (if having permissions to do so)!
223263

224264
----------------------------------------
225265
Testing/adding packages outside of spack
@@ -233,6 +273,7 @@ Sometimes, users may want to build new versions of packages frequently without u
233273
Users can build multiple packages outside of spack and install them in a separate install tree, for example ``MY_INSTALL_TREE``. In order to find these packages, users must extend their environment as required for the system/the packages to be installed:
234274

235275
.. code-block:: console
276+
236277
export PATH="$MY_INSTALL_TREE/bin:$PATH"
237278
export CPATH="$MY_INSTALL_TREE/include:$PATH"
238279
export LD_LIBRARY_PATH="$MY_INSTALL_TREE/lib64:$MY_INSTALL_TREE/lib:$LD_LIBRARY_PATH"
@@ -241,5 +282,17 @@ Users can build multiple packages outside of spack and install them in a separat
241282
# Python packages, use correct lib/lib64 and correct python version
242283
export PYTHONPATH="$MY_INSTALL_TREE/lib/pythonX.Y/site-packages:$PYTHONPATH"
243284
244-
Python packages can be added using ``python setup.py install --prefix=...`` or ``python3 -m pip install --no-deps --prefix=...``. The ``--no-deps`` options is very important, because ``pip`` may otherwise attempt to install dependencies that already exist in spack-stack. These dependencies are not only duplicates, they may also be different versions and/or compiled with different compilers/libraries (because they are wheels).
285+
Python packages can be added in various ways:
286+
287+
1. Using ``python setup.py install --prefix=$MY_INSTALL_TREE ...`` or ``python3 -m pip install --no-deps --prefix=$MY_INSTALL_TREE ...``. The ``--no-deps`` options is very important, because ``pip`` may otherwise attempt to install dependencies that already exist in spack-stack. These dependencies are not only duplicates, they may also be different versions and/or compiled with different compilers/libraries (because they are wheels). This approach requires adding the appropriate subdirectories of ``$MY_INSTALL_TREE`` to the different search paths, as shown above.
288+
289+
2. Using Python virtual environments. Two important flags need to be passed to the command that creates the environment ``--system-site-packages`` and ``--without-pip``. After activating the environment, packages can be installed using `python3 -m pip` without having to specify ``--no-deps`` or ``--prefix``, and without having to manually modify ``PATH``, ``PYTHONPATH``, etc.
245290

291+
.. code-block:: console
292+
293+
python3 -m venv --system-site-packages --without-pip $MY_INSTALL_TREE
294+
source $MY_INSTALL_TREE/bin/activate
295+
python3 -m pip install ...
296+
297+
.. note::
298+
Users are equally strongly advised to not use ``conda`` or ``miniconda`` in combination with Python modules provided by spack-stack, as well as not installing packages other than ``poetry`` in the basic ``miniconda`` installation for spack-stack (if using such a setup).

doc/source/Overview.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ spack-stack is a collaborative effort between the NOAA Environmental Modeling Ce
77

88
`Spack <https://github.com/spack/spack>`_ is a community-supported, multi-platform, Python-based package manager originally developed by the Lawrence Livermore National Laboratory (LLNL; https://computing.llnl.gov/projects/spack-hpc-package-manager). It is provided as a submodule so that a stable version can be referenced. See the `Spack Documentation <https://spack.readthedocs.io/en/latest>`_ for more information.
99

10-
spack-stack is mainly a collection of Spack configuration files, but provides a Spack extension to simplify the installation process (see :numref:`Section %s <SpackStackExtension` for details):
10+
spack-stack is mainly a collection of Spack configuration files, but provides a Spack extension to simplify the installation process (see :numref:`Section %s <SpackStackExtension>` for details):
1111

1212
- ``spack stack create`` is provided to copy common, site-specific, and application-specific configuration files into a coherent Spack environment and to create container recipes
1313

0 commit comments

Comments
 (0)