Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
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
18namespace Tpetra {
19
22namespace Details {
23
29namespace DefaultTypes {
31#if defined(HAVE_TPETRA_INST_DOUBLE)
32using scalar_type = double;
33#elif defined(HAVE_TPETRA_INST_FLOAT)
34using scalar_type = float;
35#else
36#error "Tpetra: No scalar types in the set {float, double} have been enabled."
37#endif
38
41
44#if defined(HAVE_TPETRA_INST_INT_LONG_LONG)
45using global_ordinal_type = long long;
46#elif defined(HAVE_TPETRA_INST_INT_INT)
47using global_ordinal_type = int;
48#elif defined(HAVE_TPETRA_INST_INT_LONG)
49using global_ordinal_type = long;
50#elif defined(HAVE_TPETRA_INST_INT_UNSIGNED_LONG)
51using global_ordinal_type = unsigned long;
52#elif defined(HAVE_TPETRA_INST_INT_UNSIGNED)
53using 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)
61using execution_space = ::Kokkos::Experimental::SYCL;
62using node_type = Tpetra::KokkosCompat::KokkosSYCLWrapperNode;
63#elif defined(HAVE_TPETRA_DEFAULTNODE_HIPWRAPPERNODE)
64using execution_space = ::Kokkos::HIP;
65using node_type = Tpetra::KokkosCompat::KokkosHIPWrapperNode;
66#elif defined(HAVE_TPETRA_DEFAULTNODE_CUDAWRAPPERNODE)
67using execution_space = ::Kokkos::Cuda;
68using node_type = Tpetra::KokkosCompat::KokkosCudaWrapperNode;
69#elif defined(HAVE_TPETRA_DEFAULTNODE_OPENMPWRAPPERNODE)
70using execution_space = ::Kokkos::OpenMP;
71using node_type = Tpetra::KokkosCompat::KokkosOpenMPWrapperNode;
72#elif defined(HAVE_TPETRA_DEFAULTNODE_THREADSWRAPPERNODE)
73using execution_space = ::Kokkos::Threads;
74using node_type = Tpetra::KokkosCompat::KokkosThreadsWrapperNode;
75#elif defined(HAVE_TPETRA_DEFAULTNODE_SERIALWRAPPERNODE)
76using execution_space = ::Kokkos::Serial;
77using 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
86template <typename ExecutionSpace>
88 using type = typename ExecutionSpace::memory_space;
89};
90
91#ifdef KOKKOS_ENABLE_CUDA
92template <>
94 using type = Kokkos::CudaSpace;
95};
96#endif
97
98#ifdef KOKKOS_ENABLE_HIP
99template <>
100struct CommBufferMemorySpace<Kokkos::HIP> {
101 using type = Kokkos::HIPSpace;
102};
103#endif
104
105#ifdef KOKKOS_ENABLE_SYCL
106template <>
107struct CommBufferMemorySpace<Kokkos::Experimental::SYCL> {
108 using type = Kokkos::Experimental::SYCLDeviceUSMSpace;
109};
110#endif
111
112template <typename Device>
113using comm_buffer_memory_space = typename CommBufferMemorySpace<typename Device::execution_space>::type;
114
115} // namespace DefaultTypes
116
117} // namespace Details
118
119} // namespace Tpetra
120
121#endif // TPETRA_DETAILS_DEFAULTTYPES_HPP
Struct that holds views of the contents of a CrsMatrix.
Implementation details of Tpetra.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Memory space used for MPI communication buffers.