Skip to content

Commit

Permalink
stokhos: remove ArithTraits from Details namespace post Kokkos@4.0 pt2
Browse files Browse the repository at this point in the history
Compatibility update with kokkos/kokkos-kernels#1748
  • Loading branch information
ndellingwood committed Mar 28, 2023
1 parent a42bbdd commit b854ec3
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,11 @@ namespace Belos {
KokkosBlas::gemm (
&ctransA, &ctransB,
alpha, flat_A_view, flat_B_view,
#if KOKKOS_VERSION < 40099
Kokkos::Details::ArithTraits<dot_type>::zero(),
#else
Kokkos::ArithTraits<dot_type>::zero(),
#endif
C_view_dev);
}
// reduce across processors -- could check for RDMA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ struct V_ReciprocalThresholdSelfFunctor<
typedef typename array_type::execution_space execution_space;
typedef SizeType size_type;
typedef typename array_type::non_const_value_type value_type;
#if KOKKOS_VERSION < 40099
typedef Kokkos::Details::ArithTraits<value_type> KAT;
#else
typedef Kokkos::ArithTraits<value_type> KAT;
#endif
typedef typename KAT::mag_type mag_type;

const XVector m_x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
//----------------------------------------------------------------------------

namespace Kokkos {
#if KOKKOS_VERSION < 40099
namespace Details {
#endif

template <typename S>
class ArithTraits< Sacado::UQ::PCE<S> > {
Expand Down Expand Up @@ -203,15 +205,21 @@ class ArithTraits< Sacado::UQ::PCE<S> > {
}
};

}
}
#if KOKKOS_VERSION < 40099
} // namespace Details - removed after Kokkos 4.0
#endif
} // namespace Kokkos

