Skip to content

Commit

Permalink
Specs from other architectures or platforms are not reusable
Browse files Browse the repository at this point in the history
  • Loading branch information
alalazo committed Mar 19, 2024
1 parent 6b591a3 commit 06c0c69
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion lib/spack/spack/solver/asp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2429,7 +2429,7 @@ def visit(node):
arg = ast_sym(ast_sym(term.atom).arguments[0])
symbol = AspFunction(name)(arg.string)
self.assumptions.append((parse_term(str(symbol)), True))
self.gen.asp_problem.append(f"{{ {symbol} }}.\n")
self.gen.asp_problem.append(f"{symbol}.\n")

path = os.path.join(parent_dir, "concretize.lp")
parse_files([path], visit)
Expand Down Expand Up @@ -3317,6 +3317,13 @@ def _is_reusable(spec: spack.spec.Spec, packages, local: bool) -> bool:
if "dev_path" in spec.variants:
return False

current_platform = spack.platforms.host()
if not spec.satisfies(f"platform={current_platform}"):
return False

if spec.target.family != archspec.cpu.host().family:
return False

if not spec.external:
return True

Expand Down
4 changes: 2 additions & 2 deletions lib/spack/spack/test/concretize.py
Original file line number Diff line number Diff line change
Expand Up @@ -2532,7 +2532,7 @@ def test_virtuals_provided_together_but_only_one_required_in_dag(self):


def test_reusable_externals_match(mock_packages, tmpdir):
spec = Spec("mpich@4.1%gcc@13.1.0~debug build_system=generic arch=linux-ubuntu23.04-zen2")
spec = Spec("mpich@4.1%gcc@13.1.0~debug build_system=generic arch=test-ubuntu23.04-zen2")
spec.external_path = tmpdir.strpath
spec.external_modules = ["mpich/4.1"]
spec._mark_concrete()
Expand All @@ -2550,7 +2550,7 @@ def test_reusable_externals_match(mock_packages, tmpdir):


def test_reusable_externals_match_virtual(mock_packages, tmpdir):
spec = Spec("mpich@4.1%gcc@13.1.0~debug build_system=generic arch=linux-ubuntu23.04-zen2")
spec = Spec("mpich@4.1%gcc@13.1.0~debug build_system=generic arch=test-ubuntu23.04-zen2")
spec.external_path = tmpdir.strpath
spec.external_modules = ["mpich/4.1"]
spec._mark_concrete()
Expand Down

0 comments on commit 06c0c69

Please sign in to comment.