summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeter Scheibel <scheibel1@llnl.gov>2022-12-08 11:28:06 -0800
committerGitHub <noreply@github.com>2022-12-08 11:28:06 -0800
commitc6e35da2c78a752675682fe8fb5b94173610b3fe (patch)
tree559d7e1cc1556c2d9cfdb82ff36774f2b0d418e1 /lib
parentf1cd3271868bee10e897f7b2ee7633c3cc78bbc7 (diff)
downloadspack-c6e35da2c78a752675682fe8fb5b94173610b3fe.tar.gz
spack-c6e35da2c78a752675682fe8fb5b94173610b3fe.tar.bz2
spack-c6e35da2c78a752675682fe8fb5b94173610b3fe.tar.xz
spack-c6e35da2c78a752675682fe8fb5b94173610b3fe.zip
Cray manifest: automatically convert 'cray' platform to 'linux' (#34177)
* Automatically convert 'cray' platform to 'linux'
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cray_manifest.py9
-rw-r--r--lib/spack/spack/platforms/test.py5
-rw-r--r--lib/spack/spack/test/cray_manifest.py28
3 files changed, 39 insertions, 3 deletions
diff --git a/lib/spack/spack/cray_manifest.py b/lib/spack/spack/cray_manifest.py
index 66dd33ce7c..3ce0ca8721 100644
--- a/lib/spack/spack/cray_manifest.py
+++ b/lib/spack/spack/cray_manifest.py
@@ -61,9 +61,16 @@ def compiler_from_entry(entry):
def spec_from_entry(entry):
arch_str = ""
if "arch" in entry:
+ local_platform = spack.platforms.host()
+ spec_platform = entry["arch"]["platform"]
+ # Note that Cray systems are now treated as Linux. Specs
+ # in the manifest which specify "cray" as the platform
+ # should be registered in the DB as "linux"
+ if local_platform.name == "linux" and spec_platform.lower() == "cray":
+ spec_platform = "linux"
arch_format = "arch={platform}-{os}-{target}"
arch_str = arch_format.format(
- platform=entry["arch"]["platform"],
+ platform=spec_platform,
os=entry["arch"]["platform_os"],
target=entry["arch"]["target"]["name"],
)
diff --git a/lib/spack/spack/platforms/test.py b/lib/spack/spack/platforms/test.py
index 26fe943394..a873f4cdd6 100644
--- a/lib/spack/spack/platforms/test.py
+++ b/lib/spack/spack/platforms/test.py
@@ -29,8 +29,9 @@ class Test(Platform):
back_os = "debian6"
default_os = "debian6"
- def __init__(self):
- super(Test, self).__init__("test")
+ def __init__(self, name=None):
+ name = name or "test"
+ super(Test, self).__init__(name)
self.add_target(self.default, spack.target.Target(self.default))
self.add_target(self.front_end, spack.target.Target(self.front_end))
diff --git a/lib/spack/spack/test/cray_manifest.py b/lib/spack/spack/test/cray_manifest.py
index 4d030e8e11..282fdcecca 100644
--- a/lib/spack/spack/test/cray_manifest.py
+++ b/lib/spack/spack/test/cray_manifest.py
@@ -233,6 +233,34 @@ def test_generate_specs_from_manifest():
assert openmpi_spec["hwloc"]
+def test_translate_cray_platform_to_linux(monkeypatch):
+ """Manifests might list specs on newer Cray platforms as being "cray",
+ but Spack identifies such platforms as "linux". Make sure we
+ automaticaly transform these entries.
+ """
+ test_linux_platform = spack.platforms.test.Test("linux")
+
+ def the_host_is_linux():
+ return test_linux_platform
+
+ monkeypatch.setattr(spack.platforms, "host", the_host_is_linux)
+
+ cray_arch = JsonArchEntry(platform="cray", os="rhel8", target="x86_64").to_dict()
+ spec_json = JsonSpecEntry(
+ name="cray-mpich",
+ hash="craympichfakehashaaa",
+ prefix="/path/to/cray-mpich/",
+ version="1.0.0",
+ arch=cray_arch,
+ compiler=_common_compiler.spec_json(),
+ dependencies={},
+ parameters={},
+ ).to_dict()
+
+ (spec,) = entries_to_specs([spec_json]).values()
+ assert spec.architecture.platform == "linux"
+
+
def test_translate_compiler_name():
nvidia_compiler = JsonCompilerEntry(
name="nvidia",