![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
#include <MemoryManager.h>
Static Public Member Functions | |
| static void * | Malloc (size_t byte_size, const Device &device) |
| static void | Free (void *ptr, const Device &device) |
Frees previously allocated memory at address ptr on device device. More... | |
| static void | Memcpy (void *dst_ptr, const Device &dst_device, const void *src_ptr, const Device &src_device, size_t num_bytes) |
| 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. More... | |
| 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. More... | |
Static Protected Member Functions | |
| static std::shared_ptr< MemoryManagerDevice > | GetMemoryManagerDevice (const Device &device) |
| Internally dispatches the appropriate MemoryManagerDevice instance. More... | |
Top-level memory interface. Calls to any of the member functions will automatically dispatch the appropriate MemoryManagerDevice instance based on the provided device which is used to execute the requested functionality.
The memory managers are dispatched as follows:
DeviceType = CPU : MemoryManagerCPU DeviceType = CUDA : ENABLE_CACHED_CUDA_MANAGER = ON : MemoryManagerCached w/ MemoryManagerCUDA Otherwise : MemoryManagerCUDA
Definition at line 34 of file MemoryManager.h.
|
static |
Frees previously allocated memory at address ptr on device device.
Definition at line 29 of file MemoryManager.cpp.
References cloudViewer::core::MemoryManagerStatistic::CountFree(), cloudViewer::core::MemoryManagerStatistic::GetInstance(), and GetMemoryManagerDevice().
Referenced by cloudViewer::core::StdAllocator< T >::deallocate(), cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::Erase(), cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::Free(), cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::GetActiveIndices(), cloudViewer::core::LUCUDA(), cloudViewer::core::CUDAHashBackendBufferAccessor::Shutdown(), cloudViewer::core::Blob::~Blob(), and cloudViewer::core::SlabNodeManager::~SlabNodeManager().
|
staticprotected |
Internally dispatches the appropriate MemoryManagerDevice instance.
Definition at line 94 of file MemoryManager.cpp.
References cloudViewer::core::Device::CPU, cloudViewer::core::Device::CUDA, cloudViewer::core::Device::GetType(), LogError, cloudViewer::core::Device::SYCL, and cloudViewer::core::Device::ToString().
|
static |
Allocates memory of byte_size bytes on device device and returns a pointer to the beginning of the allocated memory block.
Definition at line 23 of file MemoryManager.cpp.
References cloudViewer::core::MemoryManagerStatistic::CountMalloc(), cloudViewer::core::MemoryManagerStatistic::GetInstance(), and GetMemoryManagerDevice().
Referenced by cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::Allocate(), cloudViewer::core::StdAllocator< T >::allocate(), cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::Erase(), cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::GetActiveIndices(), cloudViewer::core::LUCUDA(), cloudViewer::core::CUDAHashBackendBufferAccessor::Setup(), and cloudViewer::core::SlabNodeManager::SlabNodeManager().
|
static |
Copies num_bytes bytes of memory at address src_ptr on device src_device to address dst_ptr on device dst_device.
Definition at line 36 of file MemoryManager.cpp.
References GetMemoryManagerDevice(), cloudViewer::core::Device::IsCPU(), cloudViewer::core::Device::IsCUDA(), cloudViewer::core::Device::IsSYCL(), LogError, and cloudViewer::core::Device::ToString().
Referenced by cloudViewer::core::kernel::CopyCPU(), cloudViewer::core::kernel::CopySYCL(), MemcpyFromHost(), and MemcpyToHost().
|
static |
Same as Memcpy, but with host (CPU:0) as default src_device.
Definition at line 78 of file MemoryManager.cpp.
References Memcpy().
Referenced by cloudViewer::core::Tensor::AssignObject(), cloudViewer::t::geometry::Image::FromLegacy(), cloudViewer::t::io::ReadImageFromJPG(), cloudViewer::core::CUDAHashBackendBufferAccessor::Setup(), and cloudViewer::core::Tensor::Tensor().
|
static |
Same as Memcpy, but with host (CPU:0) as default dst_device.
Definition at line 86 of file MemoryManager.cpp.
References Memcpy().
Referenced by cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::GetActiveIndices(), cloudViewer::core::Tensor::Item(), cloudViewer::core::eigen_converter::TensorToEigenVectorNxVector(), cloudViewer::core::Tensor::ToFlatVector(), cloudViewer::t::geometry::Image::ToLegacy(), and cloudViewer::t::io::WriteImageToJPG().