44 #ifndef KOKKOS_HOSTSPACE_HPP 
   45 #define KOKKOS_HOSTSPACE_HPP 
   52 #include <Kokkos_Core_fwd.hpp> 
   53 #include <Kokkos_Concepts.hpp> 
   54 #include <Kokkos_MemoryTraits.hpp> 
   56 #include <impl/Kokkos_Traits.hpp> 
   57 #include <impl/Kokkos_Error.hpp> 
   58 #include <impl/Kokkos_SharedAlloc.hpp> 
   60 #include "impl/Kokkos_HostSpace_deepcopy.hpp" 
   74 void init_lock_array_host_space();
 
   81 bool lock_address_host_space(
void* ptr);
 
   89 void unlock_address_host_space( 
void* ptr );
 
  106   typedef size_t     size_type;
 
  114 #if defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP ) 
  115   typedef Kokkos::OpenMP    execution_space;
 
  116 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS ) 
  117   typedef Kokkos::Threads   execution_space;
 
  118 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX ) 
  119   typedef Kokkos::Experimental::HPX execution_space;
 
  122 #elif defined( KOKKOS_ENABLE_OPENMP ) 
  123   typedef Kokkos::OpenMP    execution_space;
 
  124 #elif defined( KOKKOS_ENABLE_THREADS ) 
  125   typedef Kokkos::Threads   execution_space;
 
  128 #elif defined( KOKKOS_ENABLE_HPX ) 
  129   typedef Kokkos::Experimental::HPX execution_space;
 
  130 #elif defined( KOKKOS_ENABLE_SERIAL ) 
  131   typedef Kokkos::Serial    execution_space;
 
  133 #  error "At least one of the following host execution spaces must be defined: Kokkos::OpenMP, Kokkos::Threads, Kokkos::Qthreads, or Kokkos::Serial.  You might be seeing this message if you disabled the Kokkos::Serial device explicitly using the Kokkos_ENABLE_Serial:BOOL=OFF CMake option, but did not enable any of the other host execution space devices." 
  137   typedef Kokkos::Device< execution_space, memory_space > 
device_type;
 
  155   void * 
allocate( 
const size_t arg_alloc_size ) 
const;
 
  159                  , 
const size_t arg_alloc_size ) 
const;
 
  162   static constexpr 
const char* 
name() { 
return m_name; }
 
  166   static constexpr 
const char* m_name = 
"Host";
 
  167   friend class Kokkos::Impl::SharedAllocationRecord< Kokkos::
HostSpace, void >;
 
  180 template< 
typename S >
 
  195   typedef typename std::conditional
 
  196     < keep_exe && keep_mem 
 
  198     , 
typename std::conditional
 
  200         , Kokkos::Device< Kokkos::HostSpace::execution_space
 
  201                         , 
typename S::memory_space >
 
  218 class SharedAllocationRecord< Kokkos::
HostSpace, void >
 
  219   : 
public SharedAllocationRecord< void, void >
 
  224   typedef SharedAllocationRecord< void, void >  RecordBase;
 
  226   SharedAllocationRecord( 
const SharedAllocationRecord & ) = 
delete;
 
  227   SharedAllocationRecord & operator = ( 
const SharedAllocationRecord & ) = 
delete;
 
  233   static RecordBase s_root_record;
 
  239   ~SharedAllocationRecord();
 
  240   SharedAllocationRecord() = 
default;
 
  243                         , 
const std::string              & arg_label
 
  244                         , 
const size_t                     arg_alloc_size
 
  245                         , 
const RecordBase::function_type  arg_dealloc = & 
deallocate 
  251   std::string get_label()
 const 
  253     return std::string( RecordBase::head()->m_label );
 
  256   KOKKOS_INLINE_FUNCTION 
static 
  258                                    , 
const std::string       &  arg_label
 
  259                                    , 
const size_t               arg_alloc_size
 
  262 #if defined( KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST ) 
  263     return new SharedAllocationRecord( arg_space, arg_label, arg_alloc_size );
 
  265     return (SharedAllocationRecord *) 0;
 
  273                          , 
const std::string & arg_label
 
  274                          , 
const size_t arg_alloc_size );
 
  278   void * reallocate_tracked( 
void * 
const arg_alloc_ptr
 
  279                            , 
const size_t arg_alloc_size );
 
  283   void deallocate_tracked( 
void * 
const arg_alloc_ptr );
 
  285   static SharedAllocationRecord * get_record( 
void * arg_alloc_ptr );
 
  287   static void print_records( std::ostream &, 
const Kokkos::HostSpace &, 
bool detail = 
false );
 
  300 #define PAR_DEEP_COPY_USE_MEMCPY 
  302 template< 
class ExecutionSpace >
 
  304   DeepCopy( 
void * dst, 
const void * src, 
size_t n ) {
 
  305     hostspace_parallel_deepcopy(dst,src,n);
 
  308   DeepCopy( 
const ExecutionSpace& exec, 
void * dst, 
const void * src, 
size_t n ) {
 
  310     hostspace_parallel_deepcopy(dst,src,n);
 
  319 #endif // #define KOKKOS_HOSTSPACE_HPP 
void * allocate(const size_t arg_alloc_size) const 
Allocate untracked memory in the space. 
 
Kokkos::Device< execution_space, memory_space > device_type
This memory space preferred device_type. 
 
AllocationMechanism
Non-default memory space instance to choose allocation mechansim, if available. 
 
void deallocate(void *const arg_alloc_ptr, const size_t arg_alloc_size) const 
Deallocate untracked memory in the space. 
 
Memory management for host memory. 
 
static constexpr const char * name()
Return Name of the MemorySpace. 
 
HostSpace()
Default memory space instance. 
 
HostSpace memory_space
Tag this class as a kokkos memory space. 
 
Access relationship between DstMemorySpace and SrcMemorySpace.