Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 33 additions & 18 deletions scripts/spack/packages/axom/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,28 @@
"spin",
)

_AXOM_COMPONENT_REQUIREMENTS = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 'core' not included because everything depends on it?

Please double check this. It is inconsistent with the dependency figure in the Axom docs. For example, the diagram shows only that sina depends on core (not slic).

Also, how are optional dependencies handled here? For example quest optionally depends on sidre.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct -- core is always on, and cannot be turned off.
@bmhan12 -- A brief comment might help clarify this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list of requirements enables the minimal configuration of the user's requested components.
E.g. if they ask for inlet via component=inlet they will also get sidre since inlet requires sidre.

If they want more than the minimum, e.g. inlet and spin (and their hard dependencies), they can ask for components=inlet,spin.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A brief comment might help clarify this.

Looks like a comment was already added above that section, where the components are listed out:

# Axom components we expose to Spack. Core is always built and is not listed here.
_AXOM_COMPONENTS = (

"bump": ("sidre", "slic", "spin", "primal"),
"inlet": ("sidre", "slic", "primal"),
"klee": ("sidre", "slic", "inlet", "primal"),
"mint": ("slic", "slam"),
"mir": ("bump", "sidre", "slic", "slam", "primal"),
"multimat": ("slic", "slam"),
"primal": ("slic",),
"quest": ("slic", "slam", "primal", "mint", "spin"),
"sidre": ("slic",),
"sina": ("slic",),
"slam": ("slic",),
"spin": ("slic", "slam", "primal"),
}

_AXOM_COMPONENT_VALUES = tuple(
conditional(component, when=f"components={','.join(_AXOM_COMPONENT_REQUIREMENTS[component])}")
if component in _AXOM_COMPONENT_REQUIREMENTS
else component
for component in _AXOM_COMPONENTS
)


def get_spec_path(spec, package_name, path_replacements={}, use_bin=False, use_lib=False):
"""Extracts the prefix path for the given spack package
Expand Down Expand Up @@ -77,6 +99,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):

version("main", branch="main")
version("develop", branch="develop")
version("0.15.0", tag="v0.15.0", commit="da2a50a7ee661896400d49b019e17bbe7ab5bd44")
version("0.14.0", tag="v0.14.0", commit="146c8c15386a810791b7ab5c7fcb288cadea6151")
version("0.13.0", tag="v0.13.0", commit="d00f6c66ef390ad746ae840f1074d982513611ac")
version("0.12.0", tag="v0.12.0", commit="297544010a3dfb98145a1a85f09f9c648c00a18c")
Expand Down Expand Up @@ -145,7 +168,12 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):
"Missing dependencies will be added (e.g. we'll add `sidre` "
"and `conduit` for `components=inlet`)"
),
values=any_combination_of("all", *_AXOM_COMPONENTS).with_default("all"),
# "all" is a sentinel and must not be combined with individual components.
# Keeping it in the same value set causes an additive request such as
# components=sina to retain the default "all" on Spack 1.2 and newer.
values=(
disjoint_sets(("all",), _AXOM_COMPONENT_VALUES).allow_empty_set().with_default("all")
),
)

variant("int64", default=True, description="Use 64bit integers for IndexType")
Expand Down Expand Up @@ -330,27 +358,12 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):
# -----------------------------------------------------------------------
# Component requirements
# -----------------------------------------------------------------------
# Hard inter-component dependencies taken from Axom's dependency graph.
requires(f"components={','.join(_AXOM_COMPONENTS)}", when="components=all")

requires("components=sidre,slic,spin,primal", when="components=bump")
requires("components=sidre,slic,primal", when="components=inlet")
requires("components=sidre,slic,inlet,primal", when="components=klee")
requires("components=slic,slam", when="components=mint")
requires("components=bump,sidre,slic,slam,primal", when="components=mir")
requires("components=slic,slam", when="components=multimat")
requires("components=slic", when="components=primal")
requires("components=slic,slam,primal,mint,spin", when="components=quest")
requires("components=slic", when="components=sidre")
requires("components=slic", when="components=sina")
requires("components=slic", when="components=slam")
requires("components=slic,slam,primal", when="components=spin")

# Hard dependencies of Axom components on other packages
requires("+conduit", when="components=bump")
requires("+conduit", when="components=mir")
requires("+conduit", when="components=sidre")
requires("+conduit", when="components=sina")
requires("+conduit", when="components=all")

# -----------------------------------------------------------------------
# Conflicts
Expand Down Expand Up @@ -675,7 +688,7 @@ def initconfig_package_entries(self):
entries = []
path_replacements = {}

all_components_enabled = all(
all_components_enabled = spec.satisfies("components=all") or all(
spec.satisfies(f"components={comp}") for comp in _AXOM_COMPONENTS
)

Expand Down Expand Up @@ -914,6 +927,7 @@ def test_install_using_make(self):
example()
make("clean")

@run_after("install", when="+examples+python+tools components=all")
@run_after("install", when="+examples+python+tools components=sidre")
@on_package_attributes(run_tests=True)
def test_install_using_python(self):
Expand All @@ -927,6 +941,7 @@ def test_install_using_python(self):
run_python = Executable(python_runner)
run_python(example)

@run_after("install", when="+python components=all")
@run_after("install", when="+python components=sidre")
@on_package_attributes(run_tests=True)
def test_axom_sidre_installed_into_site_packages(self):
Expand Down