45 #ifndef KOKKOS_THREADS_HPP
46 #define KOKKOS_THREADS_HPP
48 #include <Kokkos_Macros.hpp>
49 #if defined(KOKKOS_ENABLE_THREADS)
51 #include <Kokkos_Core_fwd.hpp>
55 #include <Kokkos_HostSpace.hpp>
56 #include <Kokkos_ScratchSpace.hpp>
58 #include <Kokkos_MemoryTraits.hpp>
59 #include <impl/Kokkos_Profiling_Interface.hpp>
60 #include <impl/Kokkos_Tags.hpp>
79 typedef Threads execution_space;
84 typedef Kokkos::Device<execution_space, memory_space> device_type;
87 typedef memory_space::size_type size_type;
89 typedef ScratchMemorySpace<Threads> scratch_memory_space;
98 static int in_parallel();
109 static void impl_static_fence();
111 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
118 static int concurrency();
120 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
127 static void initialize(
unsigned threads_count = 0,
128 unsigned use_numa_count = 0,
129 unsigned use_cores_per_numa = 0,
130 bool allow_asynchronous_threadpool =
false);
132 static int is_initialized();
134 static Threads& instance(
int = 0);
138 static int thread_pool_size(
int depth = 0);
139 #if defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST)
140 static int thread_pool_rank();
142 KOKKOS_INLINE_FUNCTION
static int thread_pool_rank() {
return 0; }
145 inline static unsigned max_hardware_threads() {
return thread_pool_size(0); }
146 KOKKOS_INLINE_FUNCTION
static unsigned hardware_thread_id() {
147 return thread_pool_rank();
150 static void impl_finalize();
178 static void impl_initialize(
unsigned threads_count = 0,
179 unsigned use_numa_count = 0,
180 unsigned use_cores_per_numa = 0,
181 bool allow_asynchronous_threadpool =
false);
183 static int impl_is_initialized();
185 static Threads& impl_instance(
int = 0);
189 static int impl_thread_pool_size(
int depth = 0);
190 #if defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST)
191 static int impl_thread_pool_rank();
193 KOKKOS_INLINE_FUNCTION
static int impl_thread_pool_rank() {
return 0; }
196 inline static unsigned impl_max_hardware_threads() {
197 return impl_thread_pool_size(0);
199 KOKKOS_INLINE_FUNCTION
static unsigned impl_hardware_thread_id() {
200 return impl_thread_pool_rank();
204 uint32_t impl_instance_id() const noexcept {
return 0; }
206 static const char* name();
211 namespace Profiling {
212 namespace Experimental {
214 struct DeviceTypeTraits<Threads> {
215 static constexpr DeviceType
id = DeviceType::Threads;
227 struct MemorySpaceAccess<Kokkos::Threads::memory_space,
228 Kokkos::Threads::scratch_memory_space> {
229 enum { assignable =
false };
230 enum { accessible =
true };
231 enum { deepcopy =
false };
235 struct VerifyExecutionCanAccessMemorySpace<
236 Kokkos::Threads::memory_space, Kokkos::Threads::scratch_memory_space> {
237 enum { value =
true };
238 inline static void verify(
void) {}
239 inline static void verify(
const void*) {}
247 #include <Kokkos_ExecPolicy.hpp>
249 #include <Threads/Kokkos_ThreadsExec.hpp>
250 #include <Threads/Kokkos_ThreadsTeam.hpp>
251 #include <Threads/Kokkos_Threads_Parallel.hpp>
253 #include <KokkosExp_MDRangePolicy.hpp>
void print_configuration(std::ostream &, const bool detail=false)
Print "Bill of Materials".
Memory management for host memory.
Memory layout tag indicating right-to-left (C or lexigraphical scheme) striding of multi-indices...
Declaration of various MemoryLayout options.
Declaration of parallel operators.
void finalize()
Finalize the spaces that were initialized via Kokkos::initialize.