From de1f9593c618417b4a3fdd1f7544cb09609408a8 Mon Sep 17 00:00:00 2001 From: Greg Becker Date: Wed, 20 Mar 2024 15:43:45 -0700 Subject: cray: return false more readily in detection logic (#43150) Often in containers, the files we use to detect whether a cray system supports new features are not available. Given that the cray containers only support the newer versions, and that these versions have been around for a while at this point and few sites don't support them, this PR changes the logic for detecting cray systems so that: 1. Don't even consider whether something is the `cray` platform if `opt/cray` is not in `MODULEPATH` 2. Only use the `cray` platform if we can read files in /opt/cray/pe and positively detect an older version 3. Otherwise, assume we're *not* on a cray (includes newer Cray PE's, which we treat as Linux) --- lib/spack/spack/platforms/cray.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/platforms/cray.py b/lib/spack/spack/platforms/cray.py index 180af15435..e8cc833c51 100644 --- a/lib/spack/spack/platforms/cray.py +++ b/lib/spack/spack/platforms/cray.py @@ -160,10 +160,15 @@ class Cray(Platform): system, as the Cray compiler wrappers and other components of the Cray programming environment are irrelevant without module support. """ - craype_type, craype_version = cls.craype_type_and_version() - if craype_type == "EX" and craype_version >= spack.version.Version("21.10"): + if "opt/cray" not in os.environ.get("MODULEPATH", ""): return False - return "opt/cray" in os.environ.get("MODULEPATH", "") + + craype_type, craype_version = cls.craype_type_and_version() + if craype_type == "XC": + return True + if craype_type == "EX" and craype_version < spack.version.Version("21.10"): + return True + return False def _default_target_from_env(self): """Set and return the default CrayPE target loaded in a clean login -- cgit v1.2.3-70-g09d2