Skip to content

Commit

Permalink
Update compadre and py-pycompadre to v1.6.0 (spack#47948)
Browse files Browse the repository at this point in the history
* compadre: add version 1.6.0
* py-pycompadre: add version 1.6.0
  • Loading branch information
kuberry authored and tdrwenski committed Dec 26, 2024
1 parent d64f0d9 commit e01c593
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 13 deletions.
32 changes: 30 additions & 2 deletions var/spack/repos/builtin/packages/compadre/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Compadre(CMakePackage):
maintainers("kuberry")

version("master", branch="master")
version("1.6.0", sha256="5d937f85c2e64b50955beab1ac9f1083162f5239a5f13a40ef9a9c0e6ad216c9")
version("1.5.0", sha256="b7dd6020cc5a7969de817d5c7f6c5acceaad0f08dcfd3d7cacfa9f42e4c8b335")
version("1.4.1", sha256="2e1e7d8e30953f76b6dc3a4c86ec8103d4b29447194cb5d5abb74b8e4099bdd9")
version("1.3.0", sha256="f711a840fd921e84660451ded408023ec3bcfc98fd0a7dc4a299bfae6ab489c2")
Expand All @@ -29,8 +30,19 @@ class Compadre(CMakePackage):
depends_on("cxx", type="build") # generated
depends_on("fortran", type="build") # generated

depends_on("[email protected]:4")
depends_on("[email protected]:", type="build")
variant(
"debug",
default="0",
values=["0", "1", "2"],
multi=False,
description="Debugging level 0) release 1) debug 2) extreme debugging",
)

depends_on("[email protected]:", type="build", when="@:1.4")
depends_on("[email protected]:", type="build", when="@1.5:")

depends_on("[email protected]:4", when="@:1.5")
depends_on("kokkos-kernels@4:", when="@1.6:")

variant("mpi", default=False, description="Enable MPI support")
depends_on("mpi", when="+mpi")
Expand All @@ -56,9 +68,25 @@ def cmake_args(self):
"-DKokkosCore_PREFIX={0}".format(kokkos.prefix),
"-DKokkosKernels_PREFIX={0}".format(kokkos_kernels.prefix),
"-DCMAKE_CXX_COMPILER:STRING={0}".format(spec["kokkos"].kokkos_cxx),
# Compadre_USE_PYTHON is OFF by default
"-DCompadre_USE_PYTHON=OFF",
]
)

if spec.variants["debug"].value == "0":
if spec.satisfies("^kokkos~cuda"):
options.append(
"-DCMAKE_CXX_FLAGS:STRING=%s"
% "' -Ofast -funroll-loops -march=native -mtune=native '"
)
options.append("-DCompadre_DEBUG:BOOL=OFF")
else:
options.append("-DCMAKE_CXX_FLAGS:STRING='-g -O0'")
options.append("-DCMAKE_BUILD_TYPE:STRING=DEBUG")
options.append("-DCompadre_DEBUG:BOOL=ON")
if spec.variants["debug"].value == "2":
options.append("-DCompadre_EXTREME_DEBUG:BOOL=ON")

if spec.satisfies("+mpi"):
options.append("-DCompadre_USE_MPI:BOOL=ON")

Expand Down
37 changes: 26 additions & 11 deletions var/spack/repos/builtin/packages/py-pycompadre/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@ class PyPycompadre(PythonPackage):
constitute the rows of some globally sparse matrix.
"""

homepage = "https://github.com/SNLComputation/compadre"
git = "https://github.com/SNLComputation/compadre.git"
url = "https://github.com/SNLComputation/compadre/archive/v1.3.0.tar.gz"
homepage = "https://github.com/sandialabs/compadre"
git = "https://github.com/sandialabs/compadre.git"
url = "https://github.com/sandialabs/compadre/archive/v1.3.0.tar.gz"
maintainers("kuberry")

version("master", branch="master", preferred=True)
version("master", branch="master")
version("1.6.0", sha256="5d937f85c2e64b50955beab1ac9f1083162f5239a5f13a40ef9a9c0e6ad216c9")
version("1.5.0", sha256="b7dd6020cc5a7969de817d5c7f6c5acceaad0f08dcfd3d7cacfa9f42e4c8b335")
version("1.4.1", sha256="2e1e7d8e30953f76b6dc3a4c86ec8103d4b29447194cb5d5abb74b8e4099bdd9")
version("1.3.0", sha256="f711a840fd921e84660451ded408023ec3bcfc98fd0a7dc4a299bfae6ab489c2")

depends_on("c", type="build") # generated
depends_on("cxx", type="build") # generated
depends_on("fortran", type="build") # generated

variant("trilinos", default=False, description="Use Kokkos from Trilinos")
variant(
"debug",
default="0",
Expand All @@ -35,19 +38,31 @@ class PyPycompadre(PythonPackage):
description="Debugging level 0) release 1) debug 2) extreme debugging",
)

depends_on("[email protected]:", type="build")
depends_on("[email protected]:", type=("build", "link", "run"))
depends_on("py-pip", type=("build", "link", "run"))
depends_on("[email protected]:", type="build", when="@:1.4")
depends_on("[email protected]:", type="build", when="@1.5:")

depends_on("[email protected]:4", when="@:1.5")
depends_on("kokkos-kernels@4:", when="@1.6:")

depends_on("[email protected]:", type=("build", "link", "run"), when="@:1.5")
depends_on("[email protected]:", type=("build", "link", "run"), when="@1.6:")
depends_on("py-setuptools", type="build")
depends_on("[email protected]:", type="build")
depends_on("[email protected]:", when="+trilinos")

# fixes duplicate symbol issue with static library build
patch(
"https://patch-diff.githubusercontent.com/raw/sandialabs/Compadre/pull/286.patch?full_index=1",
sha256="e267b74f8ecb8dd23970848ed919d29b7d442f619ce80983e02a19f1d9582c61",
when="@1.5.0",
)

@run_before("install")
def set_cmake_from_variants(self):
spec = self.spec
with open("cmake_opts.txt", "w") as f:
if "+trilinos" in spec:
f.write("Trilinos_PREFIX:PATH=%s\n" % spec["trilinos"].prefix)
f.write("KokkosCore_PREFIX:PATH=%s\n" % spec["kokkos"].prefix)
f.write("KokkosKernels_PREFIX:PATH=%s\n" % spec["kokkos-kernels"].prefix)
f.write("CMAKE_CXX_COMPILER:STRING={0}\n".format(spec["kokkos"].kokkos_cxx))
if spec.variants["debug"].value == "0":
f.write(
"CMAKE_CXX_FLAGS:STRING=%s\n"
Expand Down

0 comments on commit e01c593

Please sign in to comment.