Deprecate frontend/backend os/target (#47756)

This commit is contained in:
Massimiliano Culpo 2025-01-29 13:22:51 +01:00 committed by GitHub
parent 0f54995e53
commit 196c912b8a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
30 changed files with 102 additions and 227 deletions

View File

@ -27,9 +27,9 @@
class ClingoBootstrapConcretizer:
def __init__(self, configuration):
self.host_platform = spack.platforms.host()
self.host_os = self.host_platform.operating_system("frontend")
self.host_os = self.host_platform.default_operating_system()
self.host_target = archspec.cpu.host().family
self.host_architecture = spack.spec.ArchSpec.frontend_arch()
self.host_architecture = spack.spec.ArchSpec.default_arch()
self.host_architecture.target = str(self.host_target)
self.host_compiler = self._valid_compiler_or_raise()
self.host_python = self.python_external_spec()

View File

@ -141,7 +141,7 @@ def _bootstrap_config_scopes() -> Sequence["spack.config.ConfigScope"]:
def _add_compilers_if_missing() -> None:
arch = spack.spec.ArchSpec.frontend_arch()
arch = spack.spec.ArchSpec.default_arch()
if not spack.compilers.compilers_for_arch(arch):
spack.compilers.find_compilers()

View File

@ -264,16 +264,17 @@ def update_external_dependencies(self, extendee_spec=None):
# Ensure architecture information is present
if not python.architecture:
host_platform = spack.platforms.host()
host_os = host_platform.operating_system("default_os")
host_target = host_platform.target("default_target")
host_os = host_platform.default_operating_system()
host_target = host_platform.default_target()
python.architecture = spack.spec.ArchSpec(
(str(host_platform), str(host_os), str(host_target))
)
else:
if not python.architecture.platform:
python.architecture.platform = spack.platforms.host()
platform = spack.platforms.by_name(python.architecture.platform)
if not python.architecture.os:
python.architecture.os = "default_os"
python.architecture.os = platform.default_operating_system()
if not python.architecture.target:
python.architecture.target = archspec.cpu.host().family.name

View File

@ -3,6 +3,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import collections
import warnings
import archspec.cpu
@ -51,10 +52,10 @@ def setup_parser(subparser):
"-t", "--target", action="store_true", default=False, help="print only the target"
)
parts2.add_argument(
"-f", "--frontend", action="store_true", default=False, help="print frontend"
"-f", "--frontend", action="store_true", default=False, help="print frontend (DEPRECATED)"
)
parts2.add_argument(
"-b", "--backend", action="store_true", default=False, help="print backend"
"-b", "--backend", action="store_true", default=False, help="print backend (DEPRECATED)"
)
@ -98,15 +99,14 @@ def arch(parser, args):
display_targets(archspec.cpu.TARGETS)
return
os_args, target_args = "default_os", "default_target"
if args.frontend:
os_args, target_args = "frontend", "frontend"
warnings.warn("the argument --frontend is deprecated, and will be removed in Spack v1.0")
elif args.backend:
os_args, target_args = "backend", "backend"
warnings.warn("the argument --backend is deprecated, and will be removed in Spack v1.0")
host_platform = spack.platforms.host()
host_os = host_platform.operating_system(os_args)
host_target = host_platform.target(target_args)
host_os = host_platform.default_operating_system()
host_target = host_platform.default_target()
if args.family:
host_target = host_target.family
elif args.generic:

View File

@ -86,8 +86,8 @@ def create_db_tarball(args):
def report(args):
host_platform = spack.platforms.host()
host_os = host_platform.operating_system("frontend")
host_target = host_platform.target("frontend")
host_os = host_platform.default_operating_system()
host_target = host_platform.default_target()
architecture = spack.spec.ArchSpec((str(host_platform), str(host_os), str(host_target)))
print("* **Spack:**", spack.get_version())
print("* **Python:**", platform.python_version())

View File

@ -54,10 +54,6 @@
@m{target=target} specific <target> processor
@m{arch=platform-os-target} shortcut for all three above
cross-compiling:
@m{os=backend} or @m{os=be} build for compute node (backend)
@m{os=frontend} or @m{os=fe} build for login node (frontend)
dependencies:
^dependency [constraints] specify constraints on dependencies
^@K{/hash} build with a specific installed

