Compare commits

..

2 Commits

Author SHA1 Message Date
Wouter Deconinck
2eadde1c97 alpgen: point url to archive.org and deprecate 2025-01-05 12:35:58 -06:00
Tim Fuller
8d5ece07d1 Update openmpi/package.py to allow for non-standard cxx name (#48168)
Allows user to define an alternative name for `mpic++` in `packages:openmpi:package_attributes:cxxname`.
2025-01-05 03:22:57 -07:00
3 changed files with 39 additions and 23 deletions

View File

@@ -265,6 +265,11 @@ def specify(spec):
return spack.spec.Spec(spec)
def remove_node(spec: spack.spec.Spec, facts: List[AspFunction]) -> List[AspFunction]:
"""Transformation that removes all "node" and "virtual_node" from the input list of facts."""
return list(filter(lambda x: x.args[0] not in ("node", "virtual_node"), facts))
def _create_counter(specs: List[spack.spec.Spec], tests: bool):
strategy = spack.config.CONFIG.get("concretizer:duplicates:strategy", "none")
if strategy == "full":
@@ -1516,7 +1521,6 @@ def _get_condition_id(
return result[0]
cond_id = next(self._id_counter)
requirements = self.spec_clauses(named_cond, body=body, context=context)
if context.transform:
requirements = context.transform(named_cond, requirements)
@@ -1555,6 +1559,7 @@ def condition(
if not context:
context = ConditionContext()
context.transform_imposed = remove_node
if imposed_spec:
imposed_name = imposed_spec.name or imposed_name
@@ -1589,6 +1594,14 @@ def condition(
return condition_id
def impose(self, condition_id, imposed_spec, node=True, body=False):
imposed_constraints = self.spec_clauses(imposed_spec, body=body)
for pred in imposed_constraints:
# imposed "node"-like conditions are no-ops
if not node and pred.args[0] in ("node", "virtual_node"):
continue
self.gen.fact(fn.imposed_constraint(condition_id, *pred.args))
def package_provider_rules(self, pkg):
for vpkg_name in pkg.provided_virtual_names():
if vpkg_name not in self.possible_virtuals:
@@ -1646,7 +1659,7 @@ def track_dependencies(input_spec, requirements):
return requirements + [fn.attr("track_dependencies", input_spec.name)]
def dependency_holds(input_spec, requirements):
return requirements + [
return remove_node(input_spec, requirements) + [
fn.attr(
"dependency_holds", pkg.name, input_spec.name, dt.flag_to_string(t)
)
@@ -1704,13 +1717,13 @@ def package_splice_rules(self, pkg):
splice_node = fn.node(AspVar("NID"), cond.name)
when_spec_attrs = [
fn.attr(c.args[0], splice_node, *(c.args[2:]))
for c in self.spec_clauses(cond, body=True, required_from=None, node=False)
for c in self.spec_clauses(cond, body=True, required_from=None)
if c.args[0] != "node"
]
splice_spec_hash_attrs = [
fn.hash_attr(hash_var, *(c.args))
for c in self.spec_clauses(
spec_to_splice, body=True, required_from=None, node=False
)
for c in self.spec_clauses(spec_to_splice, body=True, required_from=None)
if c.args[0] != "node"
]
if match_variants is None:
variant_constraints = []
@@ -1832,6 +1845,10 @@ def emit_facts_from_requirement_rules(self, rules: List[RequirementRule]):
context.source = ConstraintOrigin.append_type_suffix(
pkg_name, ConstraintOrigin.REQUIRE
)
if not virtual:
context.transform_imposed = remove_node
# else: for virtuals we want to emit "node" and
# "virtual_node" in imposed specs
member_id = self.condition(
required_spec=when_spec,
@@ -2005,7 +2022,6 @@ def spec_clauses(
self,
spec: spack.spec.Spec,
*,
node: bool = True,
body: bool = False,
transitive: bool = True,
expand_hashes: bool = False,
@@ -2023,7 +2039,6 @@ def spec_clauses(
try:
clauses = self._spec_clauses(
spec,
node=node,
body=body,
transitive=transitive,
expand_hashes=expand_hashes,
@@ -2041,7 +2056,6 @@ def _spec_clauses(
self,
spec: spack.spec.Spec,
*,
node: bool = True,
body: bool = False,
transitive: bool = True,
expand_hashes: bool = False,
@@ -2052,7 +2066,6 @@ def _spec_clauses(
Arguments:
spec: the spec to analyze
node: if True, emit node(PackageName, ...) and virtual_node(PackageaName, ...) facts
body: if True, generate clauses to be used in rule bodies (final values) instead
of rule heads (setters).
transitive: if False, don't generate clauses from dependencies (default True)
@@ -2072,10 +2085,8 @@ def _spec_clauses(
f: Union[Type[_Head], Type[_Body]] = _Body if body else _Head
# only generate this if caller asked for node facts -- not needed for most conditions
if node and spec.name:
if spec.name:
clauses.append(f.node(spec.name) if not spec.virtual else f.virtual_node(spec.name))
if spec.namespace:
clauses.append(f.namespace(spec.name, spec.namespace))
@@ -2233,7 +2244,6 @@ def _spec_clauses(
clauses.extend(
self._spec_clauses(
dep,
node=node,
body=body,
expand_hashes=expand_hashes,
concrete_build_deps=concrete_build_deps,
@@ -2618,7 +2628,7 @@ def concrete_specs(self):
# this indicates that there is a spec like this installed
self.gen.fact(fn.installed_hash(spec.name, h))
# indirection layer between hash constraints and imposition to allow for splicing
for pred in self.spec_clauses(spec, body=True, required_from=None, node=False):
for pred in self.spec_clauses(spec, body=True, required_from=None):
self.gen.fact(fn.hash_attr(h, *pred.args))
self.gen.newline()
# Declare as possible parts of specs that are not in package.py
@@ -3228,7 +3238,7 @@ def depends_on(
node_variable = "node(ID, Package)"
when_spec.name = placeholder
body_clauses = self._setup.spec_clauses(when_spec, body=True, node=False)
body_clauses = self._setup.spec_clauses(when_spec, body=True)
body_str = (
f" {f',{os.linesep} '.join(str(x) for x in body_clauses)},\n"
f" not external({node_variable}),\n"
@@ -3316,7 +3326,7 @@ def propagate(self, constraint_str: str, *, when: str):
node_variable = "node(ID, Package)"
when_spec.name = placeholder
body_clauses = self._setup.spec_clauses(when_spec, body=True, node=False)
body_clauses = self._setup.spec_clauses(when_spec, body=True)
body_str = (
f" {f',{os.linesep} '.join(str(x) for x in body_clauses)},\n"
f" not external({node_variable}),\n"
@@ -3327,7 +3337,7 @@ def propagate(self, constraint_str: str, *, when: str):
assert constraint_spec.name is None, "only anonymous constraint specs are accepted"
constraint_spec.name = placeholder
constraint_clauses = self._setup.spec_clauses(constraint_spec, body=False, node=False)
constraint_clauses = self._setup.spec_clauses(constraint_spec, body=False)
for clause in constraint_clauses:
if clause.args[0] == "node_compiler_version_satisfies":
self._setup.compiler_version_constraints.add(constraint_spec.compiler)

View File

@@ -12,12 +12,17 @@ class Alpgen(CMakePackage, MakefilePackage):
in hadronic collisions.
"""
homepage = "http://mlm.home.cern.ch/mlm/alpgen/"
url = "http://mlm.home.cern.ch/mlm/alpgen/V2.1/v214.tgz"
homepage = "https://web.archive.org/web/20171017025050/http://mlm.home.cern.ch/mlm/alpgen/"
url = "https://web.archive.org/web/20171017025050/http://mlm.home.cern.ch/mlm/alpgen/V2.1/v214.tgz"
tags = ["hep"]
version("2.1.4", sha256="2f43f7f526793fe5f81a3a3e1adeffe21b653a7f5851efc599ed69ea13985c5e")
# Deprecated since not available outside of archive.org
version(
"2.1.4",
sha256="2f43f7f526793fe5f81a3a3e1adeffe21b653a7f5851efc599ed69ea13985c5e",
deprecated=True,
)
build_system("makefile", "cmake", default="makefile")

View File

@@ -32,6 +32,7 @@ class Openmpi(AutotoolsPackage, CudaPackage):
url = "https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.0.tar.bz2"
list_url = "https://www.open-mpi.org/software/ompi/"
git = "https://github.com/open-mpi/ompi.git"
cxxname = "mpic++"
maintainers("hppritcha", "naughtont3")
@@ -885,7 +886,7 @@ def setup_run_environment(self, env):
# Because MPI is both a runtime and a compiler, we have to setup the
# compiler components as part of the run environment.
env.set("MPICC", join_path(self.prefix.bin, "mpicc"))
env.set("MPICXX", join_path(self.prefix.bin, "mpic++"))
env.set("MPICXX", join_path(self.prefix.bin, self.cxxname))
env.set("MPIF77", join_path(self.prefix.bin, "mpif77"))
env.set("MPIF90", join_path(self.prefix.bin, "mpif90"))
# Open MPI also has had mpifort since v1.7, so we can set MPIFC to that
@@ -927,7 +928,7 @@ def setup_dependent_build_environment(self, env, dependent_spec):
def setup_dependent_package(self, module, dependent_spec):
self.spec.mpicc = join_path(self.prefix.bin, "mpicc")
self.spec.mpicxx = join_path(self.prefix.bin, "mpic++")
self.spec.mpicxx = join_path(self.prefix.bin, self.cxxname)
self.spec.mpifc = join_path(self.prefix.bin, "mpif90")
self.spec.mpif77 = join_path(self.prefix.bin, "mpif77")