Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_KokkosArrayKernelsUnitTest_Cuda.cpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 // Utilities
14 
15 // Device
16 #include "Kokkos_Core.hpp"
17 
18 // Kernels
28 
29 // Tests
31 
32 using namespace KokkosKernelsUnitTest;
33 
35 
36 // Test declarations
38 
39 // Not all of the generic kernels work with Cuda because of the way
40 // the Cuda StochasticProductTensor specialization is done
41 
42 using Kokkos::Cuda;
43 
44 // The Tiled-Crs kernel seems to fail when OpenMP is the host device
45 #ifdef KOKKOS_ENABLE_OPENMP
46 #define TILED_CRS_TEST(SCALAR, DEVICE)
47 #else
48 #define TILED_CRS_TEST(SCALAR, DEVICE) \
49 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, TiledCrsProductTensor, SCALAR, DEVICE )
50 #endif
51 
52 #define UNIT_TEST_GROUP_SCALAR_CUDA( SCALAR ) \
53  TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CrsMatrixFree, SCALAR, Cuda ) \
54  TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CrsMatrixFreeView, SCALAR, Cuda ) \
55  TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CrsMatrixFreeKokkos, SCALAR, Cuda ) \
56  TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CrsMatrixFreeSingleCol, SCALAR, Cuda ) \
57  TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CrsDenseBlock, SCALAR, Cuda ) \
58  TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CrsFlatCommuted, SCALAR, Cuda ) \
59  TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CrsFlatOriginal, SCALAR, Cuda ) \
60  TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CrsProductTensor, SCALAR, Cuda ) \
61  TILED_CRS_TEST(SCALAR, Cuda ) \
62  TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CooProductTensorPacked, SCALAR, Cuda ) \
63  TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CooProductTensorUnpacked, SCALAR, Cuda ) \
64  TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, LinearTensorSymmetric, SCALAR, Cuda ) \
65  TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, LinearTensorAsymmetric, SCALAR, Cuda )
66 
67 // Commenting this one out -- it may be generating memory errors
68 // TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, SimpleTiledCrsProductTensor, SCALAR, Cuda )
69 
71 
72 int main( int argc, char* argv[] ) {
73  Teuchos::GlobalMPISession mpiSession(&argc, &argv);
74 
75  // Initialize Cuda
76  Kokkos::InitializationSettings init_args;
77  init_args.set_device_id(0);
78  Kokkos::initialize( init_args );
79  Kokkos::print_configuration( std::cout );
80 
81  // Setup (has to happen after initialization)
82  setup.setup();
83 
84  // Run tests
86 
87  // Finish up
88  Kokkos::finalize();
89 
90  return ret;
91 }
#define UNIT_TEST_GROUP_SCALAR_CUDA(SCALAR)
static int runUnitTestsFromMain(int argc, char *argv[])
int main(int argc, char **argv)