View File

@ -801,17 +801,17 @@ def _extract_compiler_paths(spec: "spack.spec.Spec") -> Optional[Dict[str, str]]
def _extract_os_and_target(spec: "spack.spec.Spec"):
if not spec.architecture:
host_platform = spack.platforms.host()
operating_system = host_platform.operating_system("default_os")
target = host_platform.target("default_target")
operating_system = host_platform.default_operating_system()
target = host_platform.default_target()
else:
target = spec.architecture.target
if not target:
target = spack.platforms.host().target("default_target")
target = spack.platforms.host().default_target()
operating_system = spec.os
if not operating_system:
host_platform = spack.platforms.host()
operating_system = host_platform.operating_system("default_os")
operating_system = host_platform.default_operating_system()
return operating_system, target

View File

@ -728,7 +728,7 @@ def _compatible_sys_types():
with the current host.
"""
host_platform = spack.platforms.host()
host_os = str(host_platform.operating_system("default_os"))
host_os = str(host_platform.default_operating_system())
host_target = archspec.cpu.host()
compatible_targets = [host_target] + host_target.ancestors

View File

@ -52,8 +52,7 @@ def use_platform(new_platform):
import spack.config
msg = '"{0}" must be an instance of Platform'
assert isinstance(new_platform, Platform), msg.format(new_platform)
assert isinstance(new_platform, Platform), f'"{new_platform}" must be an instance of Platform'
original_host_fn = host

View File

@ -1,42 +1,22 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import warnings
from typing import Optional
import archspec.cpu
import llnl.util.lang
import spack.error
class NoPlatformError(spack.error.SpackError):
def __init__(self):
msg = "Could not determine a platform for this machine"
super().__init__(msg)
@llnl.util.lang.lazy_lexicographic_ordering
class Platform:
"""Platform is an abstract class extended by subclasses.
To add a new type of platform (such as cray_xe), create a subclass and set all the
class attributes such as priority, front_target, back_target, front_os, back_os.
Platform also contain a priority class attribute. A lower number signifies higher
priority. These numbers are arbitrarily set and can be changed though often there
isn't much need unless a new platform is added and the user wants that to be
detected first.
Targets are created inside the platform subclasses. Most architecture (like linux,
and darwin) will have only one target family (x86_64) but in the case of Cray
machines, there is both a frontend and backend processor. The user can specify
which targets are present on front-end and back-end architecture.
Depending on the platform, operating systems are either autodetected or are
set. The user can set the frontend and backend operating setting by the class
attributes front_os and back_os. The operating system will be responsible for
compiler detection.
"""
# Subclass sets number. Controls detection order
@ -45,82 +25,72 @@ class attributes such as priority, front_target, back_target, front_os, back_os.
#: binary formats used on this platform; used by relocation logic
binary_formats = ["elf"]
front_end: Optional[str] = None
back_end: Optional[str] = None
default: Optional[str] = None # The default back end target.
front_os: Optional[str] = None
back_os: Optional[str] = None
default_os: Optional[str] = None
default: str
default_os: str
reserved_targets = ["default_target", "frontend", "fe", "backend", "be"]
reserved_oss = ["default_os", "frontend", "fe", "backend", "be"]
deprecated_names = ["frontend", "fe", "backend", "be"]
def __init__(self, name):
self.targets = {}
self.operating_sys = {}
self.name = name
self._init_targets()
def add_target(self, name: str, target: archspec.cpu.Microarchitecture) -> None:
"""Used by the platform specific subclass to list available targets.
Raises an error if the platform specifies a name
that is reserved by spack as an alias.
"""
if name in Platform.reserved_targets:
msg = "{0} is a spack reserved alias and cannot be the name of a target"
raise ValueError(msg.format(name))
msg = f"{name} is a spack reserved alias and cannot be the name of a target"
raise ValueError(msg)
self.targets[name] = target
def _add_archspec_targets(self):
def _init_targets(self):
self.default = archspec.cpu.host().name
for name, microarchitecture in archspec.cpu.TARGETS.items():
self.add_target(name, microarchitecture)
def target(self, name):
"""This is a getter method for the target dictionary
that handles defaulting based on the values provided by default,
front-end, and back-end. This can be overwritten
by a subclass for which we want to provide further aliasing options.
"""
# TODO: Check if we can avoid using strings here
name = str(name)
if name == "default_target":
if name in Platform.deprecated_names:
warnings.warn(f"target={name} is deprecated, use target={self.default} instead")
if name in Platform.reserved_targets:
name = self.default
elif name == "frontend" or name == "fe":
name = self.front_end
elif name == "backend" or name == "be":
name = self.back_end
return self.targets.get(name, None)
def add_operating_system(self, name, os_class):
"""Add the operating_system class object into the
platform.operating_sys dictionary.
"""
if name in Platform.reserved_oss:
msg = "{0} is a spack reserved alias and cannot be the name of an OS"
raise ValueError(msg.format(name))
if name in Platform.reserved_oss + Platform.deprecated_names:
msg = f"{name} is a spack reserved alias and cannot be the name of an OS"
raise ValueError(msg)
self.operating_sys[name] = os_class
def default_target(self):
return self.target(self.default)
def default_operating_system(self):
return self.operating_system(self.default_os)
def operating_system(self, name):
if name == "default_os":
if name in Platform.deprecated_names:
warnings.warn(f"os={name} is deprecated, use os={self.default_os} instead")
if name in Platform.reserved_oss:
name = self.default_os
if name == "frontend" or name == "fe":
name = self.front_os
if name == "backend" or name == "be":
name = self.back_os
return self.operating_sys.get(name, None)
def setup_platform_environment(self, pkg, env):
"""Subclass can override this method if it requires any
platform-specific build environment modifications.
"""Platform-specific build environment modifications.
This method is meant toi be overridden by subclasses, when needed.
"""
pass
@classmethod
def detect(cls):
"""Return True if the the host platform is detected to be the current
Platform class, False otherwise.
"""Returns True if the host platform is detected to be the current Platform class,
False otherwise.
Derived classes are responsible for implementing this method.
"""
@ -135,11 +105,7 @@ def __str__(self):
def _cmp_iter(self):
yield self.name
yield self.default
yield self.front_end
yield self.back_end
yield self.default_os
yield self.front_os
yield self.back_os
def targets():
for t in sorted(self.targets.values()):

View File

@ -4,8 +4,6 @@
import platform as py_platform
import archspec.cpu
from spack.operating_systems.mac_os import MacOs
from spack.version import Version
@ -19,18 +17,8 @@ class Darwin(Platform):
def __init__(self):
super().__init__("darwin")
self._add_archspec_targets()
self.default = archspec.cpu.host().name
self.front_end = self.default
self.back_end = self.default
mac_os = MacOs()
self.default_os = str(mac_os)
self.front_os = str(mac_os)
self.back_os = str(mac_os)
self.add_operating_system(str(mac_os), mac_os)
@classmethod

View File

@ -3,8 +3,6 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import platform
import archspec.cpu
from spack.operating_systems.freebsd import FreeBSDOs
from ._platform import Platform
@ -15,18 +13,8 @@ class FreeBSD(Platform):
def __init__(self):
super().__init__("freebsd")
self._add_archspec_targets()
# Get specific default
self.default = archspec.cpu.host().name
self.front_end = self.default
self.back_end = self.default
os = FreeBSDOs()
self.default_os = str(os)
self.front_os = self.default_os
self.back_os = self.default_os
self.add_operating_system(str(os), os)
@classmethod

View File

@ -3,8 +3,6 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import platform
import archspec.cpu
from spack.operating_systems.linux_distro import LinuxDistro
from ._platform import Platform
@ -15,18 +13,8 @@ class Linux(Platform):
def __init__(self):
super().__init__("linux")
self._add_archspec_targets()
# Get specific default
self.default = archspec.cpu.host().name
self.front_end = self.default
self.back_end = self.default
linux_dist = LinuxDistro()
self.default_os = str(linux_dist)
self.front_os = self.default_os
self.back_os = self.default_os
self.add_operating_system(str(linux_dist), linux_dist)
@classmethod

View File

@ -16,31 +16,19 @@ class Test(Platform):
if platform.system().lower() == "darwin":
binary_formats = ["macho"]
if platform.machine() == "arm64":
front_end = "aarch64"
back_end = "m1"
default = "m1"
else:
front_end = "x86_64"
back_end = "core2"
default = "core2"
front_os = "redhat6"
back_os = "debian6"
default_os = "debian6"
default = "m1" if platform.machine() == "arm64" else "core2"
def __init__(self, name=None):
name = name or "test"
super().__init__(name)
self.add_target(self.default, archspec.cpu.TARGETS[self.default])
self.add_target(self.front_end, archspec.cpu.TARGETS[self.front_end])
self.add_operating_system("debian6", spack.operating_systems.OperatingSystem("debian", 6))
self.add_operating_system("redhat6", spack.operating_systems.OperatingSystem("redhat", 6))
self.add_operating_system(
self.default_os, spack.operating_systems.OperatingSystem("debian", 6)
)
self.add_operating_system(
self.front_os, spack.operating_systems.OperatingSystem("redhat", 6)
)
def _init_targets(self):
targets = ("aarch64", "m1") if platform.machine() == "arm64" else ("x86_64", "core2")
for t in targets:
self.add_target(t, archspec.cpu.TARGETS[t])
@classmethod
def detect(cls):

View File

@ -4,8 +4,6 @@
import platform
import archspec.cpu
from spack.operating_systems.windows_os import WindowsOs
from ._platform import Platform
@ -16,18 +14,8 @@ class Windows(Platform):
def __init__(self):
super().__init__("windows")
self._add_archspec_targets()
self.default = archspec.cpu.host().name
self.front_end = self.default
self.back_end = self.default
windows_os = WindowsOs()
self.default_os = str(windows_os)
self.front_os = str(windows_os)
self.back_os = str(windows_os)
self.add_operating_system(str(windows_os), windows_os)
@classmethod

View File

@ -106,7 +106,7 @@ def __init__(self, configuration: CDashConfiguration):
self.site = configuration.site or socket.gethostname()
self.osname = platform.system()
self.osrelease = platform.release()
self.target = spack.platforms.host().target("default_target")
self.target = spack.platforms.host().default_target()
self.starttime = int(time.time())
self.endtime = self.starttime
self.buildstamp = (

View File

@ -237,23 +237,14 @@ def _make_microarchitecture(name: str) -> archspec.cpu.Microarchitecture:
class ArchSpec:
"""Aggregate the target platform, the operating system and the target microarchitecture."""
@staticmethod
def _return_arch(os_tag, target_tag):
platform = spack.platforms.host()
default_os = platform.operating_system(os_tag)
default_target = platform.target(target_tag)
arch_tuple = str(platform), str(default_os), str(default_target)
return ArchSpec(arch_tuple)
@staticmethod
def default_arch():
"""Return the default architecture"""
return ArchSpec._return_arch("default_os", "default_target")
@staticmethod
def frontend_arch():
"""Return the frontend architecture"""
return ArchSpec._return_arch("frontend", "frontend")
platform = spack.platforms.host()
default_os = platform.default_operating_system()
default_target = platform.default_target()
arch_tuple = str(platform), str(default_os), str(default_target)
return ArchSpec(arch_tuple)
__slots__ = "_platform", "_os", "_target"
@ -5191,12 +5182,10 @@ def get_host_environment_metadata() -> Dict[str, str]:
def get_host_environment() -> Dict[str, Any]:
"""Return a dictionary (lookup) with host information (not including the
os.environ).
"""
"""Returns a dictionary with host information (not including the os.environ)."""
host_platform = spack.platforms.host()
host_target = host_platform.target("default_target")
host_os = host_platform.operating_system("default_os")
host_target = host_platform.default_target()
host_os = host_platform.default_operating_system()
arch_fmt = "platform={0} os={1} target={2}"
arch_spec = Spec(arch_fmt.format(host_platform, host_os, host_target))
return {

View File

@ -60,8 +60,7 @@ def test_user_input_combination(config, target_str, os_str):
"""Test for all the valid user input combinations that both the target and
the operating system match.
"""
spec_str = "libelf os={} target={}".format(os_str, target_str)
spec = Spec(spec_str)
spec = Spec(f"libelf os={os_str} target={target_str}")
assert spec.architecture.os == str(TEST_PLATFORM.operating_system(os_str))
assert spec.architecture.target == TEST_PLATFORM.target(target_str)
@ -71,8 +70,8 @@ def test_default_os_and_target(default_mock_concretization):
after concretization.
"""
spec = default_mock_concretization("libelf")
assert spec.architecture.os == str(TEST_PLATFORM.operating_system("default_os"))
assert spec.architecture.target == TEST_PLATFORM.target("default_target")
assert spec.architecture.os == str(TEST_PLATFORM.default_operating_system())
assert spec.architecture.target == TEST_PLATFORM.default_target()
def test_operating_system_conversion_to_dict():

