ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
An allocator that allocates memory on a GPU device. More...
#include <gpu_allocator.h>
Public Member Functions | |
void * | allocate (size_t size) override |
Allocate a block of memory with the given size and default alignment on GPU. | |
void * | allocate (size_t size, size_t alignment) override |
Allocate a block of memory with the given size and alignment on GPU. | |
void | free (void *ptr) override |
Free a block of GPU memory that was previously allocated by this allocator. | |
container::DeviceType | GetDeviceType () override |
Get the type of memory used by the TensorBuffer. | |
![]() | |
virtual size_t | AllocatedSize (void *ptr) |
Get the allocated size of a given pointer. | |
virtual | ~Allocator ()=default |
Additional Inherited Members | |
![]() | |
size_t | allocated_size_ = 0 |
The total number of bytes allocated by this allocator. | |
An allocator that allocates memory on a GPU device.
This class provides an implementation of the Allocator interface that allocates memory on a GPU device using CUDA APIs.
|
overridevirtual |
Allocate a block of memory with the given size and default alignment on GPU.
size | The size of the memory block to allocate. |
Implements base::core::Allocator.
|
overridevirtual |
Allocate a block of memory with the given size and alignment on GPU.
size | The size of the memory block to allocate. |
alignment | The alignment of the memory block to allocate. |
Implements base::core::Allocator.
|
overridevirtual |
Free a block of GPU memory that was previously allocated by this allocator.
ptr | A pointer to the memory block to free. |
Implements base::core::Allocator.
|
overridevirtual |
Get the type of memory used by the TensorBuffer.
Implements base::core::Allocator.