ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
gpu_allocator.h
Go to the documentation of this file.
1#ifndef BASE_CORE_GPU_ALLOCATOR_H_
2#define BASE_CORE_GPU_ALLOCATOR_H_
3
5
6namespace base {
7namespace core {
14class GPUAllocator : public Allocator {
15public:
23 void *allocate(size_t size) override;
24
33 void *allocate(size_t size, size_t alignment) override;
34
40 void free(void *ptr) override;
41
48};
49
50} // namespace base
51} // namespace core
52
53#endif // BASE_CORE_GPU_ALLOCATOR_H_
An abstract base class for memory allocators.
Definition allocator.h:17
An allocator that allocates memory on a GPU device.
Definition gpu_allocator.h:14
void * allocate(size_t size) override
Allocate a block of memory with the given size and default alignment on GPU.
Definition gpu_allocator.cpp:20
void free(void *ptr) override
Free a block of GPU memory that was previously allocated by this allocator.
Definition gpu_allocator.cpp:42
container::DeviceType GetDeviceType() override
Get the type of memory used by the TensorBuffer.
Definition gpu_allocator.cpp:48
Definition allocator.h:6
DeviceType
The type of memory used by an allocator.
Definition tensor_types.h:73