17 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE 18 #include <Kokkos_Macros.hpp> 20 "Including non-public Kokkos header files is not allowed.");
22 #ifndef KOKKOS_THREADS_HPP 23 #define KOKKOS_THREADS_HPP 25 #include <Kokkos_Macros.hpp> 26 #if defined(KOKKOS_ENABLE_THREADS) 28 #include <Kokkos_Core_fwd.hpp> 32 #include <Kokkos_HostSpace.hpp> 33 #include <Kokkos_ScratchSpace.hpp> 35 #include <Kokkos_MemoryTraits.hpp> 36 #include <impl/Kokkos_Profiling_Interface.hpp> 37 #include <impl/Kokkos_InitializationSettings.hpp> 44 enum class fence_is_static { yes, no };
57 using execution_space = Threads;
62 using device_type = Kokkos::Device<execution_space, memory_space>;
65 using size_type = memory_space::size_type;
67 using scratch_memory_space = ScratchMemorySpace<Threads>;
76 static int in_parallel();
79 void print_configuration(std::ostream& os,
bool verbose =
false)
const;
87 static void impl_static_fence(
const std::string& name);
89 void fence(
const std::string& name =
90 "Kokkos::Threads::fence: Unnamed Instance Fence")
const;
93 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 94 static int concurrency();
96 int concurrency()
const;
102 static void impl_finalize();
110 static void impl_initialize(InitializationSettings
const&);
112 static int impl_is_initialized();
114 static Threads& impl_instance(
int = 0);
118 static int impl_thread_pool_size(
int depth = 0);
120 static int impl_thread_pool_rank_host();
122 static KOKKOS_FUNCTION
int impl_thread_pool_rank() {
123 KOKKOS_IF_ON_HOST((
return impl_thread_pool_rank_host();))
125 KOKKOS_IF_ON_DEVICE((return 0;))
128 inline static
unsigned impl_max_hardware_threads() {
129 return impl_thread_pool_size(0);
131 KOKKOS_INLINE_FUNCTION
static unsigned impl_hardware_thread_id() {
132 return impl_thread_pool_rank();
135 uint32_t impl_instance_id() const noexcept {
return 1; }
137 static const char* name();
141 friend bool operator==(Threads
const&, Threads
const&) {
return true; }
142 friend bool operator!=(Threads
const&, Threads
const&) {
return false; }
148 struct DeviceTypeTraits<Threads> {
149 static constexpr DeviceType
id = DeviceType::Threads;
150 static int device_id(
const Threads&) {
return 0; }
162 struct MemorySpaceAccess<
Kokkos::Threads::memory_space,
163 Kokkos::Threads::scratch_memory_space> {
164 enum :
bool { assignable =
false };
165 enum :
bool { accessible =
true };
166 enum :
bool { deepcopy =
false };
174 #include <Kokkos_ExecPolicy.hpp> 176 #include <Threads/Kokkos_ThreadsExec.hpp> 177 #include <Threads/Kokkos_ThreadsTeam.hpp> 178 #include <Threads/Kokkos_Threads_Parallel_Range.hpp> 179 #include <Threads/Kokkos_Threads_Parallel_MDRange.hpp> 180 #include <Threads/Kokkos_Threads_Parallel_Team.hpp> 181 #include <Threads/Kokkos_Threads_UniqueToken.hpp> 183 #include <KokkosExp_MDRangePolicy.hpp>
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.