Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fad_KokkosTests_Serial.cpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Sacado Package
4 //
5 // Copyright 2006 NTESS and the Sacado contributors.
6 // SPDX-License-Identifier: LGPL-2.1-or-later
7 // *****************************************************************************
8 // @HEADER
9 
13 
14 #define SACADO_TEST_DFAD 1
15 #include "Fad_KokkosTests.hpp"
16 
17 // Instantiate tests for Serial device
18 using Kokkos::Serial;
19 VIEW_FAD_TESTS_D( Serial )
20 
21 // Add a unit test verifying something from Albany compiles
22 TEUCHOS_UNIT_TEST(Kokkos_View_Fad, DynRankMauroDeepCopy )
23 {
24  Kokkos::DynRankView<Sacado::Fad::DFad<double>,Kokkos::Serial> v1(
25  "v1", 3, 5);
26  Kokkos::DynRankView<Sacado::Fad::DFad<double>,Kokkos::LayoutRight,Kokkos::HostSpace> v2("v2", 3 , 5);
27 
28  Kokkos::deep_copy(v1, v2);
29 
30  // We're just verifying this compiles
31  success = true;
32 }
33 
34 // Tests assignment between ViewFad and Fad of different type
35 TEUCHOS_UNIT_TEST(Kokkos_View_Fad, MixedViewFadTypes )
36 {
37  const int StaticDim = 5;
38  typedef Sacado::Fad::SFad<double,StaticDim> FadType1;
39  typedef Sacado::Fad::SLFad<double,StaticDim> FadType2;
40  typedef Kokkos::View<FadType1*,Kokkos::Serial> ViewType;
41 
42  const size_t num_rows = 11;
43  const size_t fad_size = StaticDim;
44  ViewType v("v", num_rows, fad_size+1);
45 
46  FadType2 x = 0.0;
47  x = v(1);
48 
49  const size_t sz = x.size();
50  TEUCHOS_TEST_EQUALITY(sz, fad_size, out, success);
51 }
52 
53 int main( int argc, char* argv[] ) {
54  Teuchos::GlobalMPISession mpiSession(&argc, &argv);
55 
56  // Initialize serial
57  Kokkos::initialize(argc,argv);
58 
60 
61  Kokkos::finalize();
62 
63  return res;
64 }
TEUCHOS_UNIT_TEST(Conversion, IsConvertible)
static int runUnitTestsFromMain(int argc, char *argv[])
int main()
Definition: ad_example.cpp:171
#define TEUCHOS_TEST_EQUALITY(v1, v2, out, success)
#define VIEW_FAD_TESTS_D(D)