 |
Ginkgo
Generated from pipelines/3133041809 branch based on develop. Ginkgo version 2.0.0
A numerical linear algebra library targeting many-core architectures
|
5 #ifndef GKO_PUBLIC_CORE_BASE_MEMORY_HPP_
6 #define GKO_PUBLIC_CORE_BASE_MEMORY_HPP_
12 #include <ginkgo/core/base/fwd_decls.hpp>
13 #include <ginkgo/core/base/types.hpp>
27 virtual void* allocate(
size_type num_bytes) = 0;
29 virtual void deallocate(
void* ptr) = 0;
58 virtual bool check_environment(
int device_id, CUstream_st* stream)
const
83 virtual bool check_environment(
int device_id,
84 GKO_HIP_STREAM_STRUCT* stream)
const
96 void* allocate(
size_type num_bytes)
override;
98 void deallocate(
void* ptr)
override;
107 void* allocate(
size_type num_bytes)
override;
109 void deallocate(
void* ptr)
override;
118 void* allocate(
size_type num_bytes)
override;
120 void deallocate(
void* ptr)
override;
127 CUstream_st* stream_;
136 void* allocate(
size_type num_bytes)
override;
138 void deallocate(
void* ptr)
override;
145 bool check_environment(
int device_id, CUstream_st* stream)
const override;
158 void* allocate(
size_type num_bytes)
override;
160 void deallocate(
void* ptr)
override;
165 bool check_environment(
int device_id, CUstream_st* stream)
const override;
177 void* allocate(
size_type num_bytes)
override;
179 void deallocate(
void* ptr)
override;
188 void* allocate(
size_type num_bytes)
override;
190 void deallocate(
void* ptr)
override;
195 bool check_environment(
int device_id,
196 GKO_HIP_STREAM_STRUCT* stream)
const override;
199 GKO_HIP_STREAM_STRUCT* stream_;
208 void* allocate(
size_type num_bytes)
override;
210 void deallocate(
void* ptr)
override;
217 bool check_environment(
int device_id,
218 GKO_HIP_STREAM_STRUCT* stream)
const override;
231 void* allocate(
size_type num_bytes)
override;
233 void deallocate(
void* ptr)
override;
238 bool check_environment(
int device_id,
239 GKO_HIP_STREAM_STRUCT* stream)
const override;
265 const std::string&
get_name()
const;
296 void* allocate_impl(
size_type num_bytes);
298 void deallocate_impl(
void* ptr) noexcept;
301 bool is_host_accessible()
const noexcept;
304 bool is_device_accessible()
const noexcept;
307 bool matches_device(
int device_id)
const noexcept;
311 std::unique_ptr<data> data_;
334 void* allocate(
size_type num_bytes)
override;
336 void deallocate(
void* ptr)
override;
356 void* allocate(
size_type num_bytes)
override;
358 void deallocate(
void* ptr)
override;
362 bool check_environment(
int device_id, CUstream_st* stream)
const override;
381 void* allocate(
size_type num_bytes)
override;
383 void deallocate(
void* ptr)
override;
386 bool check_environment(
int device_id,
387 GKO_HIP_STREAM_STRUCT* stream)
const override;
476 std::string name, umpire_pool_config config = {});
495 std::string name, umpire_pool_config config = {});
501 #endif // GKO_PUBLIC_CORE_BASE_MEMORY_HPP_
std::shared_ptr< UmpireCpuAllocator > make_umpire_cpu_pool(std::string name, umpire_pool_config config={})
Creates a named Umpire QuickPool over a host resource and wraps it.
const std::string & get_name() const
Name of the underlying Umpire allocator.
Allocator using a named Umpire allocator over a CUDA device resource.
Definition: memory.hpp:344
size_type get_allocation_count() const
Number of allocations from the Umpire allocator that are still live.
UmpireHipAllocator(std::string name)
UmpireCpuAllocator(std::string name)
std::size_t size_type
Integral type used for allocation quantities.
Definition: types.hpp:102
bool check_environment(int device_id, CUstream_st *stream) const override
Checks if the allocator can be used safely with the provided device ID and stream.
This is the Executor subclass which represents the HIP enhanced device.
Definition: executor.hpp:1750
Definition: memory.hpp:175
size_type get_actual_size() const
Bytes the Umpire allocator holds from its memory resource.
void release()
Returns the pool's completely unused blocks to its memory resource.
This is the Executor subclass which represents the CUDA device.
Definition: executor.hpp:1523
size_type initial_block_size
Size in bytes of the pool's first block, requested on first allocation.
Definition: memory.hpp:413
The Ginkgo namespace.
Definition: abstract_factory.hpp:19
Implement this interface to provide an allocator for OmpExecutor or ReferenceExecutor.
Definition: memory.hpp:37
bool thread_safe
Wrap the pool in Umpire's ThreadSafeAllocator.
Definition: memory.hpp:437
bool tracked
Register each allocation in Umpire's tracking registry.
Definition: memory.hpp:430
Definition: memory.hpp:134
Definition: memory.hpp:206
std::string resource
Umpire memory resource to pool over; empty means "HOST" for CPU and "DEVICE" for CUDA/HIP.
Definition: memory.hpp:406
size_type growth_block_size
Minimum bytes per subsequent growth.
Definition: memory.hpp:416
Allocator using a named Umpire allocator over a host-accessible resource.
Definition: memory.hpp:323
UmpireCudaAllocator(std::string name)
Definition: memory.hpp:156
std::shared_ptr< UmpireCudaAllocator > make_umpire_cuda_pool(std::string name, umpire_pool_config config={})
Creates a named Umpire QuickPool over a CUDA device resource and wraps it.
Implement this interface to provide an allocator for HipExecutor.
Definition: memory.hpp:68
size_type alignment
Allocation alignment, matching cudaMalloc/hipMalloc rather than Umpire's 16-byte default.
Definition: memory.hpp:423
Allocator using a named Umpire allocator over a HIP device resource.
Definition: memory.hpp:370
Configuration for a pool created by make_umpire_cpu_pool(), make_umpire_cuda_pool() or make_umpire_hi...
Definition: memory.hpp:397
Allocator using cudaMalloc.
Definition: memory.hpp:105
Allocator using new/delete.
Definition: memory.hpp:94
size_type get_high_watermark() const
Largest value get_current_size() has reached so far.
Common base of the Umpire-backed allocators, which forward to a named allocator in Umpire's ResourceM...
Definition: memory.hpp:262
Provides generic allocation and deallocation functionality to be used by an Executor.
Definition: memory.hpp:23
Definition: memory.hpp:186
std::shared_ptr< UmpireHipAllocator > make_umpire_hip_pool(std::string name, umpire_pool_config config={})
Creates a named Umpire QuickPool over a HIP device resource and wraps it.
Implement this interface to provide an allocator for CudaExecutor.
Definition: memory.hpp:43
size_type get_current_size() const
Bytes currently allocated from the Umpire allocator and not yet deallocated, by any of its users (not...
Definition: memory.hpp:229
Definition: memory.hpp:116