Skip to content

Commit e337623

Browse files
committed
xpetra: update ArithTraits namespace for KOKKOS_VERSION > 40799
Compatibility update corresponding to kokkos/kokkos-kernels#2771 Signed-off-by: Nathan Ellingwood <ndellin@sandia.gov>
1 parent 1869d11 commit e337623

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

packages/xpetra/src/CrsMatrix/Xpetra_CrsMatrix.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,11 @@ class CrsMatrix
273273
//! @name Xpetra-specific routines
274274
//@{
275275
#ifdef HAVE_XPETRA_TPETRA
276+
#if KOKKOS_VERSION > 40799
277+
using impl_scalar_type = typename KokkosKernels::ArithTraits<Scalar>::val_type;
278+
#else
276279
using impl_scalar_type = typename Kokkos::ArithTraits<Scalar>::val_type;
280+
#endif
277281
using execution_space = typename node_type::device_type;
278282

279283
// that is the local_graph_type in Tpetra::CrsGraph...

packages/xpetra/src/MultiVector/Xpetra_MultiVector_decl.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323

2424
#include <Kokkos_Core.hpp>
2525
#include <Kokkos_DualView.hpp>
26+
#if KOKKOS_VERSION > 40799
27+
#include <KokkosKernels_ArithTraits.hpp>
28+
#else
2629
#include <Kokkos_ArithTraits.hpp>
30+
#endif
2731

2832
namespace Xpetra {
2933

@@ -231,7 +235,11 @@ class MultiVector
231235
//! Set multi-vector values to random numbers. XPetra implementation
232236
virtual void Xpetra_randomize(const Scalar& minVal, const Scalar& maxVal);
233237

238+
#if KOKKOS_VERSION > 40799
239+
using impl_scalar_type = typename KokkosKernels::ArithTraits<Scalar>::val_type;
240+
#else
234241
using impl_scalar_type = typename Kokkos::ArithTraits<Scalar>::val_type;
242+
#endif
235243
using dual_view_type = Kokkos::DualView<impl_scalar_type**, Kokkos::LayoutStride, typename node_type::device_type, Kokkos::MemoryUnmanaged>;
236244
using dual_view_type_const = Kokkos::DualView<const impl_scalar_type**, Kokkos::LayoutStride, typename node_type::device_type, Kokkos::MemoryUnmanaged>;
237245
using host_execution_space = typename dual_view_type::host_mirror_space;

packages/xpetra/src/Utils/Xpetra_MatrixUtils_def.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,16 @@ void MatrixUtils<Scalar, LocalOrdinal, GlobalOrdinal, Node>::CheckRepairMainDiag
421421

422422
auto lclA = tpCrsAc->getTpetra_CrsMatrix()->getLocalMatrixDevice();
423423

424+
#if KOKKOS_VERSION > 40799
425+
using ATS = KokkosKernels::ArithTraits<Scalar>;
426+
#else
424427
using ATS = Kokkos::ArithTraits<Scalar>;
428+
#endif
429+
#if KOKKOS_VERSION > 40799
430+
using impl_ATS = KokkosKernels::ArithTraits<typename ATS::val_type>;
431+
#else
425432
using impl_ATS = Kokkos::ArithTraits<typename ATS::val_type>;
433+
#endif
426434

427435
LO lZeroDiags = 0;
428436
typename ATS::val_type impl_replacementValue = replacementValue;
@@ -451,8 +459,16 @@ void MatrixUtils<Scalar, LocalOrdinal, GlobalOrdinal, Node>::CheckRepairMainDiag
451459

452460
auto lclA = tpCrsAc->getTpetra_CrsMatrix()->getLocalMatrixDevice();
453461

462+
#if KOKKOS_VERSION > 40799
463+
using ATS = KokkosKernels::ArithTraits<Scalar>;
464+
#else
454465
using ATS = Kokkos::ArithTraits<Scalar>;
466+
#endif
467+
#if KOKKOS_VERSION > 40799
468+
using impl_ATS = KokkosKernels::ArithTraits<typename ATS::val_type>;
469+
#else
455470
using impl_ATS = Kokkos::ArithTraits<typename ATS::val_type>;
471+
#endif
456472

457473
LO lZeroDiags = 0;
458474

0 commit comments

Comments
 (0)