1 #ifndef TPETRA_DETAILS_EXECUTIONSPACESUSER_HPP
2 #define TPETRA_DETAILS_EXECUTIONSPACESUSER_HPP
8 #include <Kokkos_Core.hpp>
10 #include "Teuchos_RCP.hpp"
12 #include "Tpetra_Details_ExecutionSpacesSlot.hpp"
27 #ifdef KOKKOS_ENABLE_CUDA
37 template <
typename ExecSpace,
38 Spaces::Priority priority = Spaces::Priority::medium,
39 Spaces::IsCuda<ExecSpace> =
true>
40 Teuchos::RCP<const ExecSpace> space_instance()
const {
41 return cudaSlot.space_instance<priority>();
53 template <
typename ExecSpace, Spaces::IsCuda<ExecSpace> = true>
54 Teuchos::RCP<const ExecSpace>
55 space_instance(
const Spaces::Priority &priority)
const {
56 return cudaSlot.space_instance(priority);
58 #endif // KOKKOS_ENABLE_CUDA
60 #ifdef KOKKOS_ENABLE_SERIAL
61 template <
typename ExecSpace,
62 Spaces::Priority priority = Spaces::Priority::medium,
63 Spaces::IsSerial<ExecSpace> =
true>
64 Teuchos::RCP<const ExecSpace> space_instance()
const {
65 return serialSlot.space_instance<priority>();
67 template <
typename ExecSpace, Spaces::IsSerial<ExecSpace> = true>
68 Teuchos::RCP<const ExecSpace>
69 space_instance(
const Spaces::Priority &priority)
const {
70 return serialSlot.space_instance(priority);
72 #endif // KOKKOS_ENABLE_SERIAL
74 #ifdef KOKKOS_ENABLE_OPENMP
75 template <
typename ExecSpace,
76 Spaces::Priority priority = Spaces::Priority::medium,
77 Spaces::IsOpenMP<ExecSpace> =
true>
78 Teuchos::RCP<const ExecSpace> space_instance()
const {
79 return openMPSlot.space_instance<priority>();
81 template <
typename ExecSpace, Spaces::IsOpenMP<ExecSpace> = true>
82 Teuchos::RCP<const ExecSpace>
83 space_instance(
const Spaces::Priority &priority)
const {
84 return openMPSlot.space_instance(priority);
86 #endif // KOKKOS_ENABLE_OPENMP
88 #ifdef KOKKOS_ENABLE_HIP
89 template <
typename ExecSpace,
90 Spaces::Priority priority = Spaces::Priority::medium,
91 Spaces::IsHIP<ExecSpace> =
true>
92 Teuchos::RCP<const ExecSpace> space_instance()
const {
93 return HIPSlot.space_instance<priority>();
95 template <
typename ExecSpace, Spaces::IsHIP<ExecSpace> = true>
96 Teuchos::RCP<const ExecSpace>
97 space_instance(
const Spaces::Priority &priority)
const {
98 return HIPSlot.space_instance(priority);
100 #endif // KOKKOS_ENABLE_HIP
102 #ifdef KOKKOS_ENABLE_SYCL
103 template <
typename ExecSpace,
104 Spaces::Priority priority = Spaces::Priority::medium,
105 Spaces::IsSYCL<ExecSpace> =
true>
106 Teuchos::RCP<const ExecSpace> space_instance()
const {
107 return SYCLSlot.space_instance<priority>();
109 template <
typename ExecSpace, Spaces::IsSYCL<ExecSpace> = true>
110 Teuchos::RCP<const ExecSpace>
111 space_instance(
const Spaces::Priority &priority)
const {
112 return SYCLSlot.space_instance(priority);
114 #endif // KOKKOS_ENABLE_SYCL
116 #ifdef KOKKOS_ENABLE_SERIAL
119 #ifdef KOKKOS_ENABLE_OPENMP
122 #ifdef KOKKOS_ENABLE_CUDA
125 #ifdef KOKKOS_ENABLE_HIP
128 #ifdef KOKKOS_ENABLE_SYCL
137 #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.