forked from spack/spack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trilinos: catch kokkos inconsistency with trilinos (spack#44209)
* trilinos: catch kokkos inconsistency with trilinos * trilinos: update kokkos version range
- Loading branch information
Showing
1 changed file
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
import os | ||
import pathlib | ||
import re | ||
import sys | ||
|
||
from spack.build_environment import dso_suffix | ||
|
@@ -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") | ||
|
||
|
@@ -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 | ||
|