Fixed branch after rebase (port to archspec)
TODO: Investigate the need to remove memoization on Spec.patches (infinite recursion when testing `__contains__`)
This commit is contained in:
parent
930b05fab4
commit
27bb970a97
2 changed files with 14 additions and 13 deletions
|
@ -17,12 +17,13 @@
|
|||
import types
|
||||
from six import string_types
|
||||
|
||||
import archspec.cpu
|
||||
|
||||
try:
|
||||
import clingo
|
||||
except ImportError:
|
||||
clingo = None
|
||||
|
||||
import llnl.util.cpu
|
||||
import llnl.util.lang
|
||||
import llnl.util.tty as tty
|
||||
import llnl.util.tty.color as color
|
||||
|
@ -1068,7 +1069,7 @@ def preferred_targets(self, pkg_name):
|
|||
key_fn = spack.package_prefs.PackagePrefs(pkg_name, 'target')
|
||||
target_specs = [
|
||||
spack.spec.Spec('target={0}'.format(target_name))
|
||||
for target_name in llnl.util.cpu.targets
|
||||
for target_name in archspec.cpu.TARGETS
|
||||
]
|
||||
preferred_targets = [x for x in target_specs if key_fn(x) < 0]
|
||||
if not preferred_targets:
|
||||
|
@ -1218,7 +1219,7 @@ def _supported_targets(self, compiler, targets):
|
|||
try:
|
||||
target.optimization_flags(compiler.name, compiler.version)
|
||||
supported.append(target)
|
||||
except llnl.util.cpu.UnsupportedMicroarchitecture:
|
||||
except archspec.cpu.UnsupportedMicroarchitecture:
|
||||
continue
|
||||
except ValueError:
|
||||
continue
|
||||
|
@ -1253,7 +1254,7 @@ def target_defaults(self, specs):
|
|||
self.gen.h2('Default target')
|
||||
|
||||
platform = spack.architecture.platform()
|
||||
uarch = llnl.util.cpu.targets.get(platform.default)
|
||||
uarch = archspec.cpu.TARGETS.get(platform.default)
|
||||
|
||||
self.gen.h2('Target compatibility')
|
||||
|
||||
|
@ -1284,7 +1285,7 @@ def target_defaults(self, specs):
|
|||
continue
|
||||
|
||||
print("TTYPE:", type(platform.target(spec.target.name)))
|
||||
target = llnl.util.cpu.targets.get(spec.target.name)
|
||||
target = archspec.cpu.TARGETS.get(spec.target.name)
|
||||
if not target:
|
||||
raise ValueError("Invalid target: ", spec.target.name)
|
||||
if target not in compatible_targets:
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
import py
|
||||
import pytest
|
||||
|
||||
import llnl.util.cpu.microarchitecture
|
||||
import llnl.util.cpu.schema
|
||||
import archspec.cpu.microarchitecture
|
||||
import archspec.cpu.schema
|
||||
from llnl.util.filesystem import mkdirp, remove_linked_tree
|
||||
|
||||
import spack.architecture
|
||||
|
@ -464,14 +464,14 @@ def mock_uarch_json(tmpdir_factory):
|
|||
|
||||
@pytest.fixture(scope='session')
|
||||
def mock_uarch_configuration(mock_uarch_json):
|
||||
"""Create mock dictionaries for the llnl.util.cpu."""
|
||||
"""Create mock dictionaries for the archspec.cpu."""
|
||||
def load_json():
|
||||
with open(mock_uarch_json) as f:
|
||||
return json.load(f)
|
||||
|
||||
targets_json = llnl.util.cpu.schema.LazyDictionary(load_json)
|
||||
targets = llnl.util.cpu.microarchitecture.LazyDictionary(
|
||||
llnl.util.cpu.microarchitecture._known_microarchitectures)
|
||||
targets_json = archspec.cpu.schema.LazyDictionary(load_json)
|
||||
targets = archspec.cpu.microarchitecture.LazyDictionary(
|
||||
archspec.cpu.microarchitecture._known_microarchitectures)
|
||||
|
||||
yield targets_json, targets
|
||||
|
||||
|
@ -481,8 +481,8 @@ 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(llnl.util.cpu.schema, "targets_json", targets_json)
|
||||
monkeypatch.setattr(llnl.util.cpu.microarchitecture, "targets", targets)
|
||||
monkeypatch.setattr(archspec.cpu.schema, "TARGETS_JSON", targets_json)
|
||||
monkeypatch.setattr(archspec.cpu.microarchitecture, "TARGETS", targets)
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
|
|
Loading…
Reference in a new issue