From 0a353abc42e5bd67ce0401a58b327c2d84d9eab9 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Tue, 7 May 2024 09:20:34 +0200 Subject: [PATCH] Fix issues in packages with the new release of archspec (#44037) --- var/spack/repos/builtin/packages/arbor/package.py | 4 +--- var/spack/repos/builtin/packages/gcc/package.py | 6 +++--- var/spack/repos/builtin/packages/hpcc/package.py | 2 +- var/spack/repos/builtin/packages/lammps/package.py | 6 +----- var/spack/repos/builtin/packages/namd/package.py | 2 +- var/spack/repos/builtin/packages/py-tensorflow/package.py | 5 +---- 6 files changed, 8 insertions(+), 17 deletions(-) diff --git a/var/spack/repos/builtin/packages/arbor/package.py b/var/spack/repos/builtin/packages/arbor/package.py index ca3651e4b3..ac189d56aa 100644 --- a/var/spack/repos/builtin/packages/arbor/package.py +++ b/var/spack/repos/builtin/packages/arbor/package.py @@ -120,9 +120,7 @@ def cmake_args(self): # query spack for the architecture-specific compiler flags set by its wrapper args.append("-DARB_ARCH=none") - opt_flags = self.spec.target.optimization_flags( - self.spec.compiler.name, self.spec.compiler.version - ) + opt_flags = self.spec.architecture.target.optimization_flags(self.spec.compiler) args.append("-DARB_CXX_FLAGS_TARGET=" + opt_flags) return args diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index f10ff1623a..b3bb491d7f 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -683,10 +683,10 @@ def get_common_target_flags(self, spec): """Get the right (but pessimistic) architecture specific flags supported by both host gcc and to-be-built gcc. For example: gcc@7 %gcc@12 target=znver3 should pick -march=znver1, since that's what gcc@7 supports.""" - archs = [spec.target] + spec.target.ancestors - for arch in archs: + microarchitectures = [spec.target] + spec.target.ancestors + for uarch in microarchitectures: try: - return arch.optimization_flags("gcc", spec.version) + return uarch.optimization_flags("gcc", str(spec.version)) except UnsupportedMicroarchitecture: pass # no arch specific flags in common, unlikely to happen. diff --git a/var/spack/repos/builtin/packages/hpcc/package.py b/var/spack/repos/builtin/packages/hpcc/package.py index 08c620c00d..56674ae0c5 100644 --- a/var/spack/repos/builtin/packages/hpcc/package.py +++ b/var/spack/repos/builtin/packages/hpcc/package.py @@ -159,7 +159,7 @@ def edit(self, spec, prefix): if spec.satisfies("%intel"): # with intel-parallel-studio+mpi the '-march' arguments # are not passed to icc - arch_opt = spec.target.optimization_flags(spec.compiler.name, spec.compiler.version) + arch_opt = spec.architecture.target.optimization_flags(spec.compiler) self.config["@CCFLAGS@"] = "-O3 -restrict -ansi-alias -ip {0}".format(arch_opt) self.config["@CCNOOPT@"] = "-restrict" self._write_make_arch(spec, prefix) diff --git a/var/spack/repos/builtin/packages/lammps/package.py b/var/spack/repos/builtin/packages/lammps/package.py index aac96002d2..7d007d559f 100644 --- a/var/spack/repos/builtin/packages/lammps/package.py +++ b/var/spack/repos/builtin/packages/lammps/package.py @@ -5,8 +5,6 @@ import datetime as dt import os -import archspec - from spack.package import * @@ -822,9 +820,7 @@ def cmake_args(self): args.append(self.define("CMAKE_CXX_FLAGS_RELWITHDEBINFO", cxx_flags)) # Overwrite generic cpu tune option - cmake_tune_flags = archspec.cpu.TARGETS[spec.target.name].optimization_flags( - spec.compiler.name, spec.compiler.version - ) + cmake_tune_flags = spec.architecture.target.optimization_flags(spec.compiler) args.append(self.define("CMAKE_TUNE_FLAGS", cmake_tune_flags)) args.append(self.define_from_variant("LAMMPS_SIZES", "lammps_sizes")) diff --git a/var/spack/repos/builtin/packages/namd/package.py b/var/spack/repos/builtin/packages/namd/package.py index ae47ddd46b..4bb91a8772 100644 --- a/var/spack/repos/builtin/packages/namd/package.py +++ b/var/spack/repos/builtin/packages/namd/package.py @@ -134,7 +134,7 @@ def _edit_arch_generic(self, spec, prefix): # this options are take from the default provided # configuration files # https://github.com/UIUC-PPL/charm/pull/2778 - archopt = spec.target.optimization_flags(spec.compiler.name, spec.compiler.version) + archopt = spec.architecture.target.optimization_flags(spec.compiler) if self.spec.satisfies("^charmpp@:6.10.1"): optims_opts = { diff --git a/var/spack/repos/builtin/packages/py-tensorflow/package.py b/var/spack/repos/builtin/packages/py-tensorflow/package.py index 56d12ff231..6668507186 100644 --- a/var/spack/repos/builtin/packages/py-tensorflow/package.py +++ b/var/spack/repos/builtin/packages/py-tensorflow/package.py @@ -605,10 +605,7 @@ def setup_build_environment(self, env): # Please specify optimization flags to use during compilation when # bazel option '--config=opt' is specified - env.set( - "CC_OPT_FLAGS", - spec.target.optimization_flags(spec.compiler.name, spec.compiler.version), - ) + env.set("CC_OPT_FLAGS", spec.architecture.target.optimization_flags(spec.compiler)) # Would you like to interactively configure ./WORKSPACE for # Android builds?