Skip to content

Commit 0de0684

Browse files
committed
stokhos: 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 cfdb8fb commit 0de0684

12 files changed

+114
-2
lines changed

packages/stokhos/src/sacado/kokkos/pce/belos/Belos_TpetraAdapter_UQ_PCE.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,11 @@ namespace Belos {
466466
KokkosBlas::gemm (
467467
&ctransA, &ctransB,
468468
alpha, flat_A_view, flat_B_view,
469+
#if KOKKOS_VERSION > 40799
470+
KokkosKernels::ArithTraits<dot_type>::zero(),
471+
#else
469472
Kokkos::ArithTraits<dot_type>::zero(),
473+
#endif
470474
C_view_dev);
471475
}
472476
// reduce across processors -- could check for RDMA

packages/stokhos/src/sacado/kokkos/pce/ifpack2/Stokhos_Ifpack2_UQ_PCE.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ struct V_ReciprocalThresholdSelfFunctor<
3636
typedef typename array_type::execution_space execution_space;
3737
typedef SizeType size_type;
3838
typedef typename array_type::non_const_value_type value_type;
39+
#if KOKKOS_VERSION > 40799
40+
typedef KokkosKernels::ArithTraits<value_type> KAT;
41+
#else
3942
typedef Kokkos::ArithTraits<value_type> KAT;
43+
#endif
4044
typedef typename KAT::mag_type mag_type;
4145

4246
const XVector m_x;

packages/stokhos/src/sacado/kokkos/pce/linalg/Kokkos_ArithTraits_UQ_PCE.hpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,22 @@
1111
#define KOKKOS_ARITHTRAITS_UQ_PCE_HPP
1212

1313
#include "Sacado_UQ_PCE.hpp"
14+
#if KOKKOS_VERSION > 40799
15+
#include "KokkosKernels_ArithTraits.hpp"
16+
#else
1417
#include "Kokkos_ArithTraits.hpp"
18+
#endif
1519
#include "KokkosBatched_Vector.hpp"
1620

1721
//----------------------------------------------------------------------------
18-
// Specializations of Kokkos::ArithTraits for Sacado::UQ::PCE scalar type
22+
// Specializations of Kokkos{Kernels}::ArithTraits for Sacado::UQ::PCE scalar type
1923
//----------------------------------------------------------------------------
2024

