14 #include <unordered_map>
21 class MemoryManagerDevice;
38 static void*
Malloc(
size_t byte_size,
const Device& device);
41 static void Free(
void* ptr,
const Device& device);
45 static void Memcpy(
void* dst_ptr,
87 size_t num_bytes) = 0;
110 const std::shared_ptr<MemoryManagerDevice>& device_mm);
114 void*
Malloc(
size_t byte_size,
const Device& device)
override;
117 void Free(
void* ptr,
const Device& device)
override;
121 void Memcpy(
void* dst_ptr,
125 size_t num_bytes)
override;
145 void*
Malloc(
size_t byte_size,
const Device& device)
override;
148 void Free(
void* ptr,
const Device& device)
override;
152 void Memcpy(
void* dst_ptr,
156 size_t num_bytes)
override;
159 #ifdef BUILD_CUDA_MODULE
166 void* Malloc(
size_t byte_size,
const Device& device)
override;
169 void Free(
void* ptr,
const Device& device)
override;
173 void Memcpy(
void* dst_ptr,
177 size_t num_bytes)
override;
180 bool IsCUDAPointer(
const void* ptr,
const Device& device);
184 #ifdef BUILD_SYCL_MODULE
192 class MemoryManagerSYCL :
public MemoryManagerDevice {
196 void* Malloc(
size_t byte_size,
const Device& device)
override;
199 void Free(
void* ptr,
const Device& device)
override;
203 void Memcpy(
void* dst_ptr,
204 const Device& dst_device,
206 const Device& src_device,
207 size_t num_bytes)
override;
Definition: MemoryManager.h:141
void * Malloc(size_t byte_size, const Device &device) override
Definition: MemoryManagerCPU.cpp:16
void Free(void *ptr, const Device &device) override
Frees previously allocated memory at address ptr on device device.
Definition: MemoryManagerCPU.cpp:25
void Memcpy(void *dst_ptr, const Device &dst_device, const void *src_ptr, const Device &src_device, size_t num_bytes) override
Definition: MemoryManagerCPU.cpp:31
Definition: MemoryManager.h:105
std::shared_ptr< MemoryManagerDevice > device_mm_
Definition: MemoryManager.h:136
void Memcpy(void *dst_ptr, const Device &dst_device, const void *src_ptr, const Device &src_device, size_t num_bytes) override
Definition: MemoryManagerCached.cpp:499
static void ReleaseCache()
Definition: MemoryManagerCached.cpp:511
MemoryManagerCached(const std::shared_ptr< MemoryManagerDevice > &device_mm)
Definition: MemoryManagerCached.cpp:473
void Free(void *ptr, const Device &device) override
Frees previously allocated memory at address ptr on device device.
Definition: MemoryManagerCached.cpp:491
void * Malloc(size_t byte_size, const Device &device) override
Definition: MemoryManagerCached.cpp:483
Interface for all concrete memory manager classes.
Definition: MemoryManager.h:70
virtual void * Malloc(size_t byte_size, const Device &device)=0
virtual void Free(void *ptr, const Device &device)=0
Frees previously allocated memory at address ptr on device device.
virtual ~MemoryManagerDevice()=default
virtual void Memcpy(void *dst_ptr, const Device &dst_device, const void *src_ptr, const Device &src_device, size_t num_bytes)=0
Definition: MemoryManager.h:34
static void MemcpyToHost(void *host_ptr, const void *src_ptr, const Device &src_device, size_t num_bytes)
Same as Memcpy, but with host (CPU:0) as default dst_device.
Definition: MemoryManager.cpp:85
static std::shared_ptr< MemoryManagerDevice > GetMemoryManagerDevice(const Device &device)
Internally dispatches the appropriate MemoryManagerDevice instance.
Definition: MemoryManager.cpp:93
static void Memcpy(void *dst_ptr, const Device &dst_device, const void *src_ptr, const Device &src_device, size_t num_bytes)
Definition: MemoryManager.cpp:35
static void MemcpyFromHost(void *dst_ptr, const Device &dst_device, const void *host_ptr, size_t num_bytes)
Same as Memcpy, but with host (CPU:0) as default src_device.
Definition: MemoryManager.cpp:77
static void * Malloc(size_t byte_size, const Device &device)
Definition: MemoryManager.cpp:22
static void Free(void *ptr, const Device &device)
Frees previously allocated memory at address ptr on device device.
Definition: MemoryManager.cpp:28
Definition: PinholeCameraIntrinsic.cpp:16