summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2019-09-26 22:51:16 +0200
committerTodd Gamblin <tgamblin@llnl.gov>2019-10-01 19:18:27 -0700
commit1b18ec90abadf6e476a5e5fe1c82d18849c1d18d (patch)
treec33be5ade5fd6d5874c311520a021743645f626c
parentd20e3517c20633534e0d358de1e400b5f8d8a4ec (diff)
downloadspack-1b18ec90abadf6e476a5e5fe1c82d18849c1d18d.tar.gz
spack-1b18ec90abadf6e476a5e5fe1c82d18849c1d18d.tar.bz2
spack-1b18ec90abadf6e476a5e5fe1c82d18849c1d18d.tar.xz
spack-1b18ec90abadf6e476a5e5fe1c82d18849c1d18d.zip
Add all compatible system types directory to module paths
fixes #12915 closes #12916 Since Spack has support for specific targets it might happen that software is built for targets that are not exactly the host because it was either an explicit user request or the compiler being used is too old to support the host. Modules for different targets are written into different directories and by default Spack was adding to MODULEPATH only the directory corresponding to the current host. This PR modifies this behavior to add all the directories that are **compatible** with the current host.
-rw-r--r--lib/spack/spack/architecture.py12
-rw-r--r--lib/spack/spack/main.py3
-rwxr-xr-xshare/spack/setup-env.csh5
-rwxr-xr-xshare/spack/setup-env.sh4
4 files changed, 21 insertions, 3 deletions
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py
index c67b63cba0..53cbc44ca5 100644
--- a/lib/spack/spack/architecture.py
+++ b/lib/spack/spack/architecture.py
@@ -493,3 +493,15 @@ def sys_type():
"""
arch = Arch(platform(), 'default_os', 'default_target')
return str(arch)
+
+
+@memoized
+def compatible_sys_types():
+ """Returns a list of all the systypes compatible with the current host."""
+ compatible_archs = []
+ current_host = cpu.host()
+ compatible_targets = [current_host] + current_host.ancestors
+ for target in compatible_targets:
+ arch = Arch(platform(), 'default_os', target)
+ compatible_archs.append(str(arch))
+ return compatible_archs
diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py
index a2220a9ba8..c3746b6b26 100644
--- a/lib/spack/spack/main.py
+++ b/lib/spack/spack/main.py
@@ -585,7 +585,8 @@ def print_setup_info(*info):
# print sys type
shell_set('_sp_sys_type', spack.architecture.sys_type())
-
+ shell_set('_sp_compatible_sys_types',
+ ':'.join(spack.architecture.compatible_sys_types()))
# print roots for all module systems
module_roots = spack.config.get('config:module_roots')
module_to_roots = {
diff --git a/share/spack/setup-env.csh b/share/spack/setup-env.csh
index f2b5b00006..ac5479196d 100755
--- a/share/spack/setup-env.csh
+++ b/share/spack/setup-env.csh
@@ -26,8 +26,11 @@ if ($?SPACK_ROOT) then
# Set up modules and dotkit search paths in the user environment
set tcl_roots = `echo $_sp_tcl_roots:q | sed 's/:/ /g'`
+ set compatible_sys_types = `echo $_sp_compatible_sys_types:q | sed 's/:/ /g'`
foreach tcl_root ($tcl_roots:q)
- _spack_pathadd MODULEPATH "$tcl_root/$_sp_sys_type"
+ foreach systype ($compatible_sys_types:q)
+ _spack_pathadd MODULEPATH "$tcl_root/$systype"
+ end
end
set dotkit_roots = `echo $_sp_dotkit_roots:q | sed 's/:/ /g'`
diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh
index ae6d00a47b..0fd5eb30f7 100755
--- a/share/spack/setup-env.sh
+++ b/share/spack/setup-env.sh
@@ -350,7 +350,9 @@ _sp_multi_pathadd() {
setopt sh_word_split
fi
for pth in $2; do
- _spack_pathadd "$1" "${pth}/${_sp_sys_type}"
+ for systype in ${_sp_compatible_sys_types}; do
+ _spack_pathadd "$1" "${pth}/${systype}"
+ done
done
}
_sp_multi_pathadd MODULEPATH "$_sp_tcl_roots"