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: enable:
- tcl - tcl
tcl:
all:
autoload: none
# Default configurations if lmod is enabled # Default configurations if lmod is enabled
lmod: lmod:
all:
autoload: direct
hierarchy: hierarchy:
- mpi - mpi

View file

@ -615,44 +615,39 @@ modifications to either ``CPATH`` or ``LIBRARY_PATH``.
Autoload dependencies Autoload dependencies
""""""""""""""""""""" """""""""""""""""""""
In some cases it can be useful to have module files that automatically load Often it is required for a module to have its (transient) dependencies loaded as well.
their dependencies. This may be the case for Python extensions, if not One example where this is useful is when one package needs to use executables provided
activated using ``spack activate``: 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 .. code-block:: yaml
modules: modules:
default: default:
tcl: tcl:
^python: all:
autoload: 'direct' autoload: none
^python:
autoload: direct
The configuration file above will produce module files that will The configuration file above will produce module files that will
load their direct dependencies if the package installed depends on ``python``. load their direct dependencies if the package installed depends on ``python``.
The allowed values for the ``autoload`` statement are either ``none``, The allowed values for the ``autoload`` statement are either ``none``,
``direct`` or ``all``. The default is ``none``. ``direct`` or ``all``.
.. 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'
.. note:: .. note::
TCL prerequisites TCL prerequisites
In the ``tcl`` section of the configuration file it is possible to use In the ``tcl`` section of the configuration file it is possible to use
the ``prerequisites`` directive that accepts the same values as the ``prerequisites`` directive that accepts the same values as
``autoload``. It will produce module files that have a ``prereq`` ``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 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 # Transform keywords for dependencies or prerequisites into a list of spec
# Which modulefiles we want to autoload # 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) spec_configuration['autoload'] = dependencies(spec, autoload_strategy)
# Which instead we want to mark as prerequisites # Which instead we want to mark as prerequisites

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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