ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
cpu_allocator.h
Go to the documentation of this file.
1#ifndef BASE_CORE_CPU_ALLOCATOR_H_
2#define BASE_CORE_CPU_ALLOCATOR_H_
3
5
6namespace base {
7namespace core {
8
16class CPUAllocator : public Allocator {
17public:
18
26 void *allocate(size_t size) override;
27
36 void *allocate(size_t size, size_t alignment) override;
37
43 void free(void *ptr) override;
44
51
52};
53
54} // namespace core
55} // namespace base
56
57#endif // BASE_CORE_CPU_ALLOCATOR_H_
An abstract base class for memory allocators.
Definition allocator.h:17
An Allocator subclass for CPU memory.
Definition cpu_allocator.h:16
container::DeviceType GetDeviceType() override
Get the type of device used by the TensorBuffer.
Definition cpu_allocator.cpp:29
void free(void *ptr) override
Free a block of CPU memory that was previously allocated by this allocator.
Definition cpu_allocator.cpp:23
void * allocate(size_t size) override
Allocate a block of CPU memory with the given size and default alignment.
Definition cpu_allocator.cpp:7
Definition allocator.h:6
DeviceType
The type of memory used by an allocator.
Definition tensor_types.h:73