Skip to content

Commit 1e1f98d

Browse files
ndellingwoodeeprude
authored andcommitted
galeri: 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 17bcc81 commit 1e1f98d

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

packages/galeri/src-xpetra/Galeri_Elasticity2DProblem.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,16 @@ class Elasticity2DProblem : public Problem<Map, Matrix, MultiVector> {
9393
std::vector<Scalar> stretch;
9494
std::string mode_;
9595

96+
#if KOKKOS_VERSION > 40799
97+
using impl_scalar_type = typename KokkosKernels::ArithTraits<SC>::val_type;
98+
#else
9699
using impl_scalar_type = typename Kokkos::ArithTraits<SC>::val_type;
100+
#endif
101+
#if KOKKOS_VERSION > 40799
102+
using KAT = KokkosKernels::ArithTraits<impl_scalar_type>;
103+
#else
97104
using KAT = Kokkos::ArithTraits<impl_scalar_type>;
105+
#endif
98106
using Memory2D = Kokkos::View<impl_scalar_type**, Kokkos::HostSpace>;
99107

100108
void EvalD(const std::vector<Point>& refPoints, Point& gaussPoint, Memory2D S);

packages/galeri/src-xpetra/Galeri_Elasticity3DProblem.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,16 @@ class Elasticity3DProblem : public Problem<Map, Matrix, MultiVector> {
101101
std::vector<Scalar> stretch;
102102
std::string mode_;
103103

104+
#if KOKKOS_VERSION > 40799
105+
using impl_scalar_type = typename KokkosKernels::ArithTraits<SC>::val_type;
106+
#else
104107
using impl_scalar_type = typename Kokkos::ArithTraits<SC>::val_type;
108+
#endif
109+
#if KOKKOS_VERSION > 40799
110+
using KAT = KokkosKernels::ArithTraits<impl_scalar_type>;
111+
#else
105112
using KAT = Kokkos::ArithTraits<impl_scalar_type>;
113+
#endif
106114
using Memory2D = Kokkos::View<impl_scalar_type**, Kokkos::HostSpace>;
107115

108116
void EvalD(const std::vector<Point>& refPoints, Point& gaussPoint, Memory2D S);

packages/galeri/src-xpetra/Galeri_XpetraMatrixTypes.hpp

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,11 @@ template <class Scalar, class Map>
171171
class ScaledIdentityStencil {
172172
// a
173173

174+
#if KOKKOS_VERSION > 40799
175+
using ATS = KokkosKernels::ArithTraits<Scalar>;
176+
#else
174177
using ATS = Kokkos::ArithTraits<Scalar>;
178+
#endif
175179
using impl_scalar_type = typename ATS::val_type;
176180
using LocalOrdinal = typename Map::local_ordinal_type;
177181
using GlobalOrdinal = typename Map::global_ordinal_type;
@@ -189,8 +193,16 @@ class ScaledIdentityStencil {
189193
impl_scalar_type a;
190194
local_map_type lclMap;
191195

196+
#if KOKKOS_VERSION > 40799
197+
const impl_scalar_type one = KokkosKernels::ArithTraits<impl_scalar_type>::one();
198+
#else
192199
const impl_scalar_type one = Kokkos::ArithTraits<impl_scalar_type>::one();
200+
#endif
201+
#if KOKKOS_VERSION > 40799
202+
const impl_scalar_type zero = KokkosKernels::ArithTraits<impl_scalar_type>::zero();
203+
#else
193204
const impl_scalar_type zero = Kokkos::ArithTraits<impl_scalar_type>::zero();
205+
#endif
194206
const GlobalOrdinal INVALID = Teuchos::OrdinalTraits<GlobalOrdinal>::invalid();
195207

196208
public:
@@ -224,7 +236,11 @@ template <class Scalar, class Map, bool keepBCs>
224236
class TriDiagStencil {
225237
// b a c
226238

239+
#if KOKKOS_VERSION > 40799
240+
using ATS = KokkosKernels::ArithTraits<Scalar>;
241+
#else
227242
using ATS = Kokkos::ArithTraits<Scalar>;
243+
#endif
228244
using impl_scalar_type = typename ATS::val_type;
229245
using LocalOrdinal = typename Map::local_ordinal_type;
230246
using GlobalOrdinal = typename Map::global_ordinal_type;
@@ -243,8 +259,16 @@ class TriDiagStencil {
243259
DirBC DirichletBC;
244260
local_map_type lclMap;
245261

262+
#if KOKKOS_VERSION > 40799
263+
const impl_scalar_type one = KokkosKernels::ArithTraits<impl_scalar_type>::one();
264+
#else
246265
const impl_scalar_type one = Kokkos::ArithTraits<impl_scalar_type>::one();
266+
#endif
267+
#if KOKKOS_VERSION > 40799
268+
const impl_scalar_type zero = KokkosKernels::ArithTraits<impl_scalar_type>::zero();
269+
#else
247270
const impl_scalar_type zero = Kokkos::ArithTraits<impl_scalar_type>::zero();
271+
#endif
248272
const GlobalOrdinal INVALID = Teuchos::OrdinalTraits<GlobalOrdinal>::invalid();
249273

250274
public:
@@ -321,7 +345,11 @@ class Cross2DStencil {
321345
// b a c
322346
// d
323347

348+
#if KOKKOS_VERSION > 40799
349+
using ATS = KokkosKernels::ArithTraits<Scalar>;
350+
#else
324351
using ATS = Kokkos::ArithTraits<Scalar>;
352+
#endif
325353
using impl_scalar_type = typename ATS::val_type;
326354
using LocalOrdinal = typename Map::local_ordinal_type;
327355
using GlobalOrdinal = typename Map::global_ordinal_type;
@@ -340,8 +368,16 @@ class Cross2DStencil {
340368
DirBC DirichletBC;
341369
local_map_type lclMap;
342370

371+
#if KOKKOS_VERSION > 40799
372+
const impl_scalar_type one = KokkosKernels::ArithTraits<impl_scalar_type>::one();
373+
#else
343374
const impl_scalar_type one = Kokkos::ArithTraits<impl_scalar_type>::one();
375+
#endif
376+
#if KOKKOS_VERSION > 40799
377+
const impl_scalar_type zero = KokkosKernels::ArithTraits<impl_scalar_type>::zero();
378+
#else
344379
const impl_scalar_type zero = Kokkos::ArithTraits<impl_scalar_type>::zero();
380+
#endif
345381
const GlobalOrdinal INVALID = Teuchos::OrdinalTraits<GlobalOrdinal>::invalid();
346382

347383
public:
@@ -430,7 +466,11 @@ class Cross3DStencil {
430466
// d
431467
// + f bottom and g top
432468

469+
#if KOKKOS_VERSION > 40799
470+
using ATS = KokkosKernels::ArithTraits<Scalar>;
471+
#else
433472
using ATS = Kokkos::ArithTraits<Scalar>;
473+
#endif
434474
using impl_scalar_type = typename ATS::val_type;
435475
using LocalOrdinal = typename Map::local_ordinal_type;
436476
using GlobalOrdinal = typename Map::global_ordinal_type;
@@ -449,8 +489,16 @@ class Cross3DStencil {
449489
DirBC DirichletBC;
450490
local_map_type lclMap;
451491

492+
#if KOKKOS_VERSION > 40799
493+
const impl_scalar_type one = KokkosKernels::ArithTraits<impl_scalar_type>::one();
494+
#else
452495
const impl_scalar_type one = Kokkos::ArithTraits<impl_scalar_type>::one();
496+
#endif
497+
#if KOKKOS_VERSION > 40799
498+
const impl_scalar_type zero = KokkosKernels::ArithTraits<impl_scalar_type>::zero();
499+
#else
453500
const impl_scalar_type zero = Kokkos::ArithTraits<impl_scalar_type>::zero();
501+
#endif
454502
const GlobalOrdinal INVALID = Teuchos::OrdinalTraits<GlobalOrdinal>::invalid();
455503

456504
public:
@@ -561,7 +609,11 @@ class Brick3DStencil {
561609
// d b d
562610
// e d e
563611

612+
#if KOKKOS_VERSION > 40799
613+
using ATS = KokkosKernels::ArithTraits<Scalar>;
614+
#else
564615
using ATS = Kokkos::ArithTraits<Scalar>;
616+
#endif
565617
using impl_scalar_type = typename ATS::val_type;
566618
using LocalOrdinal = typename Map::local_ordinal_type;
567619
using GlobalOrdinal = typename Map::global_ordinal_type;
@@ -581,8 +633,16 @@ class Brick3DStencil {
581633
DirBC DirichletBC;
582634
local_map_type lclMap;
583635

636+
#if KOKKOS_VERSION > 40799
637+
const impl_scalar_type one = KokkosKernels::ArithTraits<impl_scalar_type>::one();
638+
#else
584639
const impl_scalar_type one = Kokkos::ArithTraits<impl_scalar_type>::one();
640+
#endif
641+
#if KOKKOS_VERSION > 40799
642+
const impl_scalar_type zero = KokkosKernels::ArithTraits<impl_scalar_type>::zero();
643+
#else
585644
const impl_scalar_type zero = Kokkos::ArithTraits<impl_scalar_type>::zero();
645+
#endif
586646
GlobalOrdinal INVALID;
587647

588648
Kokkos::View<impl_scalar_type[3][3][3], memory_space> stencil_entries;

0 commit comments

Comments
 (0)