Skip to content

Commit

Permalink
trilinos: catch kokkos inconsistency with trilinos (spack#44209)
Browse files Browse the repository at this point in the history
* trilinos: catch kokkos inconsistency with trilinos

* trilinos: update kokkos version range
  • Loading branch information
kuberry authored May 16, 2024
1 parent 1ce0984 commit b894f99
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion var/spack/repos/builtin/packages/trilinos/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import os
import pathlib
import re
import sys

from spack.build_environment import dso_suffix
Expand Down Expand Up @@ -400,7 +401,7 @@ class Trilinos(CMakePackage, CudaPackage, ROCmPackage):
# ###################### Dependencies ##########################

# External Kokkos
depends_on("[email protected].00", when="@master: +kokkos")
depends_on("[email protected].01", when="@master: +kokkos")
depends_on("[email protected]", when="@15.1.0:15.1.1 +kokkos")
depends_on("[email protected]", when="@14.4.0:15.0.0 +kokkos")

Expand Down Expand Up @@ -605,6 +606,30 @@ def cmake_args(self):
define = self.define
define_from_variant = self.define_from_variant

if self.spec.satisfies("@master: +kokkos"):
with open(
os.path.join(self.stage.source_path, "packages", "kokkos", "CMakeLists.txt")
) as f:
all_txt = f.read()
r = dict(
re.findall(r".*set\s?\(\s?Kokkos_VERSION_(MAJOR|MINOR|PATCH)\s?(\d+)", all_txt)
)
kokkos_version_in_trilinos_source = Version(
".".join([r["MAJOR"], r["MINOR"], r["PATCH"].zfill(2)])
)
kokkos_version_specified = spec["kokkos"].version
if kokkos_version_in_trilinos_source != kokkos_version_specified:
raise InstallError(
"For Trilinos@[master,develop], ^kokkos version in spec must "
"match version in Trilinos source code. Specify ^kokkos@{0} ".format(
kokkos_version_in_trilinos_source
)
+ "for trilinos@[master,develop] instead of ^kokkos@{0}.\n".format(
kokkos_version_specified
)
+ "Trilinos recipe maintainers, please update the ^kokkos version range"
)

def _make_definer(prefix):
def define_enable(suffix, value=None):
key = prefix + suffix
Expand Down

0 comments on commit b894f99

Please sign in to comment.