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_HPX )
70 #include <Kokkos_HPX.hpp>
73 #if defined( KOKKOS_ENABLE_THREADS )
74 #include <Kokkos_Threads.hpp>
77 #if defined( KOKKOS_ENABLE_CUDA )
78 #include <Kokkos_Cuda.hpp>
81 #if defined( KOKKOS_ENABLE_ROCM )
82 #include <Kokkos_ROCm.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>
96 #include <Kokkos_Complex.hpp>
98 #include <Kokkos_CopyViews.hpp>
106 struct InitArguments {
112 bool disable_warnings;
114 InitArguments(
int nt = -1
123 , skip_device{ 9999 }
124 , disable_warnings{ dw }
128 void initialize(
int& narg,
char* arg[]);
130 void initialize(
const InitArguments& args = InitArguments());
132 bool is_initialized() noexcept;
134 bool show_warnings() noexcept;
180 template<
class Space =
typename Kokkos::DefaultExecutionSpace::memory_space >
182 void * kokkos_malloc(
const std::string & arg_alloc_label
183 ,
const size_t arg_alloc_size )
185 typedef typename Space::memory_space MemorySpace ;
186 return Impl::SharedAllocationRecord< MemorySpace >::
187 allocate_tracked( MemorySpace() , arg_alloc_label , arg_alloc_size );
190 template<
class Space =
typename Kokkos::DefaultExecutionSpace::memory_space >
192 void * kokkos_malloc(
const size_t arg_alloc_size )
194 typedef typename Space::memory_space MemorySpace ;
195 return Impl::SharedAllocationRecord< MemorySpace >::
196 allocate_tracked( MemorySpace() ,
"no-label" , arg_alloc_size );
199 template<
class Space =
typename Kokkos::DefaultExecutionSpace::memory_space >
201 void kokkos_free(
void * arg_alloc )
203 typedef typename Space::memory_space MemorySpace ;
204 return Impl::SharedAllocationRecord< MemorySpace >::
205 deallocate_tracked( arg_alloc );
208 template<
class Space =
typename Kokkos::DefaultExecutionSpace::memory_space >
210 void * kokkos_realloc(
void * arg_alloc ,
const size_t arg_alloc_size )
212 typedef typename Space::memory_space MemorySpace ;
213 return Impl::SharedAllocationRecord< MemorySpace >::
214 reallocate_tracked( arg_alloc , arg_alloc_size );
235 if ( ! Kokkos::is_initialized() ) {
236 initialize( narg, arg );
241 ScopeGuard (
const InitArguments& args = InitArguments() )
244 if ( ! Kokkos::is_initialized() ) {
252 if ( Kokkos::is_initialized() && sg_init) {
267 #include <Kokkos_Crs.hpp>
268 #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...