summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2019-10-15 20:20:49 +0200
committerTodd Gamblin <tgamblin@llnl.gov>2019-10-15 11:20:49 -0700
commitd33b0ffc50248ee1c099875830838b41e2d4ad12 (patch)
tree6c4ab40d3ff2eeda01615a815b72728764ec2182
parent41e7e5693e86dba94ed4237a3962c311887aa5a8 (diff)
downloadspack-d33b0ffc50248ee1c099875830838b41e2d4ad12.tar.gz
spack-d33b0ffc50248ee1c099875830838b41e2d4ad12.tar.bz2
spack-d33b0ffc50248ee1c099875830838b41e2d4ad12.tar.xz
spack-d33b0ffc50248ee1c099875830838b41e2d4ad12.zip
lmod: module files are written in a root folder named by target family (#13121)
fixes #13005 This commit fixes an issue with the name of the root directory for module file hierarchies. Since #3206 the root folder was named after the microarchitecture used for the spec, which is too specific and not backward compatible for lmod hierarchies. Here we compute the root folder name using the target family instead of the target name itself and we add target information in the 'whatis' portion of the module file.
-rw-r--r--lib/spack/spack/modules/lmod.py6
-rw-r--r--lib/spack/spack/test/modules/lmod.py16
-rw-r--r--share/spack/templates/modules/modulefile.lua1
3 files changed, 22 insertions, 1 deletions
diff --git a/lib/spack/spack/modules/lmod.py b/lib/spack/spack/modules/lmod.py
index a381e08ca9..e45b97773b 100644
--- a/lib/spack/spack/modules/lmod.py
+++ b/lib/spack/spack/modules/lmod.py
@@ -198,7 +198,11 @@ class LmodFileLayout(BaseFileLayout):
@property
def arch_dirname(self):
"""Returns the root folder for THIS architecture"""
- arch_folder = str(self.spec.architecture)
+ arch_folder = '-'.join([
+ str(self.spec.platform),
+ str(self.spec.os),
+ str(self.spec.target.family)
+ ])
return os.path.join(
self.dirname(), # root for lmod module files
arch_folder, # architecture relative path
diff --git a/lib/spack/spack/test/modules/lmod.py b/lib/spack/spack/test/modules/lmod.py
index 7ee173d660..e480d22601 100644
--- a/lib/spack/spack/test/modules/lmod.py
+++ b/lib/spack/spack/test/modules/lmod.py
@@ -262,3 +262,19 @@ class TestLmod(object):
# Assert we have core compilers now
writer, _ = factory(mpileaks_spec_string)
assert writer.conf.core_compilers
+
+ @pytest.mark.parametrize('spec_str', [
+ 'mpileaks target=haswell',
+ 'mpileaks target=core2',
+ 'mpileaks target=x86_64',
+ ])
+ @pytest.mark.regression('13005')
+ def test_only_generic_microarchitectures_in_root(
+ self, spec_str, factory, module_configuration
+ ):
+ module_configuration('complex_hierarchy')
+ writer, spec = factory(spec_str)
+
+ assert str(spec.target.family) in writer.layout.arch_dirname
+ if spec.target.family != spec.target:
+ assert str(spec.target) not in writer.layout.arch_dirname
diff --git a/share/spack/templates/modules/modulefile.lua b/share/spack/templates/modules/modulefile.lua
index a8eae9bef1..2149c8bfaf 100644
--- a/share/spack/templates/modules/modulefile.lua
+++ b/share/spack/templates/modules/modulefile.lua
@@ -8,6 +8,7 @@
{% if short_description %}
whatis([[Name : {{ spec.name }}]])
whatis([[Version : {{ spec.version }}]])
+whatis([[Target : {{ spec.target }}]])
whatis([[Short description : {{ short_description }}]])
{% endif %}
{% if configure_options %}