Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Tpetra_Details_DefaultTypes.hpp
1 // @HEADER
2 // *****************************************************************************
3 // Tpetra: Templated Linear Algebra Services Package
4 //
5 // Copyright 2008 NTESS and the Tpetra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef TPETRA_DETAILS_DEFAULTTYPES_HPP
11 #define TPETRA_DETAILS_DEFAULTTYPES_HPP
12 
13 #include "TpetraCore_config.h"
14 #include "Tpetra_KokkosClassic_DefaultNode_config.h"
15 #include "Tpetra_KokkosCompat_ClassicNodeAPI_Wrapper.hpp"
16 
18 namespace Tpetra {
19 
22 namespace Details {
23 
29 namespace DefaultTypes {
31 #if defined(HAVE_TPETRA_INST_DOUBLE)
32  using scalar_type = double;
33 #elif defined(HAVE_TPETRA_INST_FLOAT)
34  using scalar_type = float;
35 #else
36 # error "Tpetra: No scalar types in the set {float, double} have been enabled."
37 #endif
38 
40  using local_ordinal_type = int;
41 
44 #if defined(HAVE_TPETRA_INST_INT_LONG_LONG)
45  using global_ordinal_type = long long;
46 #elif defined(HAVE_TPETRA_INST_INT_INT)
47  using global_ordinal_type = int;
48 #elif defined(HAVE_TPETRA_INST_INT_LONG)
49  using global_ordinal_type = long;
50 #elif defined(HAVE_TPETRA_INST_INT_UNSIGNED_LONG)
51  using global_ordinal_type = unsigned long;
52 #elif defined(HAVE_TPETRA_INST_INT_UNSIGNED)
53  using global_ordinal_type = unsigned;
54 #else
55  #error "Tpetra: No global ordinal types in the set {int, long long, long, unsigned long, unsigned} have been enabled."
56 #endif
57 
60 #if defined(HAVE_TPETRA_DEFAULTNODE_SYCLWRAPPERNODE)
61  using execution_space = ::Kokkos::Experimental::SYCL;
62  using node_type = Tpetra::KokkosCompat::KokkosSYCLWrapperNode;
63 #elif defined(HAVE_TPETRA_DEFAULTNODE_HIPWRAPPERNODE)
64  using execution_space = ::Kokkos::HIP;
65  using node_type = Tpetra::KokkosCompat::KokkosHIPWrapperNode;
66 #elif defined(HAVE_TPETRA_DEFAULTNODE_CUDAWRAPPERNODE)
67  using execution_space = ::Kokkos::Cuda;
68  using node_type = Tpetra::KokkosCompat::KokkosCudaWrapperNode;
69 #elif defined(HAVE_TPETRA_DEFAULTNODE_OPENMPWRAPPERNODE)
70  using execution_space = ::Kokkos::OpenMP;
71  using node_type = Tpetra::KokkosCompat::KokkosOpenMPWrapperNode;
72 #elif defined(HAVE_TPETRA_DEFAULTNODE_THREADSWRAPPERNODE)
73  using execution_space = ::Kokkos::Threads;
74  using node_type = Tpetra::KokkosCompat::KokkosThreadsWrapperNode;
75 #elif defined(HAVE_TPETRA_DEFAULTNODE_SERIALWRAPPERNODE)
76  using execution_space = ::Kokkos::Serial;
77  using node_type = Tpetra::KokkosCompat::KokkosSerialWrapperNode;
78 #else
79 # error "No default Tpetra Node type specified. Please set the CMake option Tpetra_DefaultNode to a valid Node type."
80 #endif
81 
85 
86  template<typename ExecutionSpace>
88  {
89  using type = typename ExecutionSpace::memory_space;
90  };
91 
92 #ifdef KOKKOS_ENABLE_CUDA
93  template<>
94  struct CommBufferMemorySpace<Kokkos::Cuda>
95  {
96  using type = Kokkos::CudaSpace;
97  };
98 #endif
99 
100 #ifdef KOKKOS_ENABLE_HIP
101  template<>
102  struct CommBufferMemorySpace<Kokkos::HIP>
103  {
104  using type = Kokkos::HIPSpace;
105  };
106 #endif
107 
108 #ifdef KOKKOS_ENABLE_SYCL
109  template<>
110  struct CommBufferMemorySpace<Kokkos::Experimental::SYCL>
111  {
112  using type = Kokkos::Experimental::SYCLDeviceUSMSpace;
113  };
114 #endif
115 
116  template<typename Device>
117  using comm_buffer_memory_space = typename CommBufferMemorySpace<typename Device::execution_space>::type;
118 
119 } // namespace DefaultTypes
120 
121 } // namespace Details
122 
123 } // namespace Tpetra
124 
125 #endif // TPETRA_DETAILS_DEFAULTTYPES_HPP
int local_ordinal_type
Default value of Scalar template parameter.
Memory space used for MPI communication buffers.