@@ -1091,7 +1091,11 @@ template <class ViewType1,
10911091 const bool takeSquareRootsOfScalingFactors,
10921092 const bool takeAbsoluteValueOfScalingFactors =
10931093 !std::is_same<
1094+ #if KOKKOS_VERSION > 40799
1095+ typename KokkosKernels::ArithTraits<
1096+ #else
10941097 typename Kokkos::ArithTraits<
1098+ #endif
10951099 typename ViewType1::non_const_value_type>::mag_type,
10961100 typename ViewType2::non_const_value_type>::value,
10971101 const int rank = ViewType1::rank>
@@ -1120,9 +1124,17 @@ class ElementWiseMultiply<ViewType1,
11201124
11211125 KOKKOS_INLINE_FUNCTION void operator ()(const IndexType i) const {
11221126 using val_type = typename ViewType2::non_const_value_type;
1127+ #if KOKKOS_VERSION > 40799
1128+ using KAT = KokkosKernels::ArithTraits<val_type>;
1129+ #else
11231130 using KAT = Kokkos::ArithTraits<val_type>;
1131+ #endif
11241132 using mag_type = typename KAT::mag_type;
1133+ #if KOKKOS_VERSION > 40799
1134+ using KAM = KokkosKernels::ArithTraits<mag_type>;
1135+ #else
11251136 using KAM = Kokkos::ArithTraits<mag_type>;
1137+ #endif
11261138
11271139 if (takeAbsoluteValueOfScalingFactors) {
11281140 const mag_type scalFactAbs = KAT::abs (scalingFactors_ (i));
@@ -1163,9 +1175,17 @@ class ElementWiseMultiply<ViewType1,
11631175
11641176 KOKKOS_INLINE_FUNCTION void operator ()(const IndexType i) const {
11651177 using val_type = typename ViewType2::non_const_value_type;
1178+ #if KOKKOS_VERSION > 40799
1179+ using KAT = KokkosKernels::ArithTraits<val_type>;
1180+ #else
11661181 using KAT = Kokkos::ArithTraits<val_type>;
1182+ #endif
11671183 using mag_type = typename KAT::mag_type;
1184+ #if KOKKOS_VERSION > 40799
1185+ using KAM = KokkosKernels::ArithTraits<mag_type>;
1186+ #else
11681187 using KAM = Kokkos::ArithTraits<mag_type>;
1188+ #endif
11691189
11701190 for (IndexType j = 0 ; j < static_cast <IndexType>(X_.extent (1 )); ++j) {
11711191 if (takeAbsoluteValueOfScalingFactors) {
@@ -1194,7 +1214,11 @@ void elementWiseMultiply(const MultiVectorViewType& X,
11941214 const bool takeSquareRootsOfScalingFactors,
11951215 const bool takeAbsoluteValueOfScalingFactors =
11961216 !std::is_same<
1217+ #if KOKKOS_VERSION > 40799
1218+ typename KokkosKernels::ArithTraits<
1219+ #else
11971220 typename Kokkos::ArithTraits<
1221+ #endif
11981222 typename MultiVectorViewType::non_const_value_type>::mag_type,
11991223 typename ScalingFactorsViewType::non_const_value_type>::value) {
12001224 using execution_space = typename MultiVectorViewType::device_type::execution_space;
@@ -1243,7 +1267,11 @@ void elementWiseMultiplyMultiVector(MultiVectorType& X,
12431267 const bool takeSquareRootsOfScalingFactors,
12441268 const bool takeAbsoluteValueOfScalingFactors =
12451269 !std::is_same<
1270+ #if KOKKOS_VERSION > 40799
1271+ typename KokkosKernels::ArithTraits<
1272+ #else
12461273 typename Kokkos::ArithTraits<
1274+ #endif
12471275 typename MultiVectorType::scalar_type>::mag_type,
12481276 typename ScalingFactorsViewType::non_const_value_type>::value) {
12491277 using index_type = typename MultiVectorType::local_ordinal_type;
@@ -1269,7 +1297,11 @@ template <class ViewType1,
12691297 const bool takeSquareRootsOfScalingFactors,
12701298 const bool takeAbsoluteValueOfScalingFactors =
12711299 !std::is_same<
1300+ #if KOKKOS_VERSION > 40799
1301+ typename KokkosKernels::ArithTraits<
1302+ #else
12721303 typename Kokkos::ArithTraits<
1304+ #endif
12731305 typename ViewType1::non_const_value_type>::mag_type,
12741306 typename ViewType2::non_const_value_type>::value,
12751307 const int rank = ViewType1::rank>
@@ -1298,9 +1330,17 @@ class ElementWiseDivide<ViewType1,
12981330
12991331 KOKKOS_INLINE_FUNCTION void operator ()(const IndexType i) const {
13001332 using val_type = typename ViewType2::non_const_value_type;
1333+ #if KOKKOS_VERSION > 40799
1334+ using KAT = KokkosKernels::ArithTraits<val_type>;
1335+ #else
13011336 using KAT = Kokkos::ArithTraits<val_type>;
1337+ #endif
13021338 using mag_type = typename KAT::mag_type;
1339+ #if KOKKOS_VERSION > 40799
1340+ using KAM = KokkosKernels::ArithTraits<mag_type>;
1341+ #else
13031342 using KAM = Kokkos::ArithTraits<mag_type>;
1343+ #endif
13041344
13051345 if (takeAbsoluteValueOfScalingFactors) {
13061346 const mag_type scalFactAbs = KAT::abs (scalingFactors_ (i));
@@ -1341,9 +1381,17 @@ class ElementWiseDivide<ViewType1,
13411381
13421382 KOKKOS_INLINE_FUNCTION void operator ()(const IndexType i) const {
13431383 using val_type = typename ViewType2::non_const_value_type;
1384+ #if KOKKOS_VERSION > 40799
1385+ using KAT = KokkosKernels::ArithTraits<val_type>;
1386+ #else
13441387 using KAT = Kokkos::ArithTraits<val_type>;
1388+ #endif
13451389 using mag_type = typename KAT::mag_type;
1390+ #if KOKKOS_VERSION > 40799
1391+ using KAM = KokkosKernels::ArithTraits<mag_type>;
1392+ #else
13461393 using KAM = Kokkos::ArithTraits<mag_type>;
1394+ #endif
13471395
13481396 for (IndexType j = 0 ; j < static_cast <IndexType>(X_.extent (1 )); ++j) {
13491397 if (takeAbsoluteValueOfScalingFactors) {
@@ -1372,7 +1420,11 @@ void elementWiseDivide(const MultiVectorViewType& X,
13721420 const bool takeSquareRootsOfScalingFactors,
13731421 const bool takeAbsoluteValueOfScalingFactors =
13741422 !std::is_same<
1423+ #if KOKKOS_VERSION > 40799
1424+ typename KokkosKernels::ArithTraits<
1425+ #else
13751426 typename Kokkos::ArithTraits<
1427+ #endif
13761428 typename MultiVectorViewType::non_const_value_type>::mag_type,
13771429 typename ScalingFactorsViewType::non_const_value_type>::value) {
13781430 using execution_space = typename MultiVectorViewType::device_type::execution_space;
@@ -1421,7 +1473,11 @@ void elementWiseDivideMultiVector(MultiVectorType& X,
14211473 const bool takeSquareRootsOfScalingFactors,
14221474 const bool takeAbsoluteValueOfScalingFactors =
14231475 !std::is_same<
1476+ #if KOKKOS_VERSION > 40799
1477+ typename KokkosKernels::ArithTraits<
1478+ #else
14241479 typename Kokkos::ArithTraits<
1480+ #endif
14251481 typename MultiVectorType::scalar_type>::mag_type,
14261482 typename ScalingFactorsViewType::non_const_value_type>::value) {
14271483 using index_type = typename MultiVectorType::local_ordinal_type;
@@ -1670,7 +1726,11 @@ class BelosIfpack2Solver {
16701726 equibResult_ = computeRowAndColumnOneNorms (*A_, assumeSymmetric_);
16711727 if (useDiagonalToEquilibrate_) {
16721728 using device_type = typename node_type::device_type;
1729+ #if KOKKOS_VERSION > 40799
1730+ using mag_type = typename KokkosKernels::ArithTraits<scalar_type>::mag_type;
1731+ #else
16731732 using mag_type = typename Kokkos::ArithTraits<scalar_type>::mag_type;
1733+ #endif
16741734 using view_type = Kokkos::View<mag_type*, device_type>;
16751735
16761736 view_type rowDiagAbsVals (" rowDiagAbsVals" ,
@@ -1968,7 +2028,11 @@ void solveAndReport(BelosIfpack2Solver<CrsMatrixType>& solver,
19682028 using mag_type = typename MultiVectorType::mag_type;
19692029 Teuchos::Array<mag_type> norms (R.getNumVectors ());
19702030 R.norm2 (norms ());
2031+ #if KOKKOS_VERSION > 40799
2032+ mag_type B_norm2_max = KokkosKernels::ArithTraits<mag_type>::zero ();
2033+ #else
19712034 mag_type B_norm2_max = Kokkos::ArithTraits<mag_type>::zero ();
2035+ #endif
19722036 for (std::size_t j = 0 ; j < B.getNumVectors (); ++j) {
19732037 // Any NaN will persist (since the first test will fail);
19742038 // this is what we want
@@ -1984,15 +2048,23 @@ void solveAndReport(BelosIfpack2Solver<CrsMatrixType>& solver,
19842048 A_original.apply (X, R, Teuchos::NO_TRANS, -ONE, ONE); // R := -A*X + B
19852049 R.norm2 (norms ());
19862050
2051+ #if KOKKOS_VERSION > 40799
2052+ mag_type R_norm2_max = KokkosKernels::ArithTraits<mag_type>::zero ();
2053+ #else
19872054 mag_type R_norm2_max = Kokkos::ArithTraits<mag_type>::zero ();
2055+ #endif
19882056 for (std::size_t j = 0 ; j < R.getNumVectors (); ++j) {
19892057 // Any NaN will persist (since the first test will fail);
19902058 // this is what we want
19912059 R_norm2_max = norms[j] < R_norm2_max ? R_norm2_max : norms[j];
19922060 }
19932061
19942062 X.norm2 (norms ());
2063+ #if KOKKOS_VERSION > 40799
2064+ mag_type X_norm2_max = KokkosKernels::ArithTraits<mag_type>::zero ();
2065+ #else
19952066 mag_type X_norm2_max = Kokkos::ArithTraits<mag_type>::zero ();
2067+ #endif
19962068 for (std::size_t j = 0 ; j < R.getNumVectors (); ++j) {
19972069 // Any NaN will persist (since the first test will fail);
19982070 // this is what we want
@@ -2020,7 +2092,11 @@ void solveAndReport(BelosIfpack2Solver<CrsMatrixType>& solver,
20202092 << " ||B-A*X||_2: " << R_norm2_max << endl
20212093 << " ||B||_2: " << B_norm2_max << endl
20222094 << " ||X||_2: " << X_norm2_max << endl;
2095+ #if KOKKOS_VERSION > 40799
2096+ if (B_norm2_max != KokkosKernels::ArithTraits<mag_type>::zero ()) {
2097+ #else
20232098 if (B_norm2_max != Kokkos::ArithTraits<mag_type>::zero ()) {
2099+ #endif
20242100 cout << " ||B-A*X||_2 / ||B||_2: " << (R_norm2_max / B_norm2_max)
20252101 << endl;
20262102 }
0 commit comments