10 #ifndef TPETRA_DETAILS_EXECUTIONSPACESUSER_HPP
11 #define TPETRA_DETAILS_EXECUTIONSPACESUSER_HPP
17 #include <Kokkos_Core.hpp>
19 #include "Teuchos_RCP.hpp"
21 #include "Tpetra_Details_ExecutionSpacesSlot.hpp"
36 #ifdef KOKKOS_ENABLE_CUDA
46 template <
typename ExecSpace,
47 Spaces::Priority priority = Spaces::Priority::medium,
48 Spaces::IsCuda<ExecSpace> =
true>
49 Teuchos::RCP<const ExecSpace> space_instance()
const {
50 return cudaSlot.space_instance<priority>();
62 template <
typename ExecSpace, Spaces::IsCuda<ExecSpace> = true>
63 Teuchos::RCP<const ExecSpace>
64 space_instance(
const Spaces::Priority &priority)
const {
65 return cudaSlot.space_instance(priority);
67 #endif // KOKKOS_ENABLE_CUDA
69 #ifdef KOKKOS_ENABLE_SERIAL
70 template <
typename ExecSpace,
71 Spaces::Priority priority = Spaces::Priority::medium,
72 Spaces::IsSerial<ExecSpace> =
true>
73 Teuchos::RCP<const ExecSpace> space_instance()
const {
74 return serialSlot.space_instance<priority>();
76 template <
typename ExecSpace, Spaces::IsSerial<ExecSpace> = true>
77 Teuchos::RCP<const ExecSpace>
78 space_instance(
const Spaces::Priority &priority)
const {
79 return serialSlot.space_instance(priority);
81 #endif // KOKKOS_ENABLE_SERIAL
83 #ifdef KOKKOS_ENABLE_OPENMP
84 template <
typename ExecSpace,
85 Spaces::Priority priority = Spaces::Priority::medium,
86 Spaces::IsOpenMP<ExecSpace> =
true>
87 Teuchos::RCP<const ExecSpace> space_instance()
const {
88 return openMPSlot.space_instance<priority>();
90 template <
typename ExecSpace, Spaces::IsOpenMP<ExecSpace> = true>
91 Teuchos::RCP<const ExecSpace>
92 space_instance(
const Spaces::Priority &priority)
const {
93 return openMPSlot.space_instance(priority);
95 #endif // KOKKOS_ENABLE_OPENMP
97 #ifdef KOKKOS_ENABLE_HIP
98 template <
typename ExecSpace,
99 Spaces::Priority priority = Spaces::Priority::medium,
100 Spaces::IsHIP<ExecSpace> =
true>
101 Teuchos::RCP<const ExecSpace> space_instance()
const {
102 return HIPSlot.space_instance<priority>();
104 template <
typename ExecSpace, Spaces::IsHIP<ExecSpace> = true>
105 Teuchos::RCP<const ExecSpace>
106 space_instance(
const Spaces::Priority &priority)
const {
107 return HIPSlot.space_instance(priority);
109 #endif // KOKKOS_ENABLE_HIP
111 #ifdef KOKKOS_ENABLE_SYCL
112 template <
typename ExecSpace,
113 Spaces::Priority priority = Spaces::Priority::medium,
114 Spaces::IsSYCL<ExecSpace> =
true>
115 Teuchos::RCP<const ExecSpace> space_instance()
const {
116 return SYCLSlot.space_instance<priority>();
118 template <
typename ExecSpace, Spaces::IsSYCL<ExecSpace> = true>
119 Teuchos::RCP<const ExecSpace>
120 space_instance(
const Spaces::Priority &priority)
const {
121 return SYCLSlot.space_instance(priority);
123 #endif // KOKKOS_ENABLE_SYCL
125 #ifdef KOKKOS_ENABLE_SERIAL
128 #ifdef KOKKOS_ENABLE_OPENMP
131 #ifdef KOKKOS_ENABLE_CUDA
134 #ifdef KOKKOS_ENABLE_HIP
137 #ifdef KOKKOS_ENABLE_SYCL
146 #endif // TPETRA_DETAILS_EXECUTIONSPACESUSER_HPP
A class can inherit from this if it wants to use Tpetra managed spaces.
Lazily acquires and stores Kokkos Execution Spaces.