44 #ifndef KOKKOS_CORE_HPP
45 #define KOKKOS_CORE_HPP
50 #include <Kokkos_Core_fwd.hpp>
52 #if defined( KOKKOS_ENABLE_SERIAL )
56 #if defined( KOKKOS_ENABLE_OPENMP )
57 #include <Kokkos_OpenMP.hpp>
61 #include <Kokkos_OpenMPTarget.hpp>
62 #include <Kokkos_OpenMPTargetSpace.hpp>
65 #if defined( KOKKOS_ENABLE_QTHREADS )
66 #include <Kokkos_Qthreads.hpp>
69 #if defined( KOKKOS_ENABLE_THREADS )
70 #include <Kokkos_Threads.hpp>
73 #if defined( KOKKOS_ENABLE_CUDA )
74 #include <Kokkos_Cuda.hpp>
77 #if defined( KOKKOS_ENABLE_ROCM )
78 #include <Kokkos_ROCm.hpp>
81 #include <Kokkos_AnonymousSpace.hpp>
83 #include <Kokkos_MemoryPool.hpp>
84 #include <Kokkos_Array.hpp>
85 #include <Kokkos_View.hpp>
88 #include <Kokkos_hwloc.hpp>
89 #include <Kokkos_Timer.hpp>
91 #include <Kokkos_Complex.hpp>
93 #include <Kokkos_CopyViews.hpp>
101 struct InitArguments {
107 bool disable_warnings;
109 InitArguments(
int nt = -1
118 , skip_device{ 9999 }
119 , disable_warnings{ dw }
123 void initialize(
int& narg,
char* arg[]);
125 void initialize(
const InitArguments& args = InitArguments());
127 bool is_initialized() noexcept;
129 bool show_warnings() noexcept;
175 template<
class Space =
typename Kokkos::DefaultExecutionSpace::memory_space >
177 void * kokkos_malloc(
const std::string & arg_alloc_label
178 ,
const size_t arg_alloc_size )
180 typedef typename Space::memory_space MemorySpace ;
181 return Impl::SharedAllocationRecord< MemorySpace >::
182 allocate_tracked( MemorySpace() , arg_alloc_label , arg_alloc_size );
185 template<
class Space =
typename Kokkos::DefaultExecutionSpace::memory_space >
187 void * kokkos_malloc(
const size_t arg_alloc_size )
189 typedef typename Space::memory_space MemorySpace ;
190 return Impl::SharedAllocationRecord< MemorySpace >::
191 allocate_tracked( MemorySpace() ,
"no-label" , arg_alloc_size );
194 template<
class Space =
typename Kokkos::DefaultExecutionSpace::memory_space >
196 void kokkos_free(
void * arg_alloc )
198 typedef typename Space::memory_space MemorySpace ;
199 return Impl::SharedAllocationRecord< MemorySpace >::
200 deallocate_tracked( arg_alloc );
203 template<
class Space =
typename Kokkos::DefaultExecutionSpace::memory_space >
205 void * kokkos_realloc(
void * arg_alloc ,
const size_t arg_alloc_size )
207 typedef typename Space::memory_space MemorySpace ;
208 return Impl::SharedAllocationRecord< MemorySpace >::
209 reallocate_tracked( arg_alloc , arg_alloc_size );
230 if ( ! Kokkos::is_initialized() ) {
231 initialize( narg, arg );
236 ScopeGuard (
const InitArguments& args = InitArguments() )
239 if ( ! Kokkos::is_initialized() ) {
247 if ( Kokkos::is_initialized() && sg_init) {
262 #include <Kokkos_Crs.hpp>
263 #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...