View File

@ -51,8 +51,8 @@ def test_create_db_tarball(tmpdir, database):
def test_report():
out = debug("report")
host_platform = spack.platforms.host()
host_os = host_platform.operating_system("frontend")
host_target = host_platform.target("frontend")
host_os = host_platform.default_operating_system()
host_target = host_platform.default_target()
architecture = spack.spec.ArchSpec((str(host_platform), str(host_os), str(host_target)))
assert spack.get_version() in out

View File

@ -2614,7 +2614,7 @@ def test_stack_yaml_remove_from_matrix_no_effect(tmpdir):
- packages:
- matrix:
- [mpileaks, callpath]
- [target=be]
- [target=default_target]
specs:
- $packages
"""
@ -2639,7 +2639,7 @@ def test_stack_yaml_force_remove_from_matrix(tmpdir):
- packages:
- matrix:
- [mpileaks, callpath]
- [target=be]
- [target=default_target]
specs:
- $packages
"""
@ -2659,7 +2659,7 @@ def test_stack_yaml_force_remove_from_matrix(tmpdir):
assert before_user == after_user
mpileaks_spec = Spec("mpileaks target=be")
mpileaks_spec = Spec("mpileaks target=default_target")
assert mpileaks_spec in before_conc
assert mpileaks_spec not in after_conc

