Switch lmod default all:autoload from none to direct (#28357)

* Switch lmod module all autoload default from none to direct

* Fix the docs
This commit is contained in:
Harmen Stoppels 2022-01-18 18:06:41 +01:00 committed by GitHub
parent 612430859e
commit e72f87ec64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 76 additions and 40 deletions

View file

@ -46,7 +46,13 @@ modules:
enable:
- tcl
tcl:
all:
autoload: none
# Default configurations if lmod is enabled
lmod:
all:
autoload: direct
hierarchy:
- mpi

View file

@ -615,44 +615,39 @@ modifications to either ``CPATH`` or ``LIBRARY_PATH``.
Autoload dependencies
"""""""""""""""""""""
In some cases it can be useful to have module files that automatically load
their dependencies. This may be the case for Python extensions, if not
activated using ``spack activate``:
Often it is required for a module to have its (transient) dependencies loaded as well.
One example where this is useful is when one package needs to use executables provided
by its dependency; when the dependency is autoloaded, the executable will be in the
PATH. Similarly for scripting languages such as Python, packages and their dependencies
have to be loaded together.
Autoloading is enabled by default for LMod, as it has great builtin support for through
the ``depends_on`` function. For Environment Modules it is disabled by default.
Autoloading can also be enabled conditionally:
.. code-block:: yaml
modules:
default:
tcl:
^python:
autoload: 'direct'
modules:
default:
tcl:
all:
autoload: none
^python:
autoload: direct
The configuration file above will produce module files that will
load their direct dependencies if the package installed depends on ``python``.
The allowed values for the ``autoload`` statement are either ``none``,
``direct`` or ``all``. The default is ``none``.
.. tip::
Building external software
Setting ``autoload`` to ``direct`` for all packages can be useful
when building software outside of a Spack installation that depends on
artifacts in that installation. E.g. (adjust ``lmod`` vs ``tcl``
as appropriate):
.. code-block:: yaml
modules:
default:
lmod:
all:
autoload: 'direct'
``direct`` or ``all``.
.. note::
TCL prerequisites
In the ``tcl`` section of the configuration file it is possible to use
the ``prerequisites`` directive that accepts the same values as
``autoload``. It will produce module files that have a ``prereq``
statement instead of automatically loading other modules.
statement, which can be used to autoload dependencies in some versions
of Environment Modules.
------------------------
Maintaining Module Files

View file

@ -191,7 +191,7 @@ def merge_config_rules(configuration, spec):
# Transform keywords for dependencies or prerequisites into a list of spec
# Which modulefiles we want to autoload
autoload_strategy = spec_configuration.get('autoload', 'none')
autoload_strategy = spec_configuration.get('autoload', 'direct')
spec_configuration['autoload'] = dependencies(spec, autoload_strategy)
# Which instead we want to mark as prerequisites

View file

@ -8,6 +8,7 @@ lmod:
- mpi
all:
autoload: none
filter:
environment_blacklist:
- CMAKE_PREFIX_PATH

View file

@ -8,4 +8,4 @@ lmod:
verbose: true
all:
autoload: 'all'
autoload: all

View file

@ -7,4 +7,4 @@ lmod:
- mpi
all:
autoload: 'direct'
autoload: direct

View file

@ -9,4 +9,4 @@ lmod:
- callpath
all:
autoload: 'direct'
autoload: direct

View file

@ -17,4 +17,4 @@ lmod:
verbose: false
all:
autoload: 'all'
autoload: all

View file

@ -1,6 +1,8 @@
enable:
- lmod
lmod:
all:
autoload: none
core_compilers: []
hierarchy:
- mpi

View file

@ -1,5 +1,7 @@
enable:
- lmod
lmod:
all:
autoload: none
hierarchy:
- mpi

View file

@ -1,5 +1,7 @@
enable:
- lmod
lmod:
all:
autoload: none
core_compilers:
- 'clang@3.3'

View file

@ -2,5 +2,7 @@ enable:
- lmod
arch_folder: false
lmod:
all:
autoload: none
core_compilers:
- 'clang@3.3'

View file

@ -1,6 +1,8 @@
enable:
- lmod
lmod:
all:
autoload: none
hash_length: 0
core_compilers:

View file

@ -8,4 +8,4 @@ lmod:
- openblas
all:
autoload: 'direct'
autoload: direct

View file

@ -8,3 +8,4 @@ lmod:
all:
template: 'override_from_modules.txt'
autoload: none

View file

@ -1,6 +1,8 @@
enable:
- lmod
lmod:
all:
autoload: none
projections:
all: '{name}/v{version}'
mpileaks: '{name}-mpiprojection'

View file

@ -2,5 +2,7 @@ enable:
- lmod
use_view: default
lmod:
all:
autoload: none
core_compilers:
- 'clang@3.3'

View file

@ -2,6 +2,7 @@ enable:
- tcl
tcl:
all:
autoload: none
filter:
environment_blacklist:
- CMAKE_PREFIX_PATH

View file

@ -3,4 +3,4 @@ enable:
tcl:
verbose: true
all:
autoload: 'all'
autoload: all

View file

@ -2,4 +2,4 @@ enable:
- tcl
tcl:
all:
autoload: 'direct'
autoload: direct

View file

@ -1,8 +1,9 @@
enable:
- tcl
tcl:
all:
autoload: none
^mpich2:
autoload: 'direct'
autoload: direct
^python:
autoload: 'direct'
autoload: direct

View file

@ -7,4 +7,4 @@ tcl:
- callpath
- mpi
all:
autoload: 'direct'
autoload: direct

View file

@ -3,4 +3,4 @@ enable:
tcl:
blacklist_implicits: true
all:
autoload: 'direct'
autoload: direct

View file

@ -4,6 +4,7 @@ tcl:
projections:
all: '{name}/{version}-{compiler.name}'
all:
autoload: none
conflict:
- '{name}'
- 'intel/14.0.1'

View file

@ -1,6 +1,8 @@
enable:
- tcl
tcl:
all:
autoload: none
# {variants} is not allowed in the naming scheme, see #2884
projections:
all: '{name}/{version}-{compiler.name}-{variants}'

View file

@ -2,6 +2,7 @@ enable:
- tcl
tcl:
all:
autoload: none
filter:
environment_blacklist:
- CMAKE_PREFIX_PATH

View file

@ -1,4 +1,6 @@
enable:
- tcl
tcl:
all:
autoload: none
naming_scheme: '{name}/{version}-{compiler.name}'

View file

@ -2,5 +2,7 @@ enable:
- tcl
arch_folder: false
tcl:
all:
autoload: none
projections:
all: ''

View file

@ -2,6 +2,7 @@ enable:
- tcl
tcl:
all:
autoload: none
suffixes:
'^mpich': mpich
mpileaks:

View file

@ -2,4 +2,5 @@ enable:
- tcl
tcl:
all:
autoload: none
template: 'override_from_modules.txt'

View file

@ -2,4 +2,5 @@ enable:
- tcl
tcl:
all:
prerequisites: 'all'
autoload: none
prerequisites: all

View file

@ -2,4 +2,5 @@ enable:
- tcl
tcl:
all:
prerequisites: 'direct'
autoload: none
prerequisites: direct

View file

@ -1,6 +1,8 @@
enable:
- tcl
tcl:
all:
autoload: none
projections:
all: '{name}/{version}-{compiler.name}'
mpileaks: '{name}-mpiprojection'

View file

@ -1,6 +1,8 @@
enable:
- tcl
tcl:
all:
autoload: none
mpileaks:
suffixes:
'+opt': baz

View file

@ -4,5 +4,6 @@ tcl:
projections:
all: '{name}/{version}-{compiler.name}'
all:
autoload: none
conflict:
- '{name}/{compiler.name}'