Skip to content

Commit a9ec0e9

Browse files
ndellingwoodeeprude
authored andcommitted
belos: 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 0b703d3 commit a9ec0e9

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

packages/belos/tpetra/src/BelosMultiVecTraits_Tpetra.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
#include "Tpetra_Details_StaticView.hpp"
2222
#include "Teuchos_Array.hpp"
2323
#include "Teuchos_ScalarTraits.hpp"
24+
#if KOKKOS_VERSION > 40799
25+
#include "KokkosKernels_ArithTraits.hpp"
26+
#else
2427
#include "Kokkos_ArithTraits.hpp"
28+
#endif
2529
#include <map>
2630
#include <utility>
2731
#include <vector>
@@ -84,7 +88,11 @@ makeStaticLocalMultiVector (const MultiVectorType& gblMv,
8488
// them having been initialized. ArithTraits lets us call nan()
8589
// even if the scalar type doesn't define it; it just returns some
8690
// undefined value in the latter case.
91+
#if KOKKOS_VERSION > 40799
92+
const IST nan = KokkosKernels::ArithTraits<IST>::nan ();
93+
#else
8794
const IST nan = Kokkos::ArithTraits<IST>::nan ();
95+
#endif
8896
Kokkos::deep_copy (dv.view_device(), nan);
8997
Kokkos::deep_copy (dv.view_host(), nan);
9098
}

packages/belos/tpetra/src/solvers/Belos_Tpetra_Cg.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,17 @@ class Cg: public Krylov <SC, MV, OP> {
4646
using std::endl;
4747
using dev_type = typename MV::device_type;
4848
using val_type = typename MV::dot_type;
49+
#if KOKKOS_VERSION > 40799
50+
using ATS = KokkosKernels::ArithTraits<val_type>;
51+
#else
4952
using ATS = Kokkos::ArithTraits<val_type>;
53+
#endif
5054
using magnitude_type = typename ATS::mag_type;
55+
#if KOKKOS_VERSION > 40799
56+
using ATM = KokkosKernels::ArithTraits<magnitude_type>;
57+
#else
5158
using ATM = Kokkos::ArithTraits<magnitude_type>;
59+
#endif
5260

5361
const auto ONE = ATS::one ();
5462

packages/belos/tpetra/src/solvers/Belos_Tpetra_CgPipeline.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,17 @@ class CgPipeline : public Krylov<SC, MV, OP> {
4646
using std::endl;
4747
using dev_type = typename MV::device_type;
4848
using val_type = typename MV::dot_type;
49+
#if KOKKOS_VERSION > 40799
50+
using ATS = KokkosKernels::ArithTraits<val_type>;
51+
#else
4952
using ATS = Kokkos::ArithTraits<val_type>;
53+
#endif
5054
using magnitude_type = typename ATS::mag_type;
55+
#if KOKKOS_VERSION > 40799
56+
using ATM = KokkosKernels::ArithTraits<magnitude_type>;
57+
#else
5158
using ATM = Kokkos::ArithTraits<magnitude_type>;
59+
#endif
5260

5361
const auto ONE = ATS::one ();
5462

packages/belos/tpetra/src/solvers/Belos_Tpetra_CgSingleReduce.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,17 @@ class CgSingleReduce: public Krylov<SC, MV, OP> {
4545
{
4646
using std::endl;
4747
using dev_type = typename MV::device_type;
48+
#if KOKKOS_VERSION > 40799
49+
using ATS = KokkosKernels::ArithTraits<SC>;
50+
#else
4851
using ATS = Kokkos::ArithTraits<SC>;
52+
#endif
4953
using magnitude_type = typename ATS::mag_type;
54+
#if KOKKOS_VERSION > 40799
55+
using ATM = KokkosKernels::ArithTraits<magnitude_type>;
56+
#else
5057
using ATM = Kokkos::ArithTraits<magnitude_type>;
58+
#endif
5159
using dot_type = typename MV::dot_type;
5260

5361
const SC ONE = ATS::one ();

0 commit comments

Comments
 (0)