42 template <
typename ArrayType>
45 const std::string& tag,
47 typedef typename ArrayType::value_type
FadType;
50 bool success = (x.size() == x2.size());
51 out << tag <<
" Fad array size test";
56 out <<
": \n\tExpected: " << x.size() <<
", \n\tGot: " << x2.size()
60 const int sz = x.size();
61 for (
int i=0; i<sz; i++) {
63 out << tag <<
" Fad array comparison test " << i;
68 out <<
": \n\tExpected: " << x[i] <<
", \n\tGot: " << x2[i] <<
"."
70 success = success && success2;
76 template<
typename Ordinal>
83 out <<
"\nChecking that the above test passed in all processes ...";
84 int thisResult = ( result ? 1 : 0 );
88 const bool passed = sumResult==Teuchos::size(comm);
92 out <<
" (sumResult="<<sumResult<<
"!=numProcs="<<Teuchos::size(comm)<<
") failed\n";
96 #define FAD_BASE_COMM_TESTS(FadType, FAD) \
97 TEUCHOS_UNIT_TEST( FAD##_Comm, Fad_Broadcast ) { \
98 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
99 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
103 ValueTypeSerializer<int,FadType> fts( \
104 rcp(new ValueTypeSerializer<int,double>), p); \
106 Teuchos::Array<FadType> x(n), x2(n), x3(n); \
107 for (int i=0; i<n; i++) { \
108 x[i] = FadType(p, rnd.number()); \
109 for (int j=0; j<p; j++) \
110 x[i].fastAccessDx(j) = rnd.number(); \
112 for (int i=0; i<n; i++) { \
113 x2[i] = FadType(p, 0.0); \
115 if (comm->getRank() == 0) { \
120 Teuchos::broadcast(*comm, 0, n, &x2[0]); \
121 bool success1 = checkFadArrays( \
122 x, x2, std::string(#FAD)+" Broadcast", out); \
123 success1 = checkResultOnAllProcs(*comm, out, success1); \
125 Teuchos::broadcast(*comm, fts, 0, n, &x3[0]); \
126 bool success2 = checkFadArrays( \
127 x, x3, std::string(#FAD)+" Broadcast FTS", out); \
128 success2 = checkResultOnAllProcs(*comm, out, success2); \
130 success = success1 && success2; \
133 TEUCHOS_UNIT_TEST( FAD##_Comm, Fad_GatherAll ) { \
134 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
135 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
139 int size = comm->getSize(); \
140 int rank = comm->getRank(); \
142 ValueTypeSerializer<int,FadType> fts( \
143 rcp(new ValueTypeSerializer<int,double>), p); \
145 Teuchos::Array<FadType> x(n), x2(N), x3(N), x4(N); \
146 for (int i=0; i<n; i++) { \
147 x[i] = FadType(p, (rank+1)*(i+1)); \
148 for (int j=0; j<p; j++) \
149 x[i].fastAccessDx(j) = (rank+1)*(i+1)*(j+1); \
151 for (int i=0; i<N; i++) { \
152 x2[i] = FadType(p, 0.0); \
154 for (int j=0; j<size; j++) { \
155 for (int i=0; i<n; i++) { \
156 x3[n*j+i] = FadType(p, (j+1)*(i+1)); \
157 for (int k=0; k<p; k++) \
158 x3[n*j+i].fastAccessDx(k) = (j+1)*(i+1)*(k+1); \
162 Teuchos::gatherAll(*comm, n, &x[0], N, &x2[0]); \
163 bool success1 = checkFadArrays( \
164 x3, x2, std::string(#FAD)+" Gather All", out); \
165 success1 = checkResultOnAllProcs(*comm, out, success1); \
167 Teuchos::gatherAll(*comm, fts, n, &x[0], N, &x4[0]); \
168 bool success2 = checkFadArrays( \
169 x3, x4, std::string(#FAD)+" Gather All FTS", out); \
170 success2 = checkResultOnAllProcs(*comm, out, success2); \
172 success = success1 && success2; \
175 TEUCHOS_UNIT_TEST( FAD##_Comm, Fad_SumAll ) { \
176 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
177 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
181 int num_proc = comm->getSize(); \
182 ValueTypeSerializer<int,FadType> fts( \
183 rcp(new ValueTypeSerializer<int,double>), p); \
185 Teuchos::Array<FadType> x(n), sums(n), sums2(n), sums3(n); \
186 for (int i=0; i<n; i++) { \
187 x[i] = FadType(p, 1.0*(i+1)); \
188 for (int j=0; j<p; j++) \
189 x[i].fastAccessDx(j) = 2.0*(i+1); \
191 for (int i=0; i<n; i++) { \
192 sums[i] = FadType(p, 1.0*(i+1)*num_proc); \
193 for (int j=0; j<p; j++) \
194 sums[i].fastAccessDx(j) = 2.0*(i+1)*num_proc; \
196 for (int i=0; i<n; i++) { \
197 sums2[i] = FadType(p, 0.0); \
200 Teuchos::reduceAll(*comm, Teuchos::REDUCE_SUM, n, &x[0], &sums2[0]); \
201 bool success1 = checkFadArrays( \
202 sums, sums2, std::string(#FAD)+" Sum All", out); \
203 success1 = checkResultOnAllProcs(*comm, out, success1); \
205 Teuchos::reduceAll(*comm, fts, Teuchos::REDUCE_SUM, n, &x[0], &sums3[0]); \
206 bool success2 = checkFadArrays( \
207 sums, sums3, std::string(#FAD)+" Sum All FTS", out); \
208 success2 = checkResultOnAllProcs(*comm, out, success2); \
210 success = success1 && success2; \
213 TEUCHOS_UNIT_TEST( FAD##_Comm, Fad_MaxAll ) { \
214 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
215 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
219 int rank = comm->getRank(); \
220 int num_proc = comm->getSize(); \
221 ValueTypeSerializer<int,FadType> fts( \
222 rcp(new ValueTypeSerializer<int,double>), p); \
224 Teuchos::Array<FadType> x(n), maxs(n), maxs2(n), maxs3(n); \
225 for (int i=0; i<n; i++) { \
226 x[i] = FadType(p, 1.0*(i+1)*(rank+1)); \
227 for (int j=0; j<p; j++) \
228 x[i].fastAccessDx(j) = 2.0*(i+1)*(rank+1); \
230 for (int i=0; i<n; i++) { \
231 maxs[i] = FadType(p, 1.0*(i+1)*num_proc); \
232 for (int j=0; j<p; j++) \
233 maxs[i].fastAccessDx(j) = 2.0*(i+1)*num_proc; \
235 for (int i=0; i<n; i++) { \
236 maxs2[i] = FadType(p, 0.0); \
239 Teuchos::reduceAll(*comm, Teuchos::REDUCE_MAX, n, &x[0], &maxs2[0]); \
240 bool success1 = checkFadArrays( \
241 maxs, maxs2, std::string(#FAD)+" Max All", out); \
242 success1 = checkResultOnAllProcs(*comm, out, success1); \
244 Teuchos::reduceAll(*comm, fts, Teuchos::REDUCE_MAX, n, &x[0], &maxs3[0]); \
245 bool success2 = checkFadArrays( \
246 maxs, maxs3, std::string(#FAD)+" Max All FTS", out); \
247 success2 = checkResultOnAllProcs(*comm, out, success2); \
249 success = success1 && success2; \
252 TEUCHOS_UNIT_TEST( FAD##_Comm, Fad_MinAll ) { \
253 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
254 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
258 int rank = comm->getRank(); \
259 ValueTypeSerializer<int,FadType> fts( \
260 rcp(new ValueTypeSerializer<int,double>), p); \
262 Teuchos::Array<FadType> x(n), mins(n), mins2(n), mins3(n); \
263 for (int i=0; i<n; i++) { \
264 x[i] = FadType(p, 1.0*(i+1)*(rank+1)); \
265 for (int j=0; j<p; j++) \
266 x[i].fastAccessDx(j) = 2.0*(i+1)*(rank+1); \
268 for (int i=0; i<n; i++) { \
269 mins[i] = FadType(p, 1.0*(i+1)); \
270 for (int j=0; j<p; j++) \
271 mins[i].fastAccessDx(j) = 2.0*(i+1); \
273 for (int i=0; i<n; i++) { \
274 mins2[i] = FadType(p, 0.0); \
277 Teuchos::reduceAll(*comm, Teuchos::REDUCE_MIN, n, &x[0], &mins2[0]); \
278 bool success1 = checkFadArrays( \
279 mins, mins2, std::string(#FAD)+" Min All", out); \
280 success1 = checkResultOnAllProcs(*comm, out, success1); \
282 Teuchos::reduceAll(*comm, fts, Teuchos::REDUCE_MIN, n, &x[0], &mins3[0]); \
283 bool success2 = checkFadArrays( \
284 mins, mins3, std::string(#FAD)+" Min All FTS", out); \
285 success2 = checkResultOnAllProcs(*comm, out, success2); \
287 success = success1 && success2; \
290 TEUCHOS_UNIT_TEST( FAD##_Comm, Fad_ScanSum ) { \
291 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
292 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
296 int rank = comm->getRank(); \
297 ValueTypeSerializer<int,FadType> fts( \
298 rcp(new ValueTypeSerializer<int,double>), p); \
300 Teuchos::Array<FadType> x(n), sums(n), sums2(n), sums3(n); \
301 for (int i=0; i<n; i++) { \
302 x[i] = FadType(p, 1.0*(i+1)); \
303 for (int j=0; j<p; j++) \
304 x[i].fastAccessDx(j) = 2.0*(i+1); \
306 for (int i=0; i<n; i++) { \
307 sums[i] = FadType(p, 1.0*(i+1)*(rank+1)); \
308 for (int j=0; j<p; j++) \
309 sums[i].fastAccessDx(j) = 2.0*(i+1)*(rank+1); \
311 for (int i=0; i<n; i++) { \
312 sums2[i] = FadType(p, 0.0); \
315 Teuchos::scan(*comm, Teuchos::REDUCE_SUM, n, &x[0], &sums2[0]); \
316 bool success1 = checkFadArrays( \
317 sums, sums2, std::string(#FAD)+" Scan Sum", out); \
318 success1 = checkResultOnAllProcs(*comm, out, success1); \
320 Teuchos::scan(*comm, fts, Teuchos::REDUCE_SUM, n, &x[0], &sums3[0]); \
321 bool success2 = checkFadArrays( \
322 sums, sums3, std::string(#FAD)+" Scan Sum FTS", out); \
323 success2 = checkResultOnAllProcs(*comm, out, success2); \
325 success = success1 && success2; \
328 TEUCHOS_UNIT_TEST( FAD##_Comm, Fad_ScanMax ) { \
329 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
330 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
334 int rank = comm->getRank(); \
335 ValueTypeSerializer<int,FadType> fts( \
336 rcp(new ValueTypeSerializer<int,double>), p); \
338 Teuchos::Array<FadType> x(n), maxs(n), maxs2(n), maxs3(n); \
339 for (int i=0; i<n; i++) { \
340 x[i] = FadType(p, 1.0*(i+1)*(rank+1)); \
341 for (int j=0; j<p; j++) \
342 x[i].fastAccessDx(j) = 2.0*(i+1)*(rank+1); \
344 for (int i=0; i<n; i++) { \
345 maxs[i] = FadType(p, 1.0*(i+1)*(rank+1)); \
346 for (int j=0; j<p; j++) \
347 maxs[i].fastAccessDx(j) = 2.0*(i+1)*(rank+1); \
349 for (int i=0; i<n; i++) { \
350 maxs2[i] = FadType(p, 0.0); \
353 Teuchos::scan(*comm, Teuchos::REDUCE_MAX, n, &x[0], &maxs2[0]); \
354 bool success1 = checkFadArrays( \
355 maxs, maxs2, std::string(#FAD)+" Scan Max", out); \
356 success1 = checkResultOnAllProcs(*comm, out, success1); \
358 Teuchos::scan(*comm, fts, Teuchos::REDUCE_MAX, n, &x[0], &maxs3[0]); \
359 bool success2 = checkFadArrays( \
360 maxs, maxs3, std::string(#FAD)+" Scan Max FTS", out); \
361 success2 = checkResultOnAllProcs(*comm, out, success2); \
363 success = success1 && success2; \
366 TEUCHOS_UNIT_TEST( FAD##_Comm, Fad_ScanMin ) { \
367 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
368 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
372 int rank = comm->getRank(); \
373 ValueTypeSerializer<int,FadType> fts( \
374 rcp(new ValueTypeSerializer<int,double>), p); \
376 Teuchos::Array<FadType> x(n), mins(n), mins2(n), mins3(n); \
377 for (int i=0; i<n; i++) { \
378 x[i] = FadType(p, 1.0*(i+1)*(rank+1)); \
379 for (int j=0; j<p; j++) \
380 x[i].fastAccessDx(j) = 2.0*(i+1)*(rank+1); \
382 for (int i=0; i<n; i++) { \
383 mins[i] = FadType(p, 1.0*(i+1)); \
384 for (int j=0; j<p; j++) \
385 mins[i].fastAccessDx(j) = 2.0*(i+1); \
387 for (int i=0; i<n; i++) { \
388 mins2[i] = FadType(p, 0.0); \
391 Teuchos::scan(*comm, Teuchos::REDUCE_MIN, n, &x[0], &mins2[0]); \
392 bool success1 = checkFadArrays( \
393 mins, mins2, std::string(#FAD)+" Scan Min", out); \
394 success1 = checkResultOnAllProcs(*comm, out, success1); \
396 Teuchos::scan(*comm, fts, Teuchos::REDUCE_MIN, n, &x[0], &mins3[0]); \
397 bool success2 = checkFadArrays( \
398 mins, mins3, std::string(#FAD)+" Scan Min FTS", out); \
399 success2 = checkResultOnAllProcs(*comm, out, success2); \
401 success = success1 && success2; \
404 TEUCHOS_UNIT_TEST( FAD##_Comm, Fad_SendReceive ) { \
405 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
406 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
408 int num_proc = comm->getSize(); \
409 if (num_proc > 1) { \
410 int rank = comm->getRank(); \
413 ValueTypeSerializer<int,FadType> fts( \
414 rcp(new ValueTypeSerializer<int,double>), p); \
416 Teuchos::Array<FadType> x(n), x2(n), x3(n); \
417 for (int i=0; i<n; i++) { \
418 x[i] = FadType(p, 1.0*(i+1)); \
419 for (int j=0; j<p; j++) \
420 x[i].fastAccessDx(j) = 2.0*(i+1)*(j+1); \
422 for (int i=0; i<n; i++) { \
423 x2[i] = FadType(p, 0.0); \
430 if (rank == 0) Teuchos::send(*comm, n, &x[0], 1); \
431 if (rank == 1) Teuchos::receive(*comm, 0, n, &x2[0]); \
432 bool success1 = checkFadArrays( \
433 x, x2, std::string(#FAD)+" Send/Receive", out); \
434 success1 = checkResultOnAllProcs(*comm, out, success1); \
436 if (rank == 0) Teuchos::send(*comm, fts, n, &x[0], 1); \
437 if (rank == 1) Teuchos::receive(*comm, fts, 0, n, &x3[0]); \
438 bool success2 = checkFadArrays( \
439 x, x3, std::string(#FAD)+" Send/Receive FTS", out); \
440 success2 = checkResultOnAllProcs(*comm, out, success2); \
442 success = success1 && success2; \
448 TEUCHOS_UNIT_TEST( FAD##_Comm, FadFad_Broadcast ) { \
449 typedef Sacado::mpl::apply<FadType,FadType>::type FadFadType; \
450 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
451 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
456 RCP< ValueTypeSerializer<int,FadType> > fts = \
457 rcp(new ValueTypeSerializer<int,FadType>( \
458 rcp(new ValueTypeSerializer<int,double>), p1)); \
459 ValueTypeSerializer<int,FadFadType> ffts(fts, p2); \
461 Teuchos::Array<FadFadType> x(n), x2(n), x3(n); \
462 for (int i=0; i<n; i++) { \
463 FadType f(p1, rnd.number()); \
464 for (int k=0; k<p1; k++) \
465 f.fastAccessDx(k) = rnd.number(); \
466 x[i] = FadFadType(p2, f); \
467 for (int j=0; j<p2; j++) { \
468 FadType g(p1, rnd.number()); \
469 for (int k=0; k<p1; k++) \
470 g.fastAccessDx(k) = rnd.number(); \
471 x[i].fastAccessDx(j) = g; \
474 for (int i=0; i<n; i++) { \
475 x2[i] = FadFadType(p2, FadType(p1, 0.0)); \
476 for (int j=0; j<p2; j++) \
477 x2[i].fastAccessDx(j) = FadType(p1, 0.0); \
479 if (comm->getRank() == 0) { \
484 Teuchos::broadcast(*comm, 0, n, &x2[0]); \
485 bool success1 = checkFadArrays( \
486 x, x2, std::string(#FAD)+"<"+#FAD+"> Broadcast", out); \
487 success1 = checkResultOnAllProcs(*comm, out, success1); \
489 Teuchos::broadcast(*comm, ffts, 0, n, &x3[0]); \
490 bool success2 = checkFadArrays( \
491 x, x3, std::string(#FAD)+"<"+#FAD+"> Broadcast FTS", out); \
492 success2 = checkResultOnAllProcs(*comm, out, success2); \
494 success = success1 && success2; \
497 TEUCHOS_UNIT_TEST( FAD##_Comm, FadFad_GatherAll ) { \
498 typedef Sacado::mpl::apply<FadType,FadType>::type FadFadType; \
499 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
500 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
505 int size = comm->getSize(); \
506 int rank = comm->getRank(); \
508 RCP< ValueTypeSerializer<int,FadType> > fts = \
509 rcp(new ValueTypeSerializer<int,FadType>( \
510 rcp(new ValueTypeSerializer<int,double>), p1)); \
511 ValueTypeSerializer<int,FadFadType> ffts(fts, p2); \
513 Teuchos::Array<FadFadType> x(n), x2(N), x3(N), x4(N); \
514 for (int i=0; i<n; i++) { \
515 FadType f(p1, (rank+1)*(i+1)); \
516 for (int k=0; k<p1; k++) \
517 f.fastAccessDx(k) = (rank+1)*(i+1)*(k+1); \
518 x[i] = FadFadType(p2, f); \
519 for (int j=0; j<p2; j++) { \
520 x[i].fastAccessDx(j) = f; \
523 for (int i=0; i<N; i++) { \
524 x2[i] = FadFadType(p2, FadType(p1, 0.0)); \
525 for (int j=0; j<p2; j++) \
526 x2[i].fastAccessDx(j) = FadType(p1, 0.0); \
528 for (int j=0; j<size; j++) { \
529 for (int i=0; i<n; i++) { \
530 FadType f(p1, (j+1)*(i+1)); \
531 for (int k=0; k<p1; k++) \
532 f.fastAccessDx(k) = (j+1)*(i+1)*(k+1); \
533 x3[n*j+i] = FadFadType(p2, f); \
534 for (int k=0; k<p2; k++) \
535 x3[n*j+i].fastAccessDx(k) = f; \
539 Teuchos::gatherAll(*comm, n, &x[0], N, &x2[0]); \
540 bool success1 = checkFadArrays( \
541 x3, x2, std::string(#FAD)+"<"+#FAD+"> Gather All", out); \
542 success1 = checkResultOnAllProcs(*comm, out, success1); \
544 Teuchos::gatherAll(*comm, ffts, n, &x[0], N, &x4[0]); \
545 bool success2 = checkFadArrays( \
546 x3, x4, std::string(#FAD)+"<"+#FAD+"> Gather All FTS", out); \
547 success2 = checkResultOnAllProcs(*comm, out, success2); \
549 success = success1 && success2; \
552 TEUCHOS_UNIT_TEST( FAD##_Comm, FadFad_SumAll ) { \
553 typedef Sacado::mpl::apply<FadType,FadType>::type FadFadType; \
554 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
555 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
560 int num_proc = comm->getSize(); \
561 RCP< ValueTypeSerializer<int,FadType> > fts = \
562 rcp(new ValueTypeSerializer<int,FadType>( \
563 rcp(new ValueTypeSerializer<int,double>), p1)); \
564 ValueTypeSerializer<int,FadFadType> ffts(fts, p2); \
566 Teuchos::Array<FadFadType> x(n), sums(n), sums2(n), sums3(n); \
567 for (int i=0; i<n; i++) { \
568 FadType f(p1, 1.0*(i+1)); \
569 for (int k=0; k<p1; k++) \
570 f.fastAccessDx(k) = 2.0*(i+1); \
571 x[i] = FadFadType(p2, f); \
572 for (int j=0; j<p2; j++) { \
573 x[i].fastAccessDx(j) = f; \
576 for (int i=0; i<n; i++) { \
577 FadType f(p1, 1.0*(i+1)*num_proc); \
578 for (int k=0; k<p1; k++) \
579 f.fastAccessDx(k) = 2.0*(i+1)*num_proc; \
580 sums[i] = FadFadType(p2, f); \
581 for (int j=0; j<p2; j++) \
582 sums[i].fastAccessDx(j) = f; \
584 for (int i=0; i<n; i++) { \
585 sums2[i] = FadFadType(p2, FadType(p1, 0.0)); \
586 for (int j=0; j<p2; j++) \
587 sums2[i].fastAccessDx(j) = FadType(p1, 0.0); \
590 Teuchos::reduceAll(*comm, Teuchos::REDUCE_SUM, n, &x[0], &sums2[0]); \
591 bool success1 = checkFadArrays( \
592 sums, sums2, std::string(#FAD)+"<"+#FAD+"> Sum All", out); \
593 success1 = checkResultOnAllProcs(*comm, out, success1); \
595 Teuchos::reduceAll(*comm, ffts, Teuchos::REDUCE_SUM, n, &x[0], &sums3[0]); \
596 bool success2 = checkFadArrays( \
597 sums, sums3, std::string(#FAD)+"<"+#FAD+"> Sum All", out); \
598 success2 = checkResultOnAllProcs(*comm, out, success2); \
600 success = success1 && success2; \
603 TEUCHOS_UNIT_TEST( FAD##_Comm, FadFad_MaxAll ) { \
604 typedef Sacado::mpl::apply<FadType,FadType>::type FadFadType; \
605 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
606 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
611 int rank = comm->getRank(); \
612 int num_proc = comm->getSize(); \
613 RCP< ValueTypeSerializer<int,FadType> > fts = \
614 rcp(new ValueTypeSerializer<int,FadType>( \
615 rcp(new ValueTypeSerializer<int,double>), p1)); \
616 ValueTypeSerializer<int,FadFadType> ffts(fts, p2); \
618 Teuchos::Array<FadFadType> x(n), maxs(n), maxs2(n), maxs3(n); \
619 for (int i=0; i<n; i++) { \
620 FadType f(p1, 1.0*(i+1)*(rank+1)); \
621 for (int k=0; k<p1; k++) \
622 f.fastAccessDx(k) = 2.0*(i+1)*(rank+1); \
623 x[i] = FadFadType(p2, f); \
624 for (int j=0; j<p2; j++) { \
625 x[i].fastAccessDx(j) = f; \
628 for (int i=0; i<n; i++) { \
629 FadType f(p1, 1.0*(i+1)*num_proc); \
630 for (int k=0; k<p1; k++) \
631 f.fastAccessDx(k) = 2.0*(i+1)*num_proc; \
632 maxs[i] = FadFadType(p2, f); \
633 for (int j=0; j<p2; j++) \
634 maxs[i].fastAccessDx(j) = f; \
636 for (int i=0; i<n; i++) { \
637 maxs2[i] = FadFadType(p2, FadType(p1, 0.0)); \
638 for (int j=0; j<p2; j++) \
639 maxs2[i].fastAccessDx(j) = FadType(p1, 0.0); \
642 Teuchos::reduceAll(*comm, Teuchos::REDUCE_MAX, n, &x[0], &maxs2[0]); \
643 bool success1 = checkFadArrays( \
644 maxs, maxs2, std::string(#FAD)+"<"+#FAD+"> Max All", out); \
645 success1 = checkResultOnAllProcs(*comm, out, success1); \
647 Teuchos::reduceAll(*comm, ffts, Teuchos::REDUCE_MAX, n, &x[0], &maxs3[0]); \
648 bool success2 = checkFadArrays( \
649 maxs, maxs3, std::string(#FAD)+"<"+#FAD+"> Max All FTS", out); \
650 success2 = checkResultOnAllProcs(*comm, out, success2); \
652 success = success1 && success2; \
655 TEUCHOS_UNIT_TEST( FAD##_Comm, FadFad_MinAll ) { \
656 typedef Sacado::mpl::apply<FadType,FadType>::type FadFadType; \
657 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
658 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
663 int rank = comm->getRank(); \
664 RCP< ValueTypeSerializer<int,FadType> > fts = \
665 rcp(new ValueTypeSerializer<int,FadType>( \
666 rcp(new ValueTypeSerializer<int,double>), p1)); \
667 ValueTypeSerializer<int,FadFadType> ffts(fts, p2); \
669 Teuchos::Array<FadFadType> x(n), mins(n), mins2(n), mins3(n); \
670 for (int i=0; i<n; i++) { \
671 FadType f(p1, 1.0*(i+1)*(rank+1)); \
672 for (int k=0; k<p1; k++) \
673 f.fastAccessDx(k) = 2.0*(i+1)*(rank+1); \
674 x[i] = FadFadType(p2, f); \
675 for (int j=0; j<p2; j++) { \
676 x[i].fastAccessDx(j) = f; \
679 for (int i=0; i<n; i++) { \
680 FadType f(p1, 1.0*(i+1)); \
681 for (int k=0; k<p1; k++) \
682 f.fastAccessDx(k) = 2.0*(i+1); \
683 mins[i] = FadFadType(p2, f); \
684 for (int j=0; j<p2; j++) \
685 mins[i].fastAccessDx(j) = f; \
687 for (int i=0; i<n; i++) { \
688 mins2[i] = FadFadType(p2, FadType(p1, 0.0)); \
689 for (int j=0; j<p2; j++) \
690 mins2[i].fastAccessDx(j) = FadType(p1, 0.0); \
693 Teuchos::reduceAll(*comm, Teuchos::REDUCE_MIN, n, &x[0], &mins2[0]); \
694 bool success1 = checkFadArrays( \
695 mins, mins2, std::string(#FAD)+"<"+#FAD+"> Min All", out); \
696 success1 = checkResultOnAllProcs(*comm, out, success1); \
698 Teuchos::reduceAll(*comm, ffts, Teuchos::REDUCE_MIN, n, &x[0], &mins3[0]); \
699 bool success2 = checkFadArrays( \
700 mins, mins3, std::string(#FAD)+"<"+#FAD+"> Min All FTS", out); \
701 success2 = checkResultOnAllProcs(*comm, out, success2); \
703 success = success1 && success2; \
706 TEUCHOS_UNIT_TEST( FAD##_Comm, FadFad_ScanSum ) { \
707 typedef Sacado::mpl::apply<FadType,FadType>::type FadFadType; \
708 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
709 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
714 int rank = comm->getRank(); \
715 RCP< ValueTypeSerializer<int,FadType> > fts = \
716 rcp(new ValueTypeSerializer<int,FadType>( \
717 rcp(new ValueTypeSerializer<int,double>), p1)); \
718 ValueTypeSerializer<int,FadFadType> ffts(fts, p2); \
720 Teuchos::Array<FadFadType> x(n), sums(n), sums2(n), sums3(n); \
721 for (int i=0; i<n; i++) { \
722 FadType f(p1, 1.0*(i+1)); \
723 for (int k=0; k<p1; k++) \
724 f.fastAccessDx(k) = 2.0*(i+1); \
725 x[i] = FadFadType(p2, f); \
726 for (int j=0; j<p2; j++) { \
727 x[i].fastAccessDx(j) = f; \
730 for (int i=0; i<n; i++) { \
731 FadType f(p1, 1.0*(i+1)*(rank+1)); \
732 for (int k=0; k<p1; k++) \
733 f.fastAccessDx(k) = 2.0*(i+1)*(rank+1); \
734 sums[i] = FadFadType(p2, f); \
735 for (int j=0; j<p2; j++) \
736 sums[i].fastAccessDx(j) = f; \
738 for (int i=0; i<n; i++) { \
739 sums2[i] = FadFadType(p2, FadType(p1, 0.0)); \
740 for (int j=0; j<p2; j++) \
741 sums2[i].fastAccessDx(j) = FadType(p1, 0.0); \
744 Teuchos::scan(*comm, Teuchos::REDUCE_SUM, n, &x[0], &sums2[0]); \
745 bool success1 = checkFadArrays( \
746 sums, sums2, std::string(#FAD)+"<"+#FAD+"> Scan Sum", out); \
747 success1 = checkResultOnAllProcs(*comm, out, success1); \
749 Teuchos::scan(*comm, ffts, Teuchos::REDUCE_SUM, n, &x[0], &sums3[0]); \
750 bool success2 = checkFadArrays( \
751 sums, sums3, std::string(#FAD)+"<"+#FAD+"> Scan Sum FTS", out); \
752 success2 = checkResultOnAllProcs(*comm, out, success2); \
754 success = success1 && success2; \
757 TEUCHOS_UNIT_TEST( FAD##_Comm, FadFad_ScanMax ) { \
758 typedef Sacado::mpl::apply<FadType,FadType>::type FadFadType; \
759 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
760 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
765 int rank = comm->getRank(); \
766 RCP< ValueTypeSerializer<int,FadType> > fts = \
767 rcp(new ValueTypeSerializer<int,FadType>( \
768 rcp(new ValueTypeSerializer<int,double>), p1)); \
769 ValueTypeSerializer<int,FadFadType> ffts(fts, p2); \
771 Teuchos::Array<FadFadType> x(n), maxs(n), maxs2(n), maxs3(n); \
772 for (int i=0; i<n; i++) { \
773 FadType f(p1, 1.0*(i+1)*(rank+1)); \
774 for (int k=0; k<p1; k++) \
775 f.fastAccessDx(k) = 2.0*(i+1)*(rank+1); \
776 x[i] = FadFadType(p2, f); \
777 for (int j=0; j<p2; j++) { \
778 x[i].fastAccessDx(j) = f; \
781 for (int i=0; i<n; i++) { \
782 FadType f(p1, 1.0*(i+1)*(rank+1)); \
783 for (int k=0; k<p1; k++) \
784 f.fastAccessDx(k) = 2.0*(i+1)*(rank+1); \
785 maxs[i] = FadFadType(p2, f); \
786 for (int j=0; j<p2; j++) \
787 maxs[i].fastAccessDx(j) = f; \
789 for (int i=0; i<n; i++) { \
790 maxs2[i] = FadFadType(p2, FadType(p1, 0.0)); \
791 for (int j=0; j<p2; j++) \
792 maxs2[i].fastAccessDx(j) = FadType(p1, 0.0); \
795 Teuchos::scan(*comm, Teuchos::REDUCE_MAX, n, &x[0], &maxs2[0]); \
796 bool success1 = checkFadArrays( \
797 maxs, maxs2, std::string(#FAD)+"<"+#FAD+"> Scan Max", out); \
798 success1 = checkResultOnAllProcs(*comm, out, success1); \
800 Teuchos::scan(*comm, ffts, Teuchos::REDUCE_MAX, n, &x[0], &maxs3[0]); \
801 bool success2 = checkFadArrays( \
802 maxs, maxs3, std::string(#FAD)+"<"+#FAD+"> Scan Max FTS", out); \
803 success2 = checkResultOnAllProcs(*comm, out, success2); \
805 success = success1 && success2; \
808 TEUCHOS_UNIT_TEST( FAD##_Comm, FadFad_ScanMin ) { \
809 typedef Sacado::mpl::apply<FadType,FadType>::type FadFadType; \
810 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
811 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
816 int rank = comm->getRank(); \
817 RCP< ValueTypeSerializer<int,FadType> > fts = \
818 rcp(new ValueTypeSerializer<int,FadType>( \
819 rcp(new ValueTypeSerializer<int,double>), p1)); \
820 ValueTypeSerializer<int,FadFadType> ffts(fts, p2); \
822 Teuchos::Array<FadFadType> x(n), mins(n), mins2(n), mins3(n); \
823 for (int i=0; i<n; i++) { \
824 FadType f(p1, 1.0*(i+1)*(rank+1)); \
825 for (int k=0; k<p1; k++) \
826 f.fastAccessDx(k) = 2.0*(i+1)*(rank+1); \
827 x[i] = FadFadType(p2, f); \
828 for (int j=0; j<p2; j++) { \
829 x[i].fastAccessDx(j) = f; \
832 for (int i=0; i<n; i++) { \
833 FadType f(p1, 1.0*(i+1)); \
834 for (int k=0; k<p1; k++) \
835 f.fastAccessDx(k) = 2.0*(i+1); \
836 mins[i] = FadFadType(p2, f); \
837 for (int j=0; j<p2; j++) \
838 mins[i].fastAccessDx(j) = f; \
840 for (int i=0; i<n; i++) { \
841 mins2[i] = FadFadType(p2, FadType(p1, 0.0)); \
842 for (int j=0; j<p2; j++) \
843 mins2[i].fastAccessDx(j) = FadType(p1, 0.0); \
846 Teuchos::scan(*comm, Teuchos::REDUCE_MIN, n, &x[0], &mins2[0]); \
847 bool success1 = checkFadArrays( \
848 mins, mins2, std::string(#FAD)+"<"+#FAD+"> Scan Min", out); \
849 success1 = checkResultOnAllProcs(*comm, out, success1); \
851 Teuchos::scan(*comm, ffts, Teuchos::REDUCE_MIN, n, &x[0], &mins3[0]); \
852 bool success2 = checkFadArrays( \
853 mins, mins3, std::string(#FAD)+"<"+#FAD+"> Scan Min FTS", out); \
854 success2 = checkResultOnAllProcs(*comm, out, success2); \
856 success = success1 && success2; \
859 TEUCHOS_UNIT_TEST( FAD##_Comm, FadFad_SendReceive ) { \
860 typedef Sacado::mpl::apply<FadType,FadType>::type FadFadType; \
861 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
862 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
864 int num_proc = comm->getSize(); \
865 if (num_proc > 1) { \
866 int rank = comm->getRank(); \
870 RCP< ValueTypeSerializer<int,FadType> > fts = \
871 rcp(new ValueTypeSerializer<int,FadType>( \
872 rcp(new ValueTypeSerializer<int,double>), p1)); \
873 ValueTypeSerializer<int,FadFadType> ffts(fts, p2); \
875 Teuchos::Array<FadFadType> x(n), x2(n), x3(n); \
876 for (int i=0; i<n; i++) { \
877 FadType f(p1, 1.0*(i+1)); \
878 for (int k=0; k<p1; k++) \
879 f.fastAccessDx(k) = 2.0*(i+1)*(k+1); \
880 x[i] = FadFadType(p2, f); \
881 for (int j=0; j<p2; j++) \
882 x[i].fastAccessDx(j) = f; \
884 for (int i=0; i<n; i++) { \
885 x2[i] = FadFadType(p2, FadType(p1, 0.0)); \
886 for (int j=0; j<p2; j++) \
887 x2[i].fastAccessDx(j) = FadType(p1, 0.0); \
894 if (rank == 0) Teuchos::send(*comm, n, &x[0], 1); \
895 if (rank == 1) Teuchos::receive(*comm, 0, n, &x2[0]); \
896 bool success1 = checkFadArrays( \
897 x, x2, std::string(#FAD)+"<"+#FAD+"> Send/Receive", out); \
898 success1 = checkResultOnAllProcs(*comm, out, success1); \
900 if (rank == 0) Teuchos::send(*comm, ffts, n, &x[0], 1); \
901 if (rank == 1) Teuchos::receive(*comm, ffts, 0, n, &x3[0]); \
902 bool success2 = checkFadArrays( \
903 x, x3, std::string(#FAD)+"<"+#FAD+"> Send/Receive FTS", out); \
904 success2 = checkResultOnAllProcs(*comm, out, success2); \
906 success = success1 && success2; \
912 #if defined(HAVE_SACADO_KOKKOSCORE) && defined(HAVE_SACADO_TEUCHOSKOKKOSCOMM)
914 #include "Kokkos_Core.hpp"
916 #define FAD_KOKKOS_COMM_TESTS_DEV(FadType, FAD, Device) \
917 TEUCHOS_UNIT_TEST( FAD##_Comm_Kokkos_##Device, Fad_Broadcast ) { \
918 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
919 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
924 ValueTypeSerializer<int,FadType> fts( \
925 rcp(new ValueTypeSerializer<int,double>), p); \
927 typedef Kokkos::View<FadType*,Device> ViewType; \
928 typedef ViewType::HostMirror HostViewType; \
929 ViewType x("x",n,p+1), x2("x2",n,p+1), x3("x3",n,p+1); \
930 HostViewType h_x = Kokkos::create_mirror_view(x); \
931 HostViewType h_x2 = Kokkos::create_mirror_view(x2); \
932 HostViewType h_x3 = Kokkos::create_mirror_view(x3); \
933 for (int i=0; i<n; i++) { \
934 h_x[i] = FadType(p, rnd.number()); \
935 for (int j=0; j<p; j++) \
936 h_x[i].fastAccessDx(j) = rnd.number(); \
938 for (int i=0; i<n; i++) { \
939 h_x2[i] = FadType(p, 0.0); \
941 Kokkos::deep_copy(x, h_x); \
942 Kokkos::deep_copy(x2, h_x2); \
943 if (comm->getRank() == 0) { \
948 Teuchos::broadcast(*comm, 0, n, x2); \
949 Kokkos::deep_copy(h_x2, x2); \
950 bool success1 = checkFadArrays( \
951 h_x, h_x2, std::string(#FAD)+" Broadcast", out); \
952 success1 = checkResultOnAllProcs(*comm, out, success1); \
954 Teuchos::broadcast(*comm, fts, 0, n, x3); \
955 Kokkos::deep_copy(h_x3, x3); \
956 bool success2 = checkFadArrays( \
957 h_x, h_x3, std::string(#FAD)+" Broadcast FTS", out); \
958 success2 = checkResultOnAllProcs(*comm, out, success2); \
960 success = success1 && success2; \
962 TEUCHOS_UNIT_TEST( FAD##_Comm_Kokkos_##Device, Fad_SumAll ) { \
963 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
964 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
969 int num_proc = comm->getSize(); \
970 ValueTypeSerializer<int,FadType> fts( \
971 rcp(new ValueTypeSerializer<int,double>), p); \
973 typedef Kokkos::View<FadType*,Device> ViewType; \
974 typedef ViewType::HostMirror HostViewType; \
975 ViewType x("x",n,p+1), sums("sums",n,p+1), \
976 sums2("sums2",n,p+1), sums3("sums3",n,p+1); \
977 HostViewType h_x = Kokkos::create_mirror_view(x); \
978 HostViewType h_sums = Kokkos::create_mirror_view(sums); \
979 HostViewType h_sums2 = Kokkos::create_mirror_view(sums2); \
980 HostViewType h_sums3 = Kokkos::create_mirror_view(sums3); \
981 for (int i=0; i<n; i++) { \
982 h_x[i] = FadType(p, 1.0*(i+1)); \
983 for (int j=0; j<p; j++) \
984 h_x[i].fastAccessDx(j) = 2.0*(i+1); \
986 for (int i=0; i<n; i++) { \
987 h_sums[i] = FadType(p, 1.0*(i+1)*num_proc); \
988 for (int j=0; j<p; j++) \
989 h_sums[i].fastAccessDx(j) = 2.0*(i+1)*num_proc; \
991 for (int i=0; i<n; i++) { \
992 h_sums2[i] = FadType(p, 0.0); \
994 Kokkos::deep_copy(x, h_x); \
995 Kokkos::deep_copy(sums, h_sums); \
996 Kokkos::deep_copy(sums2, h_sums2); \
998 Teuchos::reduceAll(*comm, Teuchos::REDUCE_SUM, n, x, sums2); \
999 Kokkos::deep_copy(h_sums2, sums2); \
1000 bool success1 = checkFadArrays( \
1001 h_sums, h_sums2, std::string(#FAD)+" Sum All", out); \
1002 success1 = checkResultOnAllProcs(*comm, out, success1); \
1004 Teuchos::reduceAll(*comm, fts, Teuchos::REDUCE_SUM, n, x, sums3); \
1005 Kokkos::deep_copy(h_sums3, sums3); \
1006 bool success2 = checkFadArrays( \
1007 h_sums, h_sums3, std::string(#FAD)+" Sum All FTS", out); \
1008 success2 = checkResultOnAllProcs(*comm, out, success2); \
1009 success = success1 && success2; \
1012 TEUCHOS_UNIT_TEST( FAD##_Comm_Kokkos_##Device, Fad_MaxAll ) { \
1013 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
1014 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
1019 int rank = comm->getRank(); \
1020 int num_proc = comm->getSize(); \
1021 ValueTypeSerializer<int,FadType> fts( \
1022 rcp(new ValueTypeSerializer<int,double>), p); \
1024 typedef Kokkos::View<FadType*,Device> ViewType; \
1025 typedef ViewType::HostMirror HostViewType; \
1026 ViewType x("x",n,p+1), maxs("maxs",n,p+1), \
1027 maxs2("maxs2",n,p+1), maxs3("maxs3",n,p+1); \
1028 HostViewType h_x = Kokkos::create_mirror_view(x); \
1029 HostViewType h_maxs = Kokkos::create_mirror_view(maxs); \
1030 HostViewType h_maxs2 = Kokkos::create_mirror_view(maxs2); \
1031 HostViewType h_maxs3 = Kokkos::create_mirror_view(maxs3); \
1032 for (int i=0; i<n; i++) { \
1033 h_x[i] = FadType(p, 1.0*(i+1)*(rank+1)); \
1034 for (int j=0; j<p; j++) \
1035 h_x[i].fastAccessDx(j) = 2.0*(i+1)*(rank+1); \
1037 for (int i=0; i<n; i++) { \
1038 h_maxs[i] = FadType(p, 1.0*(i+1)*num_proc); \
1039 for (int j=0; j<p; j++) \
1040 h_maxs[i].fastAccessDx(j) = 2.0*(i+1)*num_proc; \
1042 for (int i=0; i<n; i++) { \
1043 h_maxs2[i] = FadType(p, 0.0); \
1045 Kokkos::deep_copy(x, h_x); \
1046 Kokkos::deep_copy(maxs, h_maxs); \
1047 Kokkos::deep_copy(maxs2, h_maxs2); \
1049 Teuchos::reduceAll(*comm, Teuchos::REDUCE_MAX, n, x, maxs2); \
1050 Kokkos::deep_copy(h_maxs2, maxs2); \
1051 bool success1 = checkFadArrays( \
1052 h_maxs, h_maxs2, std::string(#FAD)+" Max All", out); \
1053 success1 = checkResultOnAllProcs(*comm, out, success1); \
1055 Teuchos::reduceAll(*comm, fts, Teuchos::REDUCE_MAX, n, x, maxs3); \
1056 Kokkos::deep_copy(h_maxs3, maxs3); \
1057 bool success2 = checkFadArrays( \
1058 h_maxs, h_maxs3, std::string(#FAD)+" Max All FTS", out); \
1059 success2 = checkResultOnAllProcs(*comm, out, success2); \
1060 success = success1 && success2; \
1063 TEUCHOS_UNIT_TEST( FAD##_Comm_Kokkos_##Device, Fad_MinAll ) { \
1064 Teuchos::RCP<const Teuchos::Comm<Ordinal> > \
1065 comm = Teuchos::DefaultComm<Ordinal>::getComm(); \
1070 int rank = comm->getRank(); \
1071 ValueTypeSerializer<int,FadType> fts( \
1072 rcp(new ValueTypeSerializer<int,double>), p); \
1074 typedef Kokkos::View<FadType*,Device> ViewType; \
1075 typedef ViewType::HostMirror HostViewType; \
1076 ViewType x("x",n,p+1), mins("mins",n,p+1), \
1077 mins2("mins2",n,p+1), mins3("mins3",n,p+1); \
1078 HostViewType h_x = Kokkos::create_mirror_view(x); \
1079 HostViewType h_mins = Kokkos::create_mirror_view(mins); \
1080 HostViewType h_mins2 = Kokkos::create_mirror_view(mins2); \
1081 HostViewType h_mins3 = Kokkos::create_mirror_view(mins3); \
1082 for (int i=0; i<n; i++) { \
1083 h_x[i] = FadType(p, 1.0*(i+1)*(rank+1)); \
1084 for (int j=0; j<p; j++) \
1085 h_x[i].fastAccessDx(j) = 2.0*(i+1)*(rank+1); \
1087 for (int i=0; i<n; i++) { \
1088 h_mins[i] = FadType(p, 1.0*(i+1)); \
1089 for (int j=0; j<p; j++) \
1090 h_mins[i].fastAccessDx(j) = 2.0*(i+1); \
1092 for (int i=0; i<n; i++) { \
1093 h_mins2[i] = FadType(p, 0.0); \
1095 Kokkos::deep_copy(x, h_x); \
1096 Kokkos::deep_copy(mins, h_mins); \
1097 Kokkos::deep_copy(mins2, h_mins2); \
1099 Teuchos::reduceAll(*comm, Teuchos::REDUCE_MIN, n, x, mins2); \
1100 Kokkos::deep_copy(h_mins2, mins2); \
1101 bool success1 = checkFadArrays( \
1102 h_mins, h_mins2, std::string(#FAD)+" Min All", out); \
1103 success1 = checkResultOnAllProcs(*comm, out, success1); \
1105 Teuchos::reduceAll(*comm, fts, Teuchos::REDUCE_MIN, n, x, mins3); \
1106 Kokkos::deep_copy(h_mins3, mins3); \
1107 bool success2 = checkFadArrays( \
1108 h_mins, h_mins3, std::string(#FAD)+" Min All FTS", out); \
1109 success2 = checkResultOnAllProcs(*comm, out, success2); \
1110 success = success1 && success2; \
1114 #ifdef KOKKOS_ENABLE_OPENMP
1115 #define FAD_KOKKOS_COMM_TESTS_OPENMP(FadType, FAD) \
1116 using Kokkos::OpenMP; \
1117 FAD_KOKKOS_COMM_TESTS_DEV(FadType, FAD, OpenMP)
1119 #define FAD_KOKKOS_COMM_TESTS_OPENMP(FadType, FAD)
1122 #ifdef KOKKOS_ENABLE_THREADS
1123 #define FAD_KOKKOS_COMM_TESTS_THREADS(FadType, FAD) \
1124 using Kokkos::Threads; \
1125 FAD_KOKKOS_COMM_TESTS_DEV(FadType, FAD, Threads)
1127 #define FAD_KOKKOS_COMM_TESTS_THREADS(FadType, FAD)
1130 #ifdef KOKKOS_ENABLE_CUDA
1131 #define FAD_KOKKOS_COMM_TESTS_CUDA(FadType, FAD) \
1132 using Kokkos::Cuda; \
1133 FAD_KOKKOS_COMM_TESTS_DEV(FadType, FAD, Cuda)
1135 #define FAD_KOKKOS_COMM_TESTS_CUDA(FadType, FAD)
1138 #ifdef KOKKOS_ENABLE_SERIAL
1139 #define FAD_KOKKOS_COMM_TESTS_SERIAL(FadType, FAD) \
1140 using Kokkos::Serial; \
1141 FAD_KOKKOS_COMM_TESTS_DEV(FadType, FAD, Serial)
1143 #define FAD_KOKKOS_COMM_TESTS_SERIAL(FadType, FAD)
1146 #define FAD_KOKKOS_COMM_TESTS(FadType, FAD) \
1147 FAD_KOKKOS_COMM_TESTS_OPENMP(FadType, FAD) \
1148 FAD_KOKKOS_COMM_TESTS_THREADS(FadType, FAD) \
1149 FAD_KOKKOS_COMM_TESTS_CUDA(FadType, FAD) \
1150 FAD_KOKKOS_COMM_TESTS_SERIAL(FadType, FAD)
1154 #define FAD_KOKKOS_COMM_TESTS(FadType, FAD)
1158 #define FAD_COMM_TESTS(FadType, FAD) \
1159 FAD_BASE_COMM_TESTS(FadType, FAD)
static KOKKOS_INLINE_FUNCTION bool eval(const T &x, const T &y)
Sacado::Fad::DFad< double > FadType
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
bool checkFadArrays(const ArrayType &x, const ArrayType &x2, const std::string &tag, Teuchos::FancyOStream &out)
bool checkResultOnAllProcs(const Teuchos::Comm< Ordinal > &comm, Teuchos::FancyOStream &out, const bool result)
TEUCHOS_DEPRECATED void reduceAll(const Comm< Ordinal > &comm, const EReductionType reductType, const Packet &send, Packet *globalReduct)