View File

@ -148,7 +148,6 @@ def current_host(request, monkeypatch):
cpu, _, is_preference = request.param.partition("-")
monkeypatch.setattr(spack.platforms.Test, "default", cpu)
monkeypatch.setattr(spack.platforms.Test, "front_end", cpu)
if not is_preference:
target = archspec.cpu.TARGETS[cpu]
monkeypatch.setattr(archspec.cpu, "host", lambda: target)
@ -385,10 +384,11 @@ def test_different_compilers_get_different_flags(
):
"""Tests that nodes get the flags of the associated compiler."""
mutable_config.set("compilers", [clang12_with_flags, gcc11_with_flags])
t = archspec.cpu.host().family
client = spack.concretize.concretize_one(
Spec(
"cmake-client %gcc@11.1.0 platform=test os=fe target=fe"
" ^cmake %clang@12.2.0 platform=test os=fe target=fe"
f"cmake-client %gcc@11.1.0 platform=test os=redhat6 target={t}"
f" ^cmake %clang@12.2.0 platform=test os=redhat6 target={t}"
)
)
cmake = client["cmake"]
@ -413,7 +413,8 @@ def test_spec_flags_maintain_order(self, mutable_config, gcc11_with_flags):
def test_compiler_flags_differ_identical_compilers(self, mutable_config, clang12_with_flags):
mutable_config.set("compilers", [clang12_with_flags])
# Correct arch to use test compiler that has flags
spec = Spec("pkg-a %clang@12.2.0 platform=test os=fe target=fe")
t = archspec.cpu.host().family
spec = Spec(f"pkg-a %clang@12.2.0 platform=test os=redhat6 target={t}")
# Get the compiler that matches the spec (
compiler = spack.compilers.compiler_for_spec("clang@=12.2.0", spec.architecture)
@ -2111,14 +2112,15 @@ def test_installed_specs_disregard_conflicts(self, mutable_database, monkeypatch
def test_require_targets_are_allowed(self, mutable_database):
"""Test that users can set target constraints under the require attribute."""
# Configuration to be added to packages.yaml
external_conf = {"all": {"require": "target=%s" % spack.platforms.test.Test.front_end}}
required_target = archspec.cpu.TARGETS[spack.platforms.test.Test.default].family
external_conf = {"all": {"require": f"target={required_target}"}}
spack.config.set("packages", external_conf)
with spack.config.override("concretizer:reuse", False):
spec = spack.concretize.concretize_one("mpich")
for s in spec.traverse():
assert s.satisfies("target=%s" % spack.platforms.test.Test.front_end)
assert s.satisfies(f"target={required_target}")
def test_external_python_extensions_have_dependency(self):
"""Test that python extensions have access to a python dependency

View File

@ -408,7 +408,7 @@ def test_substitute_config_variables(mock_low_high_config, monkeypatch):
os.path.join("foo", "$platform", "bar")
) == os.path.abspath(os.path.join("foo", "test", "bar"))
host_target = spack.platforms.host().target("default_target")
host_target = spack.platforms.host().default_target()
host_target_family = str(host_target.family)
assert spack_path.canonicalize_path(
os.path.join("foo", "$target_family", "bar")

View File

@ -621,7 +621,7 @@ def linux_os():
platform = spack.platforms.host()
name, version = "debian", "6"
if platform.name == "linux":
current_os = platform.operating_system("default_os")
current_os = platform.default_operating_system()
name, version = current_os.name, current_os.version
LinuxOS = collections.namedtuple("LinuxOS", ["name", "version"])
return LinuxOS(name=name, version=version)
@ -680,7 +680,6 @@ def load_json():
def mock_targets(mock_uarch_configuration, monkeypatch):
"""Use this fixture to enable mock uarch targets for testing."""
targets_json, targets = mock_uarch_configuration
monkeypatch.setattr(archspec.cpu.schema, "TARGETS_JSON", targets_json)
monkeypatch.setattr(archspec.cpu.microarchitecture, "TARGETS", targets)

View File

@ -13,6 +13,8 @@
import pytest
import archspec.cpu
import spack
import spack.cmd
import spack.cmd.external
@ -98,11 +100,8 @@ def spec_json(self):
@pytest.fixture
def _common_arch(test_platform):
return JsonArchEntry(
platform=test_platform.name,
os=test_platform.front_os,
target=test_platform.target("fe").name,
)
generic = archspec.cpu.TARGETS[test_platform.default].family
return JsonArchEntry(platform=test_platform.name, os="redhat6", target=generic.name)
@pytest.fixture

View File

@ -319,7 +319,6 @@ def test_dependents_and_dependencies_are_correct(self):
("mpich@1.0", "mpileaks ^mpich@2.0"),
("mpich%gcc", "mpileaks ^mpich%intel"),
("mpich%gcc@4.6", "mpileaks ^mpich%gcc@4.5"),
("mpich platform=test target=be", "mpileaks ^mpich platform=test target=fe"),
],
)
def test_unsatisfiable_cases(self, set_dependency, constraint_str, spec_str):

View File

@ -460,7 +460,6 @@ def test_concrete_specs_which_satisfies_abstract(self, lhs, rhs, default_mock_co
("foo platform=linux", "platform=test os=redhat6 target=x86"),
("foo os=redhat6", "platform=test os=debian6 target=x86_64"),
("foo target=x86_64", "platform=test os=redhat6 target=x86"),
("foo arch=test-frontend-frontend", "platform=test os=frontend target=backend"),
("foo%intel", "%gcc"),
("foo%intel", "%gcc"),
("foo%gcc@4.3", "%gcc@4.4:4.6"),
@ -487,7 +486,6 @@ def test_concrete_specs_which_satisfies_abstract(self, lhs, rhs, default_mock_co
("libelf+debug", "libelf~debug"),
("libelf+debug~foo", "libelf+debug+foo"),
("libelf debug=True", "libelf debug=False"),
("libelf platform=test target=be os=be", "libelf target=fe os=fe"),
("namespace=builtin.mock", "namespace=builtin"),
],
)

View File

@ -306,7 +306,7 @@ def _specfile_for(spec_str, filename):
(
r"os=fe", # Various translations associated with the architecture
[Token(SpecTokens.KEY_VALUE_PAIR, value="os=fe")],
"arch=test-redhat6-None",
"arch=test-debian6-None",
),
(
r"os=default_os",
@ -999,14 +999,14 @@ def test_disambiguate_hash_by_spec(spec1, spec2, constraint, mock_packages, monk
("x arch=linux-rhel7-ppc64le arch=linux-rhel7-x86_64", "two architectures"),
("y ^x arch=linux-rhel7-x86_64 arch=linux-rhel7-x86_64", "two architectures"),
("y ^x arch=linux-rhel7-x86_64 arch=linux-rhel7-ppc64le", "two architectures"),
("x os=fe os=fe", "'os'"),
("x os=fe os=be", "'os'"),
("x target=fe target=fe", "'target'"),
("x target=fe target=be", "'target'"),
("x os=redhat6 os=debian6", "'os'"),
("x os=debian6 os=redhat6", "'os'"),
("x target=core2 target=x86_64", "'target'"),
("x target=x86_64 target=core2", "'target'"),
("x platform=test platform=test", "'platform'"),
# TODO: these two seem wrong: need to change how arch is initialized (should fail on os)
("x os=fe platform=test target=fe os=fe", "'platform'"),
("x target=be platform=test os=be os=fe", "'platform'"),
("x os=debian6 platform=test target=default_target os=redhat6", "two architectures"),
("x target=default_target platform=test os=redhat6 os=debian6", "'platform'"),
# Dependencies
("^[@foo] zlib", "edge attributes"),
("x ^[deptypes=link]foo ^[deptypes=run]foo", "conflicting dependency types"),

View File

@ -29,8 +29,8 @@ def architecture():
import spack.spec
host_platform = spack.platforms.host()
host_os = host_platform.operating_system("default_os")
host_target = host_platform.target("default_target")
host_os = host_platform.default_operating_system()
host_target = host_platform.default_target()
return spack.spec.ArchSpec((str(host_platform), str(host_os), str(host_target)))

View File

@ -506,9 +506,9 @@ complete -c spack -n '__fish_spack_using_command arch' -s o -l operating-system
complete -c spack -n '__fish_spack_using_command arch' -s t -l target -f -a target
complete -c spack -n '__fish_spack_using_command arch' -s t -l target -d 'print only the target'
complete -c spack -n '__fish_spack_using_command arch' -s f -l frontend -f -a frontend
complete -c spack -n '__fish_spack_using_command arch' -s f -l frontend -d 'print frontend'
complete -c spack -n '__fish_spack_using_command arch' -s f -l frontend -d 'print frontend (DEPRECATED)'
complete -c spack -n '__fish_spack_using_command arch' -s b -l backend -f -a backend
complete -c spack -n '__fish_spack_using_command arch' -s b -l backend -d 'print backend'
complete -c spack -n '__fish_spack_using_command arch' -s b -l backend -d 'print backend (DEPRECATED)'
# spack audit
set -g __fish_spack_optspecs_spack_audit h/help

View File

@ -500,18 +500,6 @@ def install(self, pkg, spec, prefix):
prefix_path = prefix.bin if "@:5.4.0" in spec else prefix
options = ["-prefix={0}".format(prefix_path)]
# This additional flag is needed anytime the target architecture
# does not match the host architecture, which results in a binary that
# configure cannot execute on the login node. This is how we detect
# cross compilation: If the platform is NOT either Linux or Darwin
# and the target=backend, that we are in the cross-compile scenario
# scenario. This should cover Cray, BG/Q, and other custom platforms.
# The other option is to list out all the platform where you would be
# cross compiling explicitly.
if not (spec.satisfies("platform=linux") or spec.satisfies("platform=darwin")):
if spec.satisfies("target=backend"):
options.append("--host")
# QE autoconf compiler variables has some limitations:
# 1. There is no explicit MPICC variable so we must re-purpose
# CC for the case of MPI.