Fix issues in packages with the new release of archspec (#44037)

This commit is contained in:
Massimiliano Culpo 2024-05-07 09:20:34 +02:00 committed by GitHub
parent e178c58847
commit 0a353abc42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 8 additions and 17 deletions

View file

@ -120,9 +120,7 @@ def cmake_args(self):
# query spack for the architecture-specific compiler flags set by its wrapper # query spack for the architecture-specific compiler flags set by its wrapper
args.append("-DARB_ARCH=none") args.append("-DARB_ARCH=none")
opt_flags = self.spec.target.optimization_flags( opt_flags = self.spec.architecture.target.optimization_flags(self.spec.compiler)
self.spec.compiler.name, self.spec.compiler.version
)
args.append("-DARB_CXX_FLAGS_TARGET=" + opt_flags) args.append("-DARB_CXX_FLAGS_TARGET=" + opt_flags)
return args return args

View file

@ -683,10 +683,10 @@ def get_common_target_flags(self, spec):
"""Get the right (but pessimistic) architecture specific flags supported by """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 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.""" should pick -march=znver1, since that's what gcc@7 supports."""
archs = [spec.target] + spec.target.ancestors microarchitectures = [spec.target] + spec.target.ancestors
for arch in archs: for uarch in microarchitectures:
try: try:
return arch.optimization_flags("gcc", spec.version) return uarch.optimization_flags("gcc", str(spec.version))
except UnsupportedMicroarchitecture: except UnsupportedMicroarchitecture:
pass pass
# no arch specific flags in common, unlikely to happen. # no arch specific flags in common, unlikely to happen.

View file

@ -159,7 +159,7 @@ def edit(self, spec, prefix):
if spec.satisfies("%intel"): if spec.satisfies("%intel"):
# with intel-parallel-studio+mpi the '-march' arguments # with intel-parallel-studio+mpi the '-march' arguments
# are not passed to icc # 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["@CCFLAGS@"] = "-O3 -restrict -ansi-alias -ip {0}".format(arch_opt)
self.config["@CCNOOPT@"] = "-restrict" self.config["@CCNOOPT@"] = "-restrict"
self._write_make_arch(spec, prefix) self._write_make_arch(spec, prefix)

View file

@ -5,8 +5,6 @@
import datetime as dt import datetime as dt
import os import os
import archspec
from spack.package import * from spack.package import *
@ -822,9 +820,7 @@ def cmake_args(self):
args.append(self.define("CMAKE_CXX_FLAGS_RELWITHDEBINFO", cxx_flags)) args.append(self.define("CMAKE_CXX_FLAGS_RELWITHDEBINFO", cxx_flags))
# Overwrite generic cpu tune option # Overwrite generic cpu tune option
cmake_tune_flags = archspec.cpu.TARGETS[spec.target.name].optimization_flags( cmake_tune_flags = spec.architecture.target.optimization_flags(spec.compiler)
spec.compiler.name, spec.compiler.version
)
args.append(self.define("CMAKE_TUNE_FLAGS", cmake_tune_flags)) args.append(self.define("CMAKE_TUNE_FLAGS", cmake_tune_flags))
args.append(self.define_from_variant("LAMMPS_SIZES", "lammps_sizes")) args.append(self.define_from_variant("LAMMPS_SIZES", "lammps_sizes"))

View file

@ -134,7 +134,7 @@ def _edit_arch_generic(self, spec, prefix):
# this options are take from the default provided # this options are take from the default provided
# configuration files # configuration files
# https://github.com/UIUC-PPL/charm/pull/2778 # 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"): if self.spec.satisfies("^charmpp@:6.10.1"):
optims_opts = { optims_opts = {

View file

@ -605,10 +605,7 @@ def setup_build_environment(self, env):
# Please specify optimization flags to use during compilation when # Please specify optimization flags to use during compilation when
# bazel option '--config=opt' is specified # bazel option '--config=opt' is specified
env.set( env.set("CC_OPT_FLAGS", spec.architecture.target.optimization_flags(spec.compiler))
"CC_OPT_FLAGS",
spec.target.optimization_flags(spec.compiler.name, spec.compiler.version),
)
# Would you like to interactively configure ./WORKSPACE for # Would you like to interactively configure ./WORKSPACE for
# Android builds? # Android builds?