Create stack-venv meta modules for environment views & generate fewer modules#1966
Conversation
…modules'; add unit-tests
…h*.sh, use better dependency load syntax for lua in spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py
…c/spack-stack/stack/meta_modules.py
| - neptune-env +debug +openmp | ||
| - neptune-env ~debug ~openmp | ||
| - neptune-env +debug ~openmp | ||
| - esmf +debug +openmp | ||
| - esmf ~debug ~openmp | ||
| - esmf +debug ~openmp | ||
| - ip ~openmp |
There was a problem hiding this comment.
A view can't have duplicates (see lines 24-27). If needed, we can add other views (debug-openmp, release-noopenmp, ...) later.
…eature/mod_exclude_neptune_env_view
|
@climbfuji So, does this mean when we do our instructions on how to load an env (like say geos-gcm-env?) when we do |
| if module_choice == "lmod": | ||
| return f"""load("{module}") | ||
| prereq("{module}")\n""" | ||
| return f"""if (mode() == "load" and not isloaded("{module}")) then |
There was a problem hiding this comment.
This logic matches the tcl environment module logic, and it prevents issues such as the unintentional unloading of the compiler and mpi module. That is, only unload compiler/mpi modules if they weren't loaded before the stack-venv module was loaded.
For now, what I am doing with this is:
We can take this further, and this might well be the way to go, and not load any of the modules but just The downside is that the user doesn't see which versions of which libraries are used. We could generate a script/reuse the existing script in I see this PR as a first step to greatly speed up loading the Python environments, especially on Cray and in workflows where these modules are loaded over and over again. |
Description
To avoid loading a huge number of modules every time, in particular every time a Python stack is loaded, this PR does the following:
stack-venv/<view-name>is created in themodules/Coredirectory of the environment (same directory as forstack-<compiler>/<version>). Thestack-venvmodule requires thestack-<compiler>and, if applicable,<stack-mpi>modules being loaded. While working on this, I discovered that the current syntax for specifying module requirements were incorrect forlua/lmod. I updated the syntax to match thetclenvironment modules syntax.configs/common/modules_*.yaml.Note 1. Spack generated an
activatescript in/path/to/view/bin/for every view. Unfortunately, this script isn't sufficient for using the view, because it doesn't setLD_LIBRARY_PATH. This causes problems, for example when trying to importeccodesin Python, because theecCodeslibrary (separate package) cannot be found. Further, the prompt modification for the environment is long and cryptic (contains part of the view hash). An alternative or addition to thestack-venv/<view-name>module is to create a separate directory with activation scripts that do the same as thestack-venvmodule. Those scripts could also manipulate the prompt, which is very difficult to do with modules across platforms and module types. Since activation scripts are not modules, that logic doesn't really fit into thesetup-meta-modulesextension. But making it its own extension will inevitably lead to code duplication. Thus, in the spirit of making smaller, incremental changes instead of a waterfall approach, I suggest to move ahead with thestack-venvmodule approach first and see how this pans out across teams and applications.Note 2. I tested this on HPCMP Blueback (Cray,
tclmodules) and NRL Atlantis (luamodules) with the NEPTUNE end-to-end system (NEPTUNE + cylc).Dependencies
None
Issues addressed
Loading too many modules can take a very long time, especially on Cray systems using
tclenvironment modules, and even lead to odd failures wheremodule lidisplays nothing because one of the environment variables that the module system uses exceeds the maximum length allowed for the string.Applications affected
NEPTUNE
Systems affected
None
Testing
Checklist
All dependency PRs/issues have been resolved and this PR can be merged.