33 #include <unordered_map> 40 class DeviceMemoryManager;
44 static void*
Malloc(
size_t byte_size,
const Device& device);
45 static void Free(
void* ptr,
const Device& device);
46 static void Memcpy(
void* dst_ptr,
69 virtual void*
Malloc(
size_t byte_size,
const Device& device) = 0;
70 virtual void Free(
void* ptr,
const Device& device) = 0;
71 virtual void Memcpy(
void* dst_ptr,
75 size_t num_bytes) = 0;
82 void*
Malloc(
size_t byte_size,
const Device& device)
override;
83 void Free(
void* ptr,
const Device& device)
override;
88 size_t num_bytes)
override;
91 #ifdef BUILD_CUDA_MODULE 94 CUDASimpleMemoryManager();
95 void*
Malloc(
size_t byte_size,
const Device& device)
override;
96 void Free(
void* ptr,
const Device& device)
override;
101 size_t num_bytes)
override;
107 bool IsCUDAPointer(
const void* ptr);
112 CUDACachedMemoryManager();
113 void*
Malloc(
size_t byte_size,
const Device& device)
override;
114 void Free(
void* ptr,
const Device& device)
override;
115 void Memcpy(
void* dst_ptr,
119 size_t num_bytes)
override;
125 bool IsCUDAPointer(
const void* ptr);
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:80
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:48
void ReleaseCache()
Definition: CUDAUtils.cpp:55
static void Free(void *ptr, const Device &device)
Definition: MemoryManager.cpp:44
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:88
static void * Malloc(size_t byte_size, const Device &device)
Definition: MemoryManager.cpp:40
virtual ~DeviceMemoryManager()
Definition: MemoryManager.h:76
Definition: MemoryManager.h:42
Definition: PinholeCameraIntrinsic.cpp:35
static std::shared_ptr< DeviceMemoryManager > GetDeviceMemoryManager(const Device &device)
Definition: MemoryManager.cpp:96
Definition: MemoryManager.h:67
Definition: MemoryManager.h:79