diff options
Diffstat (limited to 'lib/spack')
34 files changed, 70 insertions, 40 deletions
diff --git a/lib/spack/docs/module_file_support.rst b/lib/spack/docs/module_file_support.rst index 0e79900958..72e28b653e 100644 --- a/lib/spack/docs/module_file_support.rst +++ b/lib/spack/docs/module_file_support.rst @@ -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 diff --git a/lib/spack/spack/modules/common.py b/lib/spack/spack/modules/common.py index 37a5566995..884522b7c2 100644 --- a/lib/spack/spack/modules/common.py +++ b/lib/spack/spack/modules/common.py @@ -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 diff --git a/lib/spack/spack/test/data/modules/lmod/alter_environment.yaml b/lib/spack/spack/test/data/modules/lmod/alter_environment.yaml index 314dd1ddf5..5d72dd032d 100644 --- a/lib/spack/spack/test/data/modules/lmod/alter_environment.yaml +++ b/lib/spack/spack/test/data/modules/lmod/alter_environment.yaml @@ -8,6 +8,7 @@ lmod: - mpi all: + autoload: none filter: environment_blacklist: - CMAKE_PREFIX_PATH diff --git a/lib/spack/spack/test/data/modules/lmod/autoload_all.yaml b/lib/spack/spack/test/data/modules/lmod/autoload_all.yaml index ae08639a9f..a7dc8c7734 100644 --- a/lib/spack/spack/test/data/modules/lmod/autoload_all.yaml +++ b/lib/spack/spack/test/data/modules/lmod/autoload_all.yaml @@ -8,4 +8,4 @@ lmod: verbose: true all: - autoload: 'all' + autoload: all diff --git a/lib/spack/spack/test/data/modules/lmod/autoload_direct.yaml b/lib/spack/spack/test/data/modules/lmod/autoload_direct.yaml index 2c68672f84..1c74349c4d 100644 --- a/lib/spack/spack/test/data/modules/lmod/autoload_direct.yaml +++ b/lib/spack/spack/test/data/modules/lmod/autoload_direct.yaml @@ -7,4 +7,4 @@ lmod: - mpi all: - autoload: 'direct' + autoload: direct diff --git a/lib/spack/spack/test/data/modules/lmod/blacklist.yaml b/lib/spack/spack/test/data/modules/lmod/blacklist.yaml index e1813910aa..f94d6d8ec2 100644 --- a/lib/spack/spack/test/data/modules/lmod/blacklist.yaml +++ b/lib/spack/spack/test/data/modules/lmod/blacklist.yaml @@ -9,4 +9,4 @@ lmod: - callpath all: - autoload: 'direct' + autoload: direct diff --git a/lib/spack/spack/test/data/modules/lmod/complex_hierarchy.yaml b/lib/spack/spack/test/data/modules/lmod/complex_hierarchy.yaml index 5cad95c7fa..cb39ecfa92 100644 --- a/lib/spack/spack/test/data/modules/lmod/complex_hierarchy.yaml +++ b/lib/spack/spack/test/data/modules/lmod/complex_hierarchy.yaml @@ -17,4 +17,4 @@ lmod: verbose: false all: - autoload: 'all' + autoload: all diff --git a/lib/spack/spack/test/data/modules/lmod/core_compilers_empty.yaml b/lib/spack/spack/test/data/modules/lmod/core_compilers_empty.yaml index 5cfc3356bb..0ec4059994 100644 --- a/lib/spack/spack/test/data/modules/lmod/core_compilers_empty.yaml +++ b/lib/spack/spack/test/data/modules/lmod/core_compilers_empty.yaml @@ -1,6 +1,8 @@ enable: - lmod lmod: + all: + autoload: none core_compilers: [] hierarchy: - mpi diff --git a/lib/spack/spack/test/data/modules/lmod/missing_core_compilers.yaml b/lib/spack/spack/test/data/modules/lmod/missing_core_compilers.yaml index f5fe65651c..74a6092cdc 100644 --- a/lib/spack/spack/test/data/modules/lmod/missing_core_compilers.yaml +++ b/lib/spack/spack/test/data/modules/lmod/missing_core_compilers.yaml @@ -1,5 +1,7 @@ enable: - lmod lmod: + all: + autoload: none hierarchy: - mpi diff --git a/lib/spack/spack/test/data/modules/lmod/module_path_separator.yaml b/lib/spack/spack/test/data/modules/lmod/module_path_separator.yaml index 208554968f..8f70086986 100644 --- a/lib/spack/spack/test/data/modules/lmod/module_path_separator.yaml +++ b/lib/spack/spack/test/data/modules/lmod/module_path_separator.yaml @@ -1,5 +1,7 @@ enable: - lmod lmod: + all: + autoload: none core_compilers: - 'clang@3.3' diff --git a/lib/spack/spack/test/data/modules/lmod/no_arch.yaml b/lib/spack/spack/test/data/modules/lmod/no_arch.yaml index 1f10bcb792..6fdc7ab946 100644 --- a/lib/spack/spack/test/data/modules/lmod/no_arch.yaml +++ b/lib/spack/spack/test/data/modules/lmod/no_arch.yaml @@ -2,5 +2,7 @@ enable: - lmod arch_folder: false lmod: + all: + autoload: none core_compilers: - 'clang@3.3'
\ No newline at end of file diff --git a/lib/spack/spack/test/data/modules/lmod/no_hash.yaml b/lib/spack/spack/test/data/modules/lmod/no_hash.yaml index 726ba4d264..6c8b3cf9b6 100644 --- a/lib/spack/spack/test/data/modules/lmod/no_hash.yaml +++ b/lib/spack/spack/test/data/modules/lmod/no_hash.yaml @@ -1,6 +1,8 @@ enable: - lmod lmod: + all: + autoload: none hash_length: 0 core_compilers: diff --git a/lib/spack/spack/test/data/modules/lmod/non_virtual_in_hierarchy.yaml b/lib/spack/spack/test/data/modules/lmod/non_virtual_in_hierarchy.yaml index d6c74132d4..bf9df440d0 100644 --- a/lib/spack/spack/test/data/modules/lmod/non_virtual_in_hierarchy.yaml +++ b/lib/spack/spack/test/data/modules/lmod/non_virtual_in_hierarchy.yaml @@ -8,4 +8,4 @@ lmod: - openblas all: - autoload: 'direct' + autoload: direct diff --git a/lib/spack/spack/test/data/modules/lmod/override_template.yaml b/lib/spack/spack/test/data/modules/lmod/override_template.yaml index 979309a725..9f82622ed5 100644 --- a/lib/spack/spack/test/data/modules/lmod/override_template.yaml +++ b/lib/spack/spack/test/data/modules/lmod/override_template.yaml @@ -8,3 +8,4 @@ lmod: all: template: 'override_from_modules.txt' + autoload: none diff --git a/lib/spack/spack/test/data/modules/lmod/projections.yaml b/lib/spack/spack/test/data/modules/lmod/projections.yaml index 1efd93bc89..6b1fadbb67 100644 --- a/lib/spack/spack/test/data/modules/lmod/projections.yaml +++ b/lib/spack/spack/test/data/modules/lmod/projections.yaml @@ -1,6 +1,8 @@ enable: - lmod lmod: + all: + autoload: none projections: all: '{name}/v{version}' mpileaks: '{name}-mpiprojection' diff --git a/lib/spack/spack/test/data/modules/lmod/with_view.yaml b/lib/spack/spack/test/data/modules/lmod/with_view.yaml index 28220fe445..0947b67e7d 100644 --- a/lib/spack/spack/test/data/modules/lmod/with_view.yaml +++ b/lib/spack/spack/test/data/modules/lmod/with_view.yaml @@ -2,5 +2,7 @@ enable: - lmod use_view: default lmod: + all: + autoload: none core_compilers: - 'clang@3.3' diff --git a/lib/spack/spack/test/data/modules/tcl/alter_environment.yaml b/lib/spack/spack/test/data/modules/tcl/alter_environment.yaml index 74d9724695..b9082c9529 100644 --- a/lib/spack/spack/test/data/modules/tcl/alter_environment.yaml +++ b/lib/spack/spack/test/data/modules/tcl/alter_environment.yaml @@ -2,6 +2,7 @@ enable: - tcl tcl: all: + autoload: none filter: environment_blacklist: - CMAKE_PREFIX_PATH diff --git a/lib/spack/spack/test/data/modules/tcl/autoload_all.yaml b/lib/spack/spack/test/data/modules/tcl/autoload_all.yaml index 6b6a9b0736..f24c7d6dbc 100644 --- a/lib/spack/spack/test/data/modules/tcl/autoload_all.yaml +++ b/lib/spack/spack/test/data/modules/tcl/autoload_all.yaml @@ -3,4 +3,4 @@ enable: tcl: verbose: true all: - autoload: 'all' + autoload: all diff --git a/lib/spack/spack/test/data/modules/tcl/autoload_direct.yaml b/lib/spack/spack/test/data/modules/tcl/autoload_direct.yaml index 3cdf3b525b..2d3cdbf0d5 100644 --- a/lib/spack/spack/test/data/modules/tcl/autoload_direct.yaml +++ b/lib/spack/spack/test/data/modules/tcl/autoload_direct.yaml @@ -2,4 +2,4 @@ enable: - tcl tcl: all: - autoload: 'direct' + autoload: direct diff --git a/lib/spack/spack/test/data/modules/tcl/autoload_with_constraints.yaml b/lib/spack/spack/test/data/modules/tcl/autoload_with_constraints.yaml index 52796cad5b..98277b98fa 100644 --- a/lib/spack/spack/test/data/modules/tcl/autoload_with_constraints.yaml +++ b/lib/spack/spack/test/data/modules/tcl/autoload_with_constraints.yaml @@ -1,8 +1,9 @@ enable: - tcl tcl: + all: + autoload: none ^mpich2: - autoload: 'direct' - + autoload: direct ^python: - autoload: 'direct' + autoload: direct diff --git a/lib/spack/spack/test/data/modules/tcl/blacklist.yaml b/lib/spack/spack/test/data/modules/tcl/blacklist.yaml index ab2502f83a..8e691526bd 100644 --- a/lib/spack/spack/test/data/modules/tcl/blacklist.yaml +++ b/lib/spack/spack/test/data/modules/tcl/blacklist.yaml @@ -7,4 +7,4 @@ tcl: - callpath - mpi all: - autoload: 'direct' + autoload: direct diff --git a/lib/spack/spack/test/data/modules/tcl/blacklist_implicits.yaml b/lib/spack/spack/test/data/modules/tcl/blacklist_implicits.yaml index 4d5fbfb04a..a76a6bfabb 100644 --- a/lib/spack/spack/test/data/modules/tcl/blacklist_implicits.yaml +++ b/lib/spack/spack/test/data/modules/tcl/blacklist_implicits.yaml @@ -3,4 +3,4 @@ enable: tcl: blacklist_implicits: true all: - autoload: 'direct' + autoload: direct diff --git a/lib/spack/spack/test/data/modules/tcl/conflicts.yaml b/lib/spack/spack/test/data/modules/tcl/conflicts.yaml index 0183753e55..c5648eb45b 100644 --- a/lib/spack/spack/test/data/modules/tcl/conflicts.yaml +++ b/lib/spack/spack/test/data/modules/tcl/conflicts.yaml @@ -4,6 +4,7 @@ tcl: projections: all: '{name}/{version}-{compiler.name}' all: + autoload: none conflict: - '{name}' - 'intel/14.0.1' diff --git a/lib/spack/spack/test/data/modules/tcl/invalid_naming_scheme.yaml b/lib/spack/spack/test/data/modules/tcl/invalid_naming_scheme.yaml index 36b58670da..95c0abf2e8 100644 --- a/lib/spack/spack/test/data/modules/tcl/invalid_naming_scheme.yaml +++ b/lib/spack/spack/test/data/modules/tcl/invalid_naming_scheme.yaml @@ -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}' diff --git a/lib/spack/spack/test/data/modules/tcl/invalid_token_in_env_var_name.yaml b/lib/spack/spack/test/data/modules/tcl/invalid_token_in_env_var_name.yaml index 6012a2d3b0..b03f966c7c 100644 --- a/lib/spack/spack/test/data/modules/tcl/invalid_token_in_env_var_name.yaml +++ b/lib/spack/spack/test/data/modules/tcl/invalid_token_in_env_var_name.yaml @@ -2,6 +2,7 @@ enable: - tcl tcl: all: + autoload: none filter: environment_blacklist: - CMAKE_PREFIX_PATH diff --git a/lib/spack/spack/test/data/modules/tcl/naming_scheme.yaml b/lib/spack/spack/test/data/modules/tcl/naming_scheme.yaml index cc4cf8f782..1f54acb04f 100644 --- a/lib/spack/spack/test/data/modules/tcl/naming_scheme.yaml +++ b/lib/spack/spack/test/data/modules/tcl/naming_scheme.yaml @@ -1,4 +1,6 @@ enable: - tcl tcl: + all: + autoload: none naming_scheme: '{name}/{version}-{compiler.name}' diff --git a/lib/spack/spack/test/data/modules/tcl/no_arch.yaml b/lib/spack/spack/test/data/modules/tcl/no_arch.yaml index f997251654..10074c9578 100644 --- a/lib/spack/spack/test/data/modules/tcl/no_arch.yaml +++ b/lib/spack/spack/test/data/modules/tcl/no_arch.yaml @@ -2,5 +2,7 @@ enable: - tcl arch_folder: false tcl: + all: + autoload: none projections: all: ''
\ No newline at end of file diff --git a/lib/spack/spack/test/data/modules/tcl/override_config.yaml b/lib/spack/spack/test/data/modules/tcl/override_config.yaml index 4d3aaea7ae..337b12698c 100644 --- a/lib/spack/spack/test/data/modules/tcl/override_config.yaml +++ b/lib/spack/spack/test/data/modules/tcl/override_config.yaml @@ -2,6 +2,7 @@ enable: - tcl tcl: all: + autoload: none suffixes: '^mpich': mpich mpileaks: diff --git a/lib/spack/spack/test/data/modules/tcl/override_template.yaml b/lib/spack/spack/test/data/modules/tcl/override_template.yaml index a12e7ffd10..9aaba51809 100644 --- a/lib/spack/spack/test/data/modules/tcl/override_template.yaml +++ b/lib/spack/spack/test/data/modules/tcl/override_template.yaml @@ -2,4 +2,5 @@ enable: - tcl tcl: all: + autoload: none template: 'override_from_modules.txt' diff --git a/lib/spack/spack/test/data/modules/tcl/prerequisites_all.yaml b/lib/spack/spack/test/data/modules/tcl/prerequisites_all.yaml index 420c988062..eb6d097007 100644 --- a/lib/spack/spack/test/data/modules/tcl/prerequisites_all.yaml +++ b/lib/spack/spack/test/data/modules/tcl/prerequisites_all.yaml @@ -2,4 +2,5 @@ enable: - tcl tcl: all: - prerequisites: 'all' + autoload: none + prerequisites: all diff --git a/lib/spack/spack/test/data/modules/tcl/prerequisites_direct.yaml b/lib/spack/spack/test/data/modules/tcl/prerequisites_direct.yaml index 61e9fba8fc..2fbfa967f2 100644 --- a/lib/spack/spack/test/data/modules/tcl/prerequisites_direct.yaml +++ b/lib/spack/spack/test/data/modules/tcl/prerequisites_direct.yaml @@ -2,4 +2,5 @@ enable: - tcl tcl: all: - prerequisites: 'direct' + autoload: none + prerequisites: direct diff --git a/lib/spack/spack/test/data/modules/tcl/projections.yaml b/lib/spack/spack/test/data/modules/tcl/projections.yaml index 11dbd053f9..d6422de9be 100644 --- a/lib/spack/spack/test/data/modules/tcl/projections.yaml +++ b/lib/spack/spack/test/data/modules/tcl/projections.yaml @@ -1,6 +1,8 @@ enable: - tcl tcl: + all: + autoload: none projections: all: '{name}/{version}-{compiler.name}' mpileaks: '{name}-mpiprojection' diff --git a/lib/spack/spack/test/data/modules/tcl/suffix.yaml b/lib/spack/spack/test/data/modules/tcl/suffix.yaml index db2e5f9d64..9e16aaeda8 100644 --- a/lib/spack/spack/test/data/modules/tcl/suffix.yaml +++ b/lib/spack/spack/test/data/modules/tcl/suffix.yaml @@ -1,6 +1,8 @@ enable: - tcl tcl: + all: + autoload: none mpileaks: suffixes: '+opt': baz diff --git a/lib/spack/spack/test/data/modules/tcl/wrong_conflicts.yaml b/lib/spack/spack/test/data/modules/tcl/wrong_conflicts.yaml index 22377816c8..00116231a7 100644 --- a/lib/spack/spack/test/data/modules/tcl/wrong_conflicts.yaml +++ b/lib/spack/spack/test/data/modules/tcl/wrong_conflicts.yaml @@ -4,5 +4,6 @@ tcl: projections: all: '{name}/{version}-{compiler.name}' all: + autoload: none conflict: - '{name}/{compiler.name}' |