From 7dc0ca4ee68ef028b9f6226d13a49e495bee63c6 Mon Sep 17 00:00:00 2001 From: Greg Becker Date: Tue, 19 Oct 2021 16:39:50 -0500 Subject: cray architecture detection for zen3/milan (#26827) * Update cray architecture detection for milan Update the cray architecture module table with x86-milan -> zen3 Make cray architecture more robust to back off from frontend architecture to a recent ancestor if necessary. This should make future cray updates less paingful for users. Co-authored-by: Gregory Becker Co-authored-by: Todd Gamblin --- lib/spack/spack/platforms/cray.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'lib') 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): -- cgit v1.2.3-60-g2f50