namespace KokkosBatched {

template <typename S>
struct MagnitudeScalarType< Sacado::UQ::PCE<S> > {
typedef Sacado::UQ::PCE<S> val_type;
#if KOKKOS_VERSION < 40099
typedef typename Kokkos::Details::ArithTraits<val_type>::mag_type type;
#else
typedef typename Kokkos::ArithTraits<val_type>::mag_type type;
#endif
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,11 @@ struct MV_Reciprocal_Functor<
typedef Kokkos::View<const Sacado::UQ::PCE<XS>**,XP...> XMV;
typedef typename RMV::execution_space execution_space;
typedef SizeType size_type;
#if KOKKOS_VERSION < 40099
typedef Kokkos::Details::ArithTraits<typename Kokkos::IntrinsicScalarType<XMV>::type> ATS;
#else
typedef Kokkos::ArithTraits<typename Kokkos::IntrinsicScalarType<XMV>::type> ATS;
#endif

const size_type numCols;
RMV R_;
Expand Down Expand Up @@ -306,7 +310,11 @@ struct MV_ReciprocalSelf_Functor<
typedef Kokkos::View<Sacado::UQ::PCE<RS>**,RP...> RMV;
typedef typename RMV::execution_space execution_space;
typedef SizeType size_type;
#if KOKKOS_VERSION < 40099
typedef Kokkos::Details::ArithTraits<typename Kokkos::IntrinsicScalarType<RMV>::type> ATS;
#else
typedef Kokkos::ArithTraits<typename Kokkos::IntrinsicScalarType<RMV>::type> ATS;
#endif

const size_type numCols;
RMV R_;
Expand Down Expand Up @@ -340,7 +348,11 @@ struct V_Reciprocal_Functor<
typedef Kokkos::View<const Sacado::UQ::PCE<XS>*,XP...> XV;
typedef typename RV::execution_space execution_space;
typedef SizeType size_type;
#if KOKKOS_VERSION < 40099
typedef Kokkos::Details::ArithTraits<typename Kokkos::IntrinsicScalarType<XV>::type> ATS;
#else
typedef Kokkos::ArithTraits<typename Kokkos::IntrinsicScalarType<XV>::type> ATS;
#endif

RV R_;
XV X_;
Expand All @@ -365,7 +377,11 @@ struct V_ReciprocalSelf_Functor<
typedef Kokkos::View<Sacado::UQ::PCE<RS>*,RP...> RV;
typedef typename RV::execution_space execution_space;
typedef SizeType size_type;
#if KOKKOS_VERSION < 40099
typedef Kokkos::Details::ArithTraits<typename Kokkos::IntrinsicScalarType<RV>::type> ATS;
#else
typedef Kokkos::ArithTraits<typename Kokkos::IntrinsicScalarType<RV>::type> ATS;
#endif

RV R_;

Expand Down Expand Up @@ -439,7 +455,11 @@ struct MV_MultFunctor<
typedef Kokkos::View<const Sacado::UQ::PCE<BS>**,BP...> BMV;
typedef typename CMV::execution_space execution_space;
typedef SizeType size_type;
#if KOKKOS_VERSION < 40099
typedef Kokkos::Details::ArithTraits<typename Kokkos::IntrinsicScalarType<CMV>::type> ATS;
#else
typedef Kokkos::ArithTraits<typename Kokkos::IntrinsicScalarType<CMV>::type> ATS;
#endif

const size_type m_n;
const size_type m_pce;
Expand Down Expand Up @@ -527,7 +547,11 @@ struct V_MultFunctor<
typedef Kokkos::View<const Sacado::UQ::PCE<BS>*,BP...> BV;
typedef typename CV::execution_space execution_space;
typedef SizeType size_type;
#if KOKKOS_VERSION < 40099
typedef Kokkos::Details::ArithTraits<typename Kokkos::IntrinsicScalarType<CV>::type> ATS;
#else
typedef Kokkos::ArithTraits<typename Kokkos::IntrinsicScalarType<CV>::type> ATS;
#endif

const size_type m_pce;
const typename Kokkos::IntrinsicScalarType<CV>::type m_c;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ class InnerProductSpaceTraits< Sacado::UQ::PCE<S> > {
typedef InnerProductSpaceTraits<base_value_type> BIT;
typedef typename BIT::dot_type base_dot_type;

#if KOKKOS_VERSION < 40099
typedef typename ArithTraits<val_type>::mag_type mag_type;
#else
typedef typename Kokkos::ArithTraits<val_type>::mag_type mag_type;
#endif
typedef base_dot_type dot_type;

static KOKKOS_FORCEINLINE_FUNCTION
Expand Down Expand Up @@ -108,7 +112,11 @@ class InnerProductSpaceTraits< const Sacado::UQ::PCE<S> > {
typedef InnerProductSpaceTraits<base_value_type> BIT;
typedef typename BIT::dot_type base_dot_type;

#if KOKKOS_VERSION < 40099
typedef typename ArithTraits<val_type>::mag_type mag_type;
#else
typedef typename Kokkos::ArithTraits<val_type>::mag_type mag_type;
#endif
typedef base_dot_type dot_type;

static KOKKOS_FORCEINLINE_FUNCTION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,11 @@ struct V_ReciprocalThresholdSelfFunctor<
typedef typename array_type::execution_space execution_space;
typedef typename array_type::size_type size_type;
typedef typename array_type::non_const_value_type value_type;
#if KOKKOS_VERSION < 40099
typedef Kokkos::Details::ArithTraits<value_type> KAT;
#else
typedef Kokkos::ArithTraits<value_type> KAT;
#endif
typedef typename KAT::mag_type mag_type;
const array_type m_x;
Expand Down Expand Up @@ -521,7 +525,11 @@ struct MV_ReciprocalThresholdSelfFunctor<
typedef typename array_type::execution_space execution_space;
typedef typename array_type::size_type size_type;
typedef typename array_type::non_const_value_type value_type;
#if KOKKOS_VERSION < 40099
typedef Kokkos::Details::ArithTraits<value_type> KAT;
#else
typedef Kokkos::ArithTraits<value_type> KAT;
#endif
typedef typename KAT::mag_type mag_type;
const array_type m_x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ template <class T> struct BASKER_ScalarTraits;
template <class S>
struct BASKER_ScalarTraits< Sacado::MP::Vector<S> > {
typedef Sacado::MP::Vector<S> val_type;
#if KOKKOS_VERSION < 40099
typedef Kokkos::Details::ArithTraits<val_type> KAT;
#else
typedef Kokkos::ArithTraits<val_type> KAT;
#endif
typedef typename KAT::mag_type magnitudeType;
static inline val_type reciprocal(val_type c){ return 1.0/c; }
static inline val_type divide(val_type a, val_type b){ return a/b; }
Expand All @@ -70,7 +74,11 @@ namespace Amesos2 {
struct TypeMap< Basker,Sacado::MP::Vector<ST> > {
typedef Sacado::MP::Vector<ST> dtype;
typedef Sacado::MP::Vector<ST> type;
#if KOKKOS_VERSION < 40099
typedef typename Kokkos::Details::ArithTraits< Sacado::MP::Vector<ST> >::mag_type magnitude_type;
#else
typedef typename Kokkos::ArithTraits< Sacado::MP::Vector<ST> >::mag_type magnitude_type;
#endif
};

// Specialize our specialization for create_solver_with_supported_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,11 @@ namespace Belos {
KokkosBlas::gemm (
&ctransA, &ctransB,
alpha, flat_A_view, flat_B_view,
#if KOKKOS_VERSION < 40099
Kokkos::Details::ArithTraits<dot_type>::zero(),
#else
Kokkos::ArithTraits<dot_type>::zero(),
#endif
C_view_dev);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ namespace KokkosBatched {
template <typename S>
struct MagnitudeScalarType< Sacado::MP::Vector<S> > {
typedef Sacado::MP::Vector<S> val_type;
#if KOKKOS_VERSION < 40099
typedef typename Kokkos::Details::ArithTraits<val_type>::mag_type type;
#else
typedef typename Kokkos::ArithTraits<val_type>::mag_type type;
#endif
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ class InnerProductSpaceTraits< Sacado::MP::Vector<S> > {
typedef InnerProductSpaceTraits<base_value_type> BIT;
typedef typename BIT::dot_type base_dot_type;

#if KOKKOS_VERSION < 40099
typedef typename ArithTraits<val_type>::mag_type mag_type;
#else
typedef typename Kokkos::ArithTraits<val_type>::mag_type mag_type;
#endif
typedef base_dot_type dot_type;

static KOKKOS_FORCEINLINE_FUNCTION
Expand Down Expand Up @@ -111,7 +115,11 @@ class InnerProductSpaceTraits< const Sacado::MP::Vector<S> > {
typedef InnerProductSpaceTraits<base_value_type> BIT;
typedef typename BIT::dot_type base_dot_type;

#if KOKKOS_VERSION < 40099
typedef typename ArithTraits<val_type>::mag_type mag_type;
#else
typedef typename Kokkos::ArithTraits<val_type>::mag_type mag_type;
#endif
typedef base_dot_type dot_type;

static KOKKOS_FORCEINLINE_FUNCTION
Expand Down

0 comments on commit b854ec3

Please sign in to comment.