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
@ -17,12 +17,13 @@
|
|||||||
import types
|
import types
|
||||||
from six import string_types
|
from six import string_types
|
||||||
|
|
||||||
|
import archspec.cpu
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import clingo
|
import clingo
|
||||||
except ImportError:
|
except ImportError:
|
||||||
clingo = None
|
clingo = None
|
||||||
|
|
||||||
import llnl.util.cpu
|
|
||||||
import llnl.util.lang
|
import llnl.util.lang
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
import llnl.util.tty.color as color
|
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')
|
key_fn = spack.package_prefs.PackagePrefs(pkg_name, 'target')
|
||||||
target_specs = [
|
target_specs = [
|
||||||
spack.spec.Spec('target={0}'.format(target_name))
|
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]
|
preferred_targets = [x for x in target_specs if key_fn(x) < 0]
|
||||||
if not preferred_targets:
|
if not preferred_targets:
|
||||||
@ -1218,7 +1219,7 @@ def _supported_targets(self, compiler, targets):
|
|||||||
try:
|
try:
|
||||||
target.optimization_flags(compiler.name, compiler.version)
|
target.optimization_flags(compiler.name, compiler.version)
|
||||||
supported.append(target)
|
supported.append(target)
|
||||||
except llnl.util.cpu.UnsupportedMicroarchitecture:
|
except archspec.cpu.UnsupportedMicroarchitecture:
|
||||||
continue
|
continue
|
||||||
except ValueError:
|
except ValueError:
|
||||||
continue
|
continue
|
||||||
@ -1253,7 +1254,7 @@ def target_defaults(self, specs):
|
|||||||
self.gen.h2('Default target')
|
self.gen.h2('Default target')
|
||||||
|
|
||||||
platform = spack.architecture.platform()
|
platform = spack.architecture.platform()
|
||||||
uarch = llnl.util.cpu.targets.get(platform.default)
|
uarch = archspec.cpu.TARGETS.get(platform.default)
|
||||||
|
|
||||||
self.gen.h2('Target compatibility')
|
self.gen.h2('Target compatibility')
|
||||||
|
|
||||||
@ -1284,7 +1285,7 @@ def target_defaults(self, specs):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
print("TTYPE:", type(platform.target(spec.target.name)))
|
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:
|
if not target:
|
||||||
raise ValueError("Invalid target: ", spec.target.name)
|
raise ValueError("Invalid target: ", spec.target.name)
|
||||||
if target not in compatible_targets:
|
if target not in compatible_targets:
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
import py
|
import py
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import llnl.util.cpu.microarchitecture
|
import archspec.cpu.microarchitecture
|
||||||
import llnl.util.cpu.schema
|
import archspec.cpu.schema
|
||||||
from llnl.util.filesystem import mkdirp, remove_linked_tree
|
from llnl.util.filesystem import mkdirp, remove_linked_tree
|
||||||
|
|
||||||
import spack.architecture
|
import spack.architecture
|
||||||
@ -464,14 +464,14 @@ def mock_uarch_json(tmpdir_factory):
|
|||||||
|
|
||||||
@pytest.fixture(scope='session')
|
@pytest.fixture(scope='session')
|
||||||
def mock_uarch_configuration(mock_uarch_json):
|
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():
|
def load_json():
|
||||||
with open(mock_uarch_json) as f:
|
with open(mock_uarch_json) as f:
|
||||||
return json.load(f)
|
return json.load(f)
|
||||||
|
|
||||||
targets_json = llnl.util.cpu.schema.LazyDictionary(load_json)
|
targets_json = archspec.cpu.schema.LazyDictionary(load_json)
|
||||||
targets = llnl.util.cpu.microarchitecture.LazyDictionary(
|
targets = archspec.cpu.microarchitecture.LazyDictionary(
|
||||||
llnl.util.cpu.microarchitecture._known_microarchitectures)
|
archspec.cpu.microarchitecture._known_microarchitectures)
|
||||||
|
|
||||||
yield targets_json, targets
|
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."""
|
"""Use this fixture to enable mock uarch targets for testing."""
|
||||||
targets_json, targets = mock_uarch_configuration
|
targets_json, targets = mock_uarch_configuration
|
||||||
|
|
||||||
monkeypatch.setattr(llnl.util.cpu.schema, "targets_json", targets_json)
|
monkeypatch.setattr(archspec.cpu.schema, "TARGETS_JSON", targets_json)
|
||||||
monkeypatch.setattr(llnl.util.cpu.microarchitecture, "targets", targets)
|
monkeypatch.setattr(archspec.cpu.microarchitecture, "TARGETS", targets)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='session')
|
@pytest.fixture(scope='session')
|
||||||
|
Loading…
Reference in New Issue
Block a user