Class MultiarchAllocator¶
Defined in File multiarch_allocator.hpp
Class Documentation¶
-
class
ripple
::
MultiarchAllocator
¶ MultiarchAllocator which allows for allocations on the host and multiple devices.
Each allocation is done per thread or per device, and is thread-safe.
Each allocator is simply a linear allocator, which should be reset once the memory must be freed.
Public Types
-
using
GpuAllocator
= SimpleAllocator<AllocArch::gpu>¶ Defines the type of the gpu allocator.
-
using
CpuAllocator
= SimpleAllocator<AllocArch::cpu>¶ Defines the type of the cpu allocator.
-
using
GpuAllocators
= std::vector<GpuAllocator>¶ Defines the type of the container for per gpu allocators.
Public Functions
-
MultiarchAllocator
(size_t num_gpus)¶ Constructor to set the number of allocators and the area for each of the allocators.
- Parameters
num_gpus
: The number of gpu allocators to create.
-
~MultiarchAllocator
() noexcept¶ Destructor, frees all the allocated memory for the device.
-
auto
gpu_allocator
(size_t gpu_id) noexcept -> GpuAllocator&¶ Gets a reference to the allocator with the given gpu id.
- Return
A reference to the allocator for the gpu.
- Parameters
device_id
: The id of the device to get the allocator for.
-
auto
cpu_allocator
() noexcept -> CpuAllocator&¶ Gets a reference to the allocator with the given thread id.
- Return
A reference to the allocator for the gpu.
- Parameters
thread_id
: The id of the thread to get the allocator for.
-
auto
reserve_gpu
(size_t bytes_per_gpu) -> void¶ Reserves the given number of bytes for each of the gpu allocators.
- Parameters
bytes_per_gpu
: The amount of memory to reserve for each gpu allocator.
-
auto
reserve_cpu
(size_t bytes) -> void¶ Reserves the given number of bytes for the cpu allocator.
- Parameters
bytes
: The amount of memory to reserve for the cpu allocator.
-
auto
reset_gpu
() noexcept -> void¶ Resets all the allocators for each gpu.
-
auto
reset_cpu
() noexcept -> void¶ Resets all the allocators for each cpu.
-
auto
reset
() noexcept -> void¶ Resets all gpu and cpu allocators.
-
using