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_Cuda_Hierarchical.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 // Re-test cuda with hierarchical cuda parallelism turned on (experimental)
15 #define SACADO_VIEW_CUDA_HIERARCHICAL 1
16 #define SACADO_VIEW_CUDA_HIERARCHICAL_DFAD_STRIDED 1
17 #define SACADO_KOKKOS_USE_MEMORY_POOL 1
18 
19 #include "Kokkos_Macros.hpp"
20 
21 #define SACADO_TEST_DFAD 1
22 
23 #include "Fad_KokkosTests.hpp"
24 
27 #undef VIEW_FAD_TESTS_FDC
28 #define VIEW_FAD_TESTS_FDC( F, D ) \
29  VIEW_FAD_TESTS_FLD( F, LeftContiguous32, D ) \
30  VIEW_FAD_TESTS_FLD( F, RightContiguous32, D )
31 
32 #undef VIEW_FAD_TESTS_SFDC
33 #define VIEW_FAD_TESTS_SFDC( F, D ) \
34  VIEW_FAD_TESTS_SFLD( F, LeftContiguous32, D ) \
35  VIEW_FAD_TESTS_SFLD( F, RightContiguous32, D )
36 
37 // Instantiate tests for Cuda device
38 using Kokkos::Cuda;
39 VIEW_FAD_TESTS_D( Cuda )
40 
41 int main( int argc, char* argv[] ) {
42  Teuchos::GlobalMPISession mpiSession(&argc, &argv);
43 
44  // Initialize Cuda
45  Kokkos::InitializationSettings init_args;
46  init_args.set_device_id(0);
47  Kokkos::initialize( init_args );
48  Kokkos::print_configuration(std::cout);
49 
50 #if defined(SACADO_KOKKOS_USE_MEMORY_POOL)
52  Kokkos::Cuda(),
54  global_fad_size*sizeof(double),
55  4*global_fad_size*sizeof(double),
56  128*global_fad_size*sizeof(double)
57  );
58 #endif
59 
61 
62 #if defined(SACADO_KOKKOS_USE_MEMORY_POOL)
63  Sacado::destroyGlobalMemoryPool(Kokkos::Cuda());
64 #endif
65 
66  // Finalize Cuda
67  Kokkos::finalize();
68 
69  return res;
70 }
void createGlobalMemoryPool(const ExecSpace &space, const size_t min_total_alloc_size, const uint32_t min_block_alloc_size, const uint32_t max_block_alloc_size, const uint32_t min_superblock_size)
const int global_fad_size
Kokkos::LayoutContiguous< Kokkos::LayoutRight, 32 > RightContiguous32
const int global_num_rows
static int runUnitTestsFromMain(int argc, char *argv[])
const int global_num_cols
int main()
Definition: ad_example.cpp:171
void destroyGlobalMemoryPool(const ExecSpace &space)
#define VIEW_FAD_TESTS_D(D)
Kokkos::LayoutContiguous< Kokkos::LayoutLeft, 32 > LeftContiguous32