25+
#if KOKKOS_VERSION > 40799
26+
namespace KokkosKernels {
27+
#else
2128
namespace Kokkos {
29+
#endif
2230

2331
template <typename S>
2432
class ArithTraits< Sacado::UQ::PCE<S> > {
@@ -177,7 +185,11 @@ namespace KokkosBatched {
177185
template <typename S>
178186
struct MagnitudeScalarType< Sacado::UQ::PCE<S> > {
179187
typedef Sacado::UQ::PCE<S> val_type;
188+
#if KOKKOS_VERSION > 40799
189+
typedef typename KokkosKernels::ArithTraits<val_type>::mag_type type;
190+
#else
180191
typedef typename Kokkos::ArithTraits<val_type>::mag_type type;
192+
#endif
181193
};
182194

183195
}

packages/stokhos/src/sacado/kokkos/pce/linalg/Kokkos_Blas1_UQ_PCE.hpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,11 @@ struct MV_Reciprocal_Functor<
242242
typedef Kokkos::View<const Sacado::UQ::PCE<XS>**,XP...> XMV;
243243
typedef typename RMV::execution_space execution_space;
244244
typedef SizeType size_type;
245+
#if KOKKOS_VERSION > 40799
246+
typedef KokkosKernels::ArithTraits<typename Kokkos::IntrinsicScalarType<XMV>::type> ATS;
247+
#else
245248
typedef Kokkos::ArithTraits<typename Kokkos::IntrinsicScalarType<XMV>::type> ATS;
249+
#endif
246250

247251
const size_type numCols;
248252
RMV R_;
@@ -274,7 +278,11 @@ struct MV_ReciprocalSelf_Functor<
274278
typedef Kokkos::View<Sacado::UQ::PCE<RS>**,RP...> RMV;
275279
typedef typename RMV::execution_space execution_space;
276280
typedef SizeType size_type;
281+
#if KOKKOS_VERSION > 40799
282+
typedef KokkosKernels::ArithTraits<typename Kokkos::IntrinsicScalarType<RMV>::type> ATS;
283+
#else
277284
typedef Kokkos::ArithTraits<typename Kokkos::IntrinsicScalarType<RMV>::type> ATS;
285+
#endif
278286

279287
const size_type numCols;
280288
RMV R_;
@@ -308,7 +316,11 @@ struct V_Reciprocal_Functor<
308316
typedef Kokkos::View<const Sacado::UQ::PCE<XS>*,XP...> XV;
309317
typedef typename RV::execution_space execution_space;
310318
typedef SizeType size_type;
319+
#if KOKKOS_VERSION > 40799
320+
typedef KokkosKernels::ArithTraits<typename Kokkos::IntrinsicScalarType<XV>::type> ATS;
321+
#else
311322
typedef Kokkos::ArithTraits<typename Kokkos::IntrinsicScalarType<XV>::type> ATS;
323+
#endif
312324

313325
RV R_;
314326
XV X_;
@@ -333,7 +345,11 @@ struct V_ReciprocalSelf_Functor<
333345
typedef Kokkos::View<Sacado::UQ::PCE<RS>*,RP...> RV;
334346
typedef typename RV::execution_space execution_space;
335347
typedef SizeType size_type;
348+
#if KOKKOS_VERSION > 40799
349+
typedef KokkosKernels::ArithTraits<typename Kokkos::IntrinsicScalarType<RV>::type> ATS;
350+
#else
336351
typedef Kokkos::ArithTraits<typename Kokkos::IntrinsicScalarType<RV>::type> ATS;
352+
#endif
337353

338354
RV R_;
339355

@@ -407,7 +423,11 @@ struct MV_MultFunctor<
407423
typedef Kokkos::View<const Sacado::UQ::PCE<BS>**,BP...> BMV;
408424
typedef typename CMV::execution_space execution_space;
409425
typedef SizeType size_type;
426+
#if KOKKOS_VERSION > 40799
427+
typedef KokkosKernels::ArithTraits<typename Kokkos::IntrinsicScalarType<CMV>::type> ATS;
428+
#else
410429
typedef Kokkos::ArithTraits<typename Kokkos::IntrinsicScalarType<CMV>::type> ATS;
430+
#endif
411431

412432
const size_type m_n;
413433
const size_type m_pce;
@@ -495,7 +515,11 @@ struct V_MultFunctor<
495515
typedef Kokkos::View<const Sacado::UQ::PCE<BS>*,BP...> BV;
496516
typedef typename CV::execution_space execution_space;
497517
typedef SizeType size_type;
518+
#if KOKKOS_VERSION > 40799
519+
typedef KokkosKernels::ArithTraits<typename Kokkos::IntrinsicScalarType<CV>::type> ATS;
520+
#else
498521
typedef Kokkos::ArithTraits<typename Kokkos::IntrinsicScalarType<CV>::type> ATS;
522+
#endif
499523

500524
const size_type m_pce;
501525
const typename Kokkos::IntrinsicScalarType<CV>::type m_c;

packages/stokhos/src/sacado/kokkos/pce/linalg/Kokkos_InnerProductSpaceTraits_UQ_PCE.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ class InnerProductSpaceTraits< Sacado::UQ::PCE<S> > {
3232
typedef InnerProductSpaceTraits<base_value_type> BIT;
3333
typedef typename BIT::dot_type base_dot_type;
3434

35+
#if KOKKOS_VERSION > 40799
36+
typedef typename KokkosKernels::ArithTraits<val_type>::mag_type mag_type;
37+
#else
3538
typedef typename Kokkos::ArithTraits<val_type>::mag_type mag_type;
39+
#endif
3640
typedef base_dot_type dot_type;
3741

3842
static KOKKOS_FORCEINLINE_FUNCTION
@@ -76,7 +80,11 @@ class InnerProductSpaceTraits< const Sacado::UQ::PCE<S> > {
7680
typedef InnerProductSpaceTraits<base_value_type> BIT;
7781
typedef typename BIT::dot_type base_dot_type;
7882

83+
#if KOKKOS_VERSION > 40799
84+
typedef typename KokkosKernels::ArithTraits<val_type>::mag_type mag_type;
85+
#else
7986
typedef typename Kokkos::ArithTraits<val_type>::mag_type mag_type;
87+
#endif
8088
typedef base_dot_type dot_type;
8189

8290
static KOKKOS_FORCEINLINE_FUNCTION

packages/stokhos/src/sacado/kokkos/pce/linalg/Kokkos_MV_UQ_PCE.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,11 @@ struct V_ReciprocalThresholdSelfFunctor<
447447
typedef typename array_type::execution_space execution_space;
448448
typedef typename array_type::size_type size_type;
449449
typedef typename array_type::non_const_value_type value_type;
450+
#if KOKKOS_VERSION > 40799
451+
typedef KokkosKernels::ArithTraits<value_type> KAT;
452+
#else
450453
typedef Kokkos::ArithTraits<value_type> KAT;
454+
#endif
451455
typedef typename KAT::mag_type mag_type;
452456
453457
const array_type m_x;
@@ -489,7 +493,11 @@ struct MV_ReciprocalThresholdSelfFunctor<
489493
typedef typename array_type::execution_space execution_space;
490494
typedef typename array_type::size_type size_type;
491495
typedef typename array_type::non_const_value_type value_type;
496+
#if KOKKOS_VERSION > 40799
497+
typedef KokkosKernels::ArithTraits<value_type> KAT;
498+
#else
492499
typedef Kokkos::ArithTraits<value_type> KAT;
500+
#endif
493501
typedef typename KAT::mag_type mag_type;
494502
495503
const array_type m_x;

packages/stokhos/src/sacado/kokkos/vector/amesos2/Amesos2_Basker_MP_Vector.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ template <class T> struct BASKER_ScalarTraits;
2222
template <class S>
2323
struct BASKER_ScalarTraits< Sacado::MP::Vector<S> > {
2424
typedef Sacado::MP::Vector<S> val_type;
25+
#if KOKKOS_VERSION > 40799
26+
typedef KokkosKernels::ArithTraits<val_type> KAT;
27+
#else
2528
typedef Kokkos::ArithTraits<val_type> KAT;
29+
#endif
2630
typedef typename KAT::mag_type magnitudeType;
2731
static inline val_type reciprocal(val_type c){ return 1.0/c; }
2832
static inline val_type divide(val_type a, val_type b){ return a/b; }
@@ -38,7 +42,11 @@ namespace Amesos2 {
3842
struct TypeMap< Basker,Sacado::MP::Vector<ST> > {
3943
typedef Sacado::MP::Vector<ST> dtype;
4044
typedef Sacado::MP::Vector<ST> type;
45+
#if KOKKOS_VERSION > 40799
46+
typedef typename KokkosKernels::ArithTraits< Sacado::MP::Vector<ST> >::mag_type magnitude_type;
47+
#else
4148
typedef typename Kokkos::ArithTraits< Sacado::MP::Vector<ST> >::mag_type magnitude_type;
49+
#endif
4250
};
4351

4452
// Specialize our specialization for create_solver_with_supported_type

packages/stokhos/src/sacado/kokkos/vector/belos/Belos_TpetraAdapter_MP_Vector.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,11 @@ namespace Belos {
500500
KokkosBlas::gemm (
501501
&ctransA, &ctransB,
502502
alpha, flat_A_view, flat_B_view,
503+
#if KOKKOS_VERSION > 40799
504+
KokkosKernels::ArithTraits<dot_type>::zero(),
505+
#else
503506
Kokkos::ArithTraits<dot_type>::zero(),
507+
#endif
504508
C_view_dev);
505509
}
506510

packages/stokhos/src/sacado/kokkos/vector/linalg/Kokkos_ArithTraits_MP_Vector.hpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,22 @@
1111
#define KOKKOS_ARITHTRAITS_MP_VECTOR_HPP
1212

1313
#include "Sacado_MP_Vector.hpp"
14+
#if KOKKOS_VERSION > 40799
15+
#include "KokkosKernels_ArithTraits.hpp"
16+
#else
1417
#include "Kokkos_ArithTraits.hpp"
18+
#endif
1519
#include "KokkosBatched_Vector.hpp"
1620

1721
//----------------------------------------------------------------------------
18-
// Specializations of Kokkos::ArithTraits for Sacado::MP::Vector scalar type
22+
// Specializations of Kokkos{Kernels}::ArithTraits for Sacado::MP::Vector scalar type
1923
//----------------------------------------------------------------------------
2024

25+
#if KOKKOS_VERSION > 40799
26+
namespace KokkosKernels {
27+
#else
2128
namespace Kokkos {
29+
#endif
2230

2331
template <typename S>
2432
class ArithTraits< Sacado::MP::Vector<S> > {
@@ -185,7 +193,11 @@ namespace KokkosBatched {
185193
template <typename S>
186194
struct MagnitudeScalarType< Sacado::MP::Vector<S> > {
187195
typedef Sacado::MP::Vector<S> val_type;
196+
#if KOKKOS_VERSION > 40799
197+
typedef typename KokkosKernels::ArithTraits<val_type>::mag_type type;
198+
#else
188199
typedef typename Kokkos::ArithTraits<val_type>::mag_type type;
200+
#endif
189201
};
190202

191203
}

packages/stokhos/src/sacado/kokkos/vector/linalg/Kokkos_InnerProductSpaceTraits_MP_Vector.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ class InnerProductSpaceTraits< Sacado::MP::Vector<S> > {
3535
typedef InnerProductSpaceTraits<base_value_type> BIT;
3636
typedef typename BIT::dot_type base_dot_type;
3737

38+
#if KOKKOS_VERSION > 40799
39+
typedef typename KokkosKernels::ArithTraits<val_type>::mag_type mag_type;
40+
#else
3841
typedef typename Kokkos::ArithTraits<val_type>::mag_type mag_type;
42+
#endif
3943
typedef base_dot_type dot_type;
4044

4145
static KOKKOS_FORCEINLINE_FUNCTION
@@ -79,7 +83,11 @@ class InnerProductSpaceTraits< const Sacado::MP::Vector<S> > {
7983
typedef InnerProductSpaceTraits<base_value_type> BIT;
8084
typedef typename BIT::dot_type base_dot_type;
8185

86+
#if KOKKOS_VERSION > 40799
87+
typedef typename KokkosKernels::ArithTraits<val_type>::mag_type mag_type;
88+
#else
8289
typedef typename Kokkos::ArithTraits<val_type>::mag_type mag_type;
90+
#endif
8391
typedef base_dot_type dot_type;
8492

8593
static KOKKOS_FORCEINLINE_FUNCTION

0 commit comments

Comments
 (0)