17 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
18 #include <Kokkos_Macros.hpp>
20 "Including non-public Kokkos header files is not allowed.");
22 #ifndef KOKKOS_OPENMPTARGET_HPP
23 #define KOKKOS_OPENMPTARGET_HPP
25 #include <Kokkos_Core_fwd.hpp>
27 #if defined(KOKKOS_ENABLE_OPENMPTARGET) && defined(_OPENMP)
33 #include <Kokkos_OpenMPTargetSpace.hpp>
34 #include <Kokkos_ScratchSpace.hpp>
35 #include <Kokkos_Parallel.hpp>
36 #include <Kokkos_TaskScheduler.hpp>
37 #include <Kokkos_Layout.hpp>
38 #include <impl/Kokkos_Profiling_Interface.hpp>
39 #include <impl/Kokkos_InitializationSettings.hpp>
40 #include <KokkosExp_MDRangePolicy.hpp>
44 namespace Experimental {
46 class OpenMPTargetInternal;
58 using execution_space = OpenMPTarget;
59 using memory_space = OpenMPTargetSpace;
61 using device_type = Kokkos::Device<execution_space, memory_space>;
63 using array_layout = LayoutLeft;
64 using size_type = memory_space::size_type;
66 using scratch_memory_space = ScratchMemorySpace<OpenMPTarget>;
68 inline static bool in_parallel() {
return omp_in_parallel(); }
70 static void fence(
const std::string& name =
71 "Kokkos::OpenMPTarget::fence: Unnamed Instance Fence");
73 static void impl_static_fence(
const std::string& name);
76 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
77 static int concurrency();
79 int concurrency()
const;
83 void print_configuration(std::ostream& os,
bool verbose =
false)
const;
85 static const char* name();
88 static void impl_finalize();
91 static int impl_is_initialized();
94 static void impl_initialize(InitializationSettings
const&);
96 inline Impl::OpenMPTargetInternal* impl_internal_space_instance()
const {
97 return m_space_instance;
101 uint32_t impl_instance_id() const noexcept;
104 friend
bool operator==(OpenMPTarget const& lhs, OpenMPTarget const& rhs) {
105 return lhs.impl_internal_space_instance() ==
106 rhs.impl_internal_space_instance();
108 friend bool operator!=(OpenMPTarget
const& lhs, OpenMPTarget
const& rhs) {
109 return !(lhs == rhs);
111 Impl::OpenMPTargetInternal* m_space_instance;
117 struct MemorySpaceAccess<
118 Kokkos::Experimental::OpenMPTargetSpace,
119 Kokkos::Experimental::OpenMPTarget::scratch_memory_space> {
120 enum :
bool { assignable =
false };
121 enum :
bool { accessible =
true };
122 enum :
bool { deepcopy =
false };
127 namespace Experimental {
129 struct DeviceTypeTraits<::Kokkos::Experimental::OpenMPTarget> {
130 static constexpr DeviceType
id =
131 ::Kokkos::Profiling::Experimental::DeviceType::OpenMPTarget;
132 static int device_id(
const Kokkos::Experimental::OpenMPTarget&) {
133 return omp_get_default_device();
144 #include <OpenMPTarget/Kokkos_OpenMPTarget_Exec.hpp>
145 #include <OpenMPTarget/Kokkos_OpenMPTarget_Parallel.hpp>
146 #include <OpenMPTarget/Kokkos_OpenMPTarget_Parallel_MDRange.hpp>
147 #include <OpenMPTarget/Kokkos_OpenMPTarget_Task.hpp>