Stokhos Package Browser (Single Doxygen Collection)
Version of the Day
test
UnitTest
Stokhos_KokkosArrayKernelsUnitTest_Cuda.cpp
Go to the documentation of this file.
1
// @HEADER
2
// ***********************************************************************
3
//
4
// Stokhos Package
5
// Copyright (2009) Sandia Corporation
6
//
7
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8
// license for use of this work by or on behalf of the U.S. Government.
9
//
10
// This library is free software; you can redistribute it and/or modify
11
// it under the terms of the GNU Lesser General Public License as
12
// published by the Free Software Foundation; either version 2.1 of the
13
// License, or (at your option) any later version.
14
//
15
// This library is distributed in the hope that it will be useful, but
16
// WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
// Lesser General Public License for more details.
19
//
20
// You should have received a copy of the GNU Lesser General Public
21
// License along with this library; if not, write to the Free Software
22
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23
// USA
24
// Questions? Contact Eric T. Phipps (etphipp@sandia.gov).
25
//
26
// ***********************************************************************
27
// @HEADER
28
29
// Utilities
30
#include "
Teuchos_UnitTestHarness.hpp
"
31
#include "
Teuchos_UnitTestRepository.hpp
"
32
#include "
Teuchos_GlobalMPISession.hpp
"
33
34
// Device
35
#include "Kokkos_Core.hpp"
36
37
// Kernels
38
#include "
Stokhos_Cuda_CrsMatrix.hpp
"
39
#include "
Stokhos_Cuda_BlockCrsMatrix.hpp
"
40
#include "
Stokhos_Cuda_StochasticProductTensor.hpp
"
41
#include "
Stokhos_Cuda_SymmetricDiagonalSpec.hpp
"
42
#include "
Stokhos_Cuda_CrsProductTensor.hpp
"
43
#include "
Stokhos_Cuda_TiledCrsProductTensor.hpp
"
44
#include "
Stokhos_Cuda_SimpleTiledCrsProductTensor.hpp
"
45
#include "
Stokhos_Cuda_CooProductTensor.hpp
"
46
#include "
Stokhos_Cuda_LinearSparse3Tensor.hpp
"
47
48
// Tests
49
#include "
Stokhos_KokkosArrayKernelsUnitTest.hpp
"
50
51
using namespace
KokkosKernelsUnitTest
;
52
53
UnitTestSetup<Kokkos::Cuda>
setup
;
54
55
// Test declarations
56
#include "
Stokhos_KokkosArrayKernelsUnitTestDecl.hpp
"
57
58
// Not all of the generic kernels work with Cuda because of the way
59
// the Cuda StochasticProductTensor specialization is done
60
61
using
Kokkos::Cuda;
62
63
// The Tiled-Crs kernel seems to fail when OpenMP is the host device
64
#ifdef KOKKOS_ENABLE_OPENMP
65
#define TILED_CRS_TEST(SCALAR, DEVICE)
66
#else
67
#define TILED_CRS_TEST(SCALAR, DEVICE) \
68
TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, TiledCrsProductTensor, SCALAR, DEVICE )
69
#endif
70
71
#define UNIT_TEST_GROUP_SCALAR_CUDA( SCALAR ) \
72
TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CrsMatrixFree, SCALAR, Cuda ) \
73
TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CrsMatrixFreeView, SCALAR, Cuda ) \
74
TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CrsMatrixFreeKokkos, SCALAR, Cuda ) \
75
TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CrsMatrixFreeSingleCol, SCALAR, Cuda ) \
76
TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CrsDenseBlock, SCALAR, Cuda ) \
77
TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CrsFlatCommuted, SCALAR, Cuda ) \
78
TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CrsFlatOriginal, SCALAR, Cuda ) \
79
TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CrsProductTensor, SCALAR, Cuda ) \
80
TILED_CRS_TEST(SCALAR, Cuda ) \
81
TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CooProductTensorPacked, SCALAR, Cuda ) \
82
TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, CooProductTensorUnpacked, SCALAR, Cuda ) \
83
TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, LinearTensorSymmetric, SCALAR, Cuda ) \
84
TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, LinearTensorAsymmetric, SCALAR, Cuda )
85
86
// Commenting this one out -- it may be generating memory errors
87
// TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( Kokkos_SG_SpMv, SimpleTiledCrsProductTensor, SCALAR, Cuda )
88
89
UNIT_TEST_GROUP_SCALAR_CUDA
(
double
)
90
91
int
main
(
int
argc,
char
*
argv
[] ) {
92
Teuchos::GlobalMPISession
mpiSession(&argc, &
argv
);
93
94
// Initialize Cuda
95
Kokkos::InitArguments init_args;
96
init_args.device_id = 0;
97
Kokkos::initialize( init_args );
98
Kokkos::print_configuration( std::cout );
99
100
// Setup (has to happen after initialization)
101
setup
.setup();
102
103
// Run tests
104
int
ret =
Teuchos::UnitTestRepository::runUnitTestsFromMain
(argc,
argv
);
105
106
// Finish up
107
Kokkos::finalize();
108
109
return
ret;
110
}
Stokhos_Cuda_CrsMatrix.hpp
Stokhos_Cuda_SimpleTiledCrsProductTensor.hpp
Stokhos_Cuda_StochasticProductTensor.hpp
KokkosKernelsUnitTest
Definition:
Stokhos_KokkosArrayKernelsUnitTest.hpp:82
Stokhos_Cuda_LinearSparse3Tensor.hpp
Stokhos_Cuda_CrsProductTensor.hpp
setup
UnitTestSetup< Kokkos::Cuda > setup
Definition:
Stokhos_KokkosArrayKernelsUnitTest_Cuda.cpp:53
KokkosKernelsUnitTest::UnitTestSetup
Definition:
Stokhos_KokkosArrayKernelsUnitTest.hpp:164
Teuchos::GlobalMPISession
Teuchos_UnitTestHarness.hpp
Teuchos_UnitTestRepository.hpp
Stokhos_Cuda_BlockCrsMatrix.hpp
Stokhos_Cuda_TiledCrsProductTensor.hpp
Stokhos_KokkosArrayKernelsUnitTest.hpp
Stokhos_Cuda_CooProductTensor.hpp
UNIT_TEST_GROUP_SCALAR_CUDA
#define UNIT_TEST_GROUP_SCALAR_CUDA(SCALAR)
Definition:
Stokhos_KokkosArrayKernelsUnitTest_Cuda.cpp:71
Teuchos_GlobalMPISession.hpp
Stokhos_Cuda_SymmetricDiagonalSpec.hpp
Teuchos::UnitTestRepository::runUnitTestsFromMain
static int runUnitTestsFromMain(int argc, char *argv[])
int
int
Definition:
tpetra_mat_vec.cpp:243
Stokhos_KokkosArrayKernelsUnitTestDecl.hpp
main
int main(int argc, char *argv[])
Definition:
Stokhos_KokkosArrayKernelsUnitTest_Cuda.cpp:91
argv
char * argv[]
Definition:
Stokhos_HouseTriDiagUnitTest.cpp:286
Generated by
1.8.16