45 #ifndef KOKKOS_CORE_HPP
46 #define KOKKOS_CORE_HPP
51 #include <Kokkos_Core_fwd.hpp>
53 #if defined(KOKKOS_ENABLE_SERIAL)
57 #if defined(KOKKOS_ENABLE_OPENMP)
58 #include <Kokkos_OpenMP.hpp>
61 #if defined(KOKKOS_ENABLE_OPENMPTARGET)
62 #include <Kokkos_OpenMPTarget.hpp>
63 #include <Kokkos_OpenMPTargetSpace.hpp>
66 #if defined(KOKKOS_ENABLE_HPX)
67 #include <Kokkos_HPX.hpp>
70 #if defined(KOKKOS_ENABLE_THREADS)
71 #include <Kokkos_Threads.hpp>
74 #if defined(KOKKOS_ENABLE_CUDA)
75 #include <Kokkos_Cuda.hpp>
78 #if defined(KOKKOS_ENABLE_ROCM)
79 #include <Kokkos_ROCm.hpp>
81 #if defined(KOKKOS_ENABLE_HIP)
82 #include <Kokkos_HIP.hpp>
85 #include <Kokkos_AnonymousSpace.hpp>
87 #include <Kokkos_MemoryPool.hpp>
88 #include <Kokkos_Array.hpp>
89 #include <Kokkos_View.hpp>
92 #include <Kokkos_hwloc.hpp>
93 #include <Kokkos_Timer.hpp>
94 #include <Kokkos_TaskScheduler.hpp>
95 #include <Kokkos_Complex.hpp>
96 #include <Kokkos_CopyViews.hpp>
104 struct InitArguments {
110 bool disable_warnings;
112 InitArguments(
int nt = -1,
int nn = -1,
int dv = -1,
bool dw =
false)
118 disable_warnings{dw} {}
121 void initialize(
int& narg,
char* arg[]);
123 void initialize(InitArguments args = InitArguments());
127 void pre_initialize(
const InitArguments& args);
129 void post_initialize(
const InitArguments& args);
133 bool is_initialized() noexcept;
135 bool show_warnings() noexcept;
181 template <
class Space =
typename Kokkos::DefaultExecutionSpace::memory_space>
182 inline void* kokkos_malloc(
const std::string& arg_alloc_label,
183 const size_t arg_alloc_size) {
184 typedef typename Space::memory_space MemorySpace;
185 return Impl::SharedAllocationRecord<MemorySpace>::allocate_tracked(
186 MemorySpace(), arg_alloc_label, arg_alloc_size);
189 template <
class Space =
typename Kokkos::DefaultExecutionSpace::memory_space>
190 inline void* kokkos_malloc(
const size_t arg_alloc_size) {
191 typedef typename Space::memory_space MemorySpace;
192 return Impl::SharedAllocationRecord<MemorySpace>::allocate_tracked(
193 MemorySpace(),
"no-label", arg_alloc_size);
196 template <
class Space =
typename Kokkos::DefaultExecutionSpace::memory_space>
197 inline void kokkos_free(
void* arg_alloc) {
198 typedef typename Space::memory_space MemorySpace;
199 return Impl::SharedAllocationRecord<MemorySpace>::deallocate_tracked(
203 template <
class Space =
typename Kokkos::DefaultExecutionSpace::memory_space>
204 inline void* kokkos_realloc(
void* arg_alloc,
const size_t arg_alloc_size) {
205 typedef typename Space::memory_space MemorySpace;
206 return Impl::SharedAllocationRecord<MemorySpace>::reallocate_tracked(
207 arg_alloc, arg_alloc_size);
227 if (!Kokkos::is_initialized()) {
228 initialize(narg, arg);
233 ScopeGuard(
const InitArguments& args = InitArguments()) {
235 if (!Kokkos::is_initialized()) {
242 if (Kokkos::is_initialized() && sg_init) {
256 #include <Kokkos_Crs.hpp>
257 #include <Kokkos_WorkGraphPolicy.hpp>
Declaration and definition of Kokkos::Vectorization interface.
void print_configuration(std::ostream &, const bool detail=false)
Print "Bill of Materials".
Declaration and definition of Kokkos::pair.
Declaration and definition of Kokkos::Serial device.
void finalize_all()
Finalize all known execution spaces.
void finalize()
Finalize the spaces that were initialized via Kokkos::initialize.
void push_finalize_hook(std::function< void()> f)
Push a user-defined function to be called in Kokkos::finalize, before any Kokkos state is finalized...
ScopeGuard Some user scope issues have been identified with some Kokkos::finalize calls; ScopeGuard a...