summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/platforms/cray.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/spack/spack/platforms/cray.py b/lib/spack/spack/platforms/cray.py
index cc66d8aadc..d9df8137a3 100644
--- a/lib/spack/spack/platforms/cray.py
+++ b/lib/spack/spack/platforms/cray.py
@@ -24,6 +24,7 @@ _craype_name_to_target_name = {
'x86-cascadelake': 'cascadelake',
'x86-naples': 'zen',
'x86-rome': 'zen2',
+ 'x86-milan': 'zen3',
'x86-skylake': 'skylake_avx512',
'mic-knl': 'mic_knl',
'interlagos': 'bulldozer',
@@ -143,19 +144,25 @@ class Cray(Platform):
env={'TERM': os.environ.get('TERM', '')},
output=str, error=os.devnull
)
+
default_from_module = ''.join(output.split()) # rm all whitespace
if default_from_module:
tty.debug("Found default module:%s" % default_from_module)
return default_from_module
else:
- front_end = archspec.cpu.host().name
- if front_end in list(
- map(lambda x: _target_name_from_craype_target_name(x),
- self._avail_targets())
- ):
- tty.debug("default to front-end architecture")
- return archspec.cpu.host().name
+ front_end = archspec.cpu.host()
+ # Look for the frontend architecture or closest ancestor
+ # available in cray target modules
+ avail = [
+ _target_name_from_craype_target_name(x)
+ for x in self._avail_targets()
+ ]
+ for front_end_possibility in [front_end] + front_end.ancestors:
+ if front_end_possibility.name in avail:
+ tty.debug("using front-end architecture or available ancestor")
+ return front_end_possibility.name
else:
+ tty.debug("using platform.machine as default")
return platform.machine()
def _avail_targets(self):