45 #ifndef KOKKOS_OPENMP_HPP
46 #define KOKKOS_OPENMP_HPP
48 #include <Kokkos_Macros.hpp>
49 #if defined(KOKKOS_ENABLE_OPENMP)
51 #include <Kokkos_Core_fwd.hpp>
55 #include <Kokkos_HostSpace.hpp>
57 #ifdef KOKKOS_ENABLE_HBWSPACE
58 #include <Kokkos_HBWSpace.hpp>
61 #include <Kokkos_ScratchSpace.hpp>
63 #include <Kokkos_TaskScheduler.hpp>
65 #include <impl/Kokkos_Tags.hpp>
66 #include <impl/Kokkos_Profiling_Interface.hpp>
67 #include <impl/Kokkos_ExecSpaceInitializer.hpp>
84 using execution_space = OpenMP;
87 #ifdef KOKKOS_ENABLE_HBWSPACE
88 Experimental::HBWSpace;
94 using device_type = Kokkos::Device<execution_space, memory_space>;
95 using array_layout = LayoutRight;
96 using size_type = memory_space::size_type;
97 using scratch_memory_space = ScratchMemorySpace<OpenMP>;
100 static void print_configuration(std::ostream&,
const bool verbose =
false);
103 inline static bool in_parallel(OpenMP
const& = OpenMP()) noexcept;
108 static
void impl_static_fence(OpenMP const& = OpenMP()) noexcept;
116 inline static
bool is_asynchronous(OpenMP const& = OpenMP()) noexcept;
123 static std::vector<OpenMP> partition(...);
129 static OpenMP create_instance(...);
136 template <typename F>
137 static
void partition_master(F const& f,
int requested_num_partitions = 0,
138 int requested_partition_size = 0);
141 static
int concurrency();
143 static
void impl_initialize(
int thread_count = -1);
147 static
bool impl_is_initialized() noexcept;
150 static
void impl_finalize();
152 inline static
int impl_thread_pool_size() noexcept;
155 KOKKOS_INLINE_FUNCTION
156 static
int impl_thread_pool_rank() noexcept;
158 inline static
int impl_thread_pool_size(
int depth);
161 inline static
int impl_max_hardware_threads() noexcept;
164 KOKKOS_INLINE_FUNCTION
165 static
int impl_hardware_thread_id() noexcept;
167 static
int impl_get_current_max_threads() noexcept;
169 static constexpr const
char* name() noexcept {
return "OpenMP"; }
170 uint32_t impl_instance_id() const noexcept {
return 0; }
176 struct DeviceTypeTraits<OpenMP> {
177 static constexpr DeviceType
id = DeviceType::OpenMP;
184 class OpenMPSpaceInitializer :
public ExecSpaceInitializerBase {
186 OpenMPSpaceInitializer() =
default;
187 ~OpenMPSpaceInitializer() =
default;
188 void initialize(
const InitArguments& args)
final;
189 void finalize(
const bool)
final;
191 void print_configuration(std::ostream& msg, const
bool detail) final;
204 struct MemorySpaceAccess<Kokkos::OpenMP::memory_space,
205 Kokkos::OpenMP::scratch_memory_space> {
206 enum :
bool { assignable =
false };
207 enum :
bool { accessible =
true };
208 enum :
bool { deepcopy =
false };
217 #include <OpenMP/Kokkos_OpenMP_Exec.hpp>
218 #include <OpenMP/Kokkos_OpenMP_Team.hpp>
219 #include <OpenMP/Kokkos_OpenMP_Parallel.hpp>
220 #include <OpenMP/Kokkos_OpenMP_Task.hpp>
222 #include <KokkosExp_MDRangePolicy.hpp>
Declaration of various MemoryLayout options.
Declaration of parallel operators.