diff options
author | Greg Becker <becker33@llnl.gov> | 2024-03-20 15:43:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-20 15:43:45 -0700 |
commit | de1f9593c618417b4a3fdd1f7544cb09609408a8 (patch) | |
tree | 054a539bcc28febedb1715920436886c713556cd /lib | |
parent | 65fa71c1b4fb2cacb0adbcbcb685728ae61f8da3 (diff) | |
download | spack-de1f9593c618417b4a3fdd1f7544cb09609408a8.tar.gz spack-de1f9593c618417b4a3fdd1f7544cb09609408a8.tar.bz2 spack-de1f9593c618417b4a3fdd1f7544cb09609408a8.tar.xz spack-de1f9593c618417b4a3fdd1f7544cb09609408a8.zip |
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)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/platforms/cray.py | 11 |
1 files changed, 8 insertions, 3 deletions
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 |