17 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
18 #include <Kokkos_Macros.hpp>
20 "Including non-public Kokkos header files is not allowed.");
22 #ifndef KOKKOS_OPENMP_HPP
23 #define KOKKOS_OPENMP_HPP
25 #include <Kokkos_Macros.hpp>
26 #if defined(KOKKOS_ENABLE_OPENMP)
28 #include <Kokkos_Core_fwd.hpp>
32 #include <Kokkos_HostSpace.hpp>
34 #ifdef KOKKOS_ENABLE_HBWSPACE
35 #include <Kokkos_HBWSpace.hpp>
38 #include <Kokkos_ScratchSpace.hpp>
39 #include <Kokkos_Parallel.hpp>
40 #include <Kokkos_TaskScheduler.hpp>
41 #include <Kokkos_Layout.hpp>
42 #include <impl/Kokkos_HostSharedPtr.hpp>
43 #include <impl/Kokkos_Profiling_Interface.hpp>
44 #include <impl/Kokkos_InitializationSettings.hpp>
61 using execution_space = OpenMP;
64 #ifdef KOKKOS_ENABLE_HBWSPACE
65 Experimental::HBWSpace;
71 using device_type = Kokkos::Device<execution_space, memory_space>;
72 using array_layout = LayoutRight;
73 using size_type = memory_space::size_type;
74 using scratch_memory_space = ScratchMemorySpace<OpenMP>;
78 OpenMP(
int pool_size);
81 void print_configuration(std::ostream& os,
bool verbose =
false)
const;
84 inline static bool in_parallel(OpenMP
const& = OpenMP()) noexcept;
89 static
void impl_static_fence(std::
string const& name);
91 void fence(std::
string const& name =
92 "Kokkos::OpenMP::fence: Unnamed Instance Fence") const;
98 inline static
bool is_asynchronous(OpenMP const& = OpenMP()) noexcept;
100 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
101 template <
typename F>
107 KOKKOS_DEPRECATED
static void partition_master(
108 F
const& f,
int requested_num_partitions = 0,
109 int requested_partition_size = 0);
112 static int concurrency(OpenMP
const& = OpenMP());
114 static void impl_initialize(InitializationSettings
const&);
118 static bool impl_is_initialized() noexcept;
121 static
void impl_finalize();
123 inline static
int impl_thread_pool_size(OpenMP const& = OpenMP()) noexcept;
126 inline static
int impl_thread_pool_rank() noexcept;
128 inline static
int impl_thread_pool_size(
int depth, OpenMP const& = OpenMP());
131 inline static
int impl_max_hardware_threads() noexcept;
134 KOKKOS_INLINE_FUNCTION
135 static
int impl_hardware_thread_id() noexcept;
137 static
int impl_get_current_max_threads() noexcept;
139 Impl::OpenMPInternal* impl_internal_space_instance()
const {
140 return m_space_instance.get();
143 static constexpr
const char* name() noexcept {
return "OpenMP"; }
144 uint32_t impl_instance_id() const noexcept {
return 1; }
147 friend bool operator==(OpenMP
const& lhs, OpenMP
const& rhs) {
148 return lhs.impl_internal_space_instance() ==
149 rhs.impl_internal_space_instance();
151 friend bool operator!=(OpenMP
const& lhs, OpenMP
const& rhs) {
152 return !(lhs == rhs);
154 Kokkos::Impl::HostSharedPtr<Impl::OpenMPInternal> m_space_instance;
158 namespace Experimental {
160 struct DeviceTypeTraits<OpenMP> {
161 static constexpr DeviceType
id = DeviceType::OpenMP;
162 static int device_id(
const OpenMP&) {
return 0; }
175 struct MemorySpaceAccess<Kokkos::OpenMP::memory_space,
176 Kokkos::OpenMP::scratch_memory_space> {
177 enum :
bool { assignable =
false };
178 enum :
bool { accessible =
true };
179 enum :
bool { deepcopy =
false };
188 #include <OpenMP/Kokkos_OpenMP_Instance.hpp>
189 #include <OpenMP/Kokkos_OpenMP_Team.hpp>
190 #include <OpenMP/Kokkos_OpenMP_Parallel.hpp>
191 #include <OpenMP/Kokkos_OpenMP_Task.hpp>
193 #include <KokkosExp_MDRangePolicy.hpp>