![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
#include <Device.h>
Public Types | |
| enum class | DeviceType { CPU = 0 , CUDA = 1 , SYCL = 2 } |
| Type for device. More... | |
Public Member Functions | |
| Device ()=default | |
| Default constructor -> "CPU:0". More... | |
| Device (DeviceType device_type, int device_id) | |
| Constructor with device specified. More... | |
| Device (const std::string &device_type, int device_id) | |
| Constructor from device type string and device id. More... | |
| Device (const std::string &type_colon_id) | |
| Constructor from string, e.g. "CUDA:0". More... | |
| bool | operator== (const Device &other) const |
| bool | operator!= (const Device &other) const |
| bool | operator< (const Device &other) const |
| bool | IsCPU () const |
| Returns true iff device type is CPU. More... | |
| bool | IsCUDA () const |
| Returns true iff device type is CUDA. More... | |
| bool | IsSYCL () const |
| Returns true iff device type is SYCL GPU. More... | |
| std::string | ToString () const |
| Returns string representation of device, e.g. "CPU:0", "CUDA:0". More... | |
| DeviceType | GetType () const |
| Returns type of the device, e.g. DeviceType::CPU, DeviceType::CUDA. More... | |
| int | GetID () const |
| Returns the device index (within the same device type). More... | |
| bool | IsAvailable () const |
| Returns true if the device is available. More... | |
Static Public Member Functions | |
| static std::vector< Device > | GetAvailableDevices () |
| Returns a vector of available devices. More... | |
| static std::vector< Device > | GetAvailableCPUDevices () |
| Returns a vector of available CPU device. More... | |
| static std::vector< Device > | GetAvailableCUDADevices () |
| Returns a vector of available CUDA device. More... | |
| static std::vector< Device > | GetAvailableSYCLDevices () |
| Returns a vector of available SYCL device. More... | |
| static void | PrintAvailableDevices () |
| Print all available devices. More... | |
Protected Attributes | |
| DeviceType | device_type_ = DeviceType::CPU |
| int | device_id_ = 0 |
Device context specifying device type and device id. For CPU, there is only one device with id 0.
|
strong |
|
default |
Default constructor -> "CPU:0".
Referenced by GetAvailableCPUDevices(), and GetAvailableCUDADevices().
|
explicit |
Constructor with device specified.
Definition at line 60 of file Device.cpp.
References CPU, device_id_, device_type_, and LogError.
|
explicit |
Constructor from device type string and device id.
Definition at line 69 of file Device.cpp.
|
explicit |
Constructor from string, e.g. "CUDA:0".
Definition at line 72 of file Device.cpp.
|
static |
Returns a vector of available CPU device.
Definition at line 128 of file Device.cpp.
Referenced by GetAvailableDevices().
|
static |
Returns a vector of available CUDA device.
Definition at line 132 of file Device.cpp.
References CUDA, Device(), and cloudViewer::core::cuda::DeviceCount().
Referenced by GetAvailableDevices().
|
static |
Returns a vector of available devices.
Definition at line 117 of file Device.cpp.
References GetAvailableCPUDevices(), GetAvailableCUDADevices(), and GetAvailableSYCLDevices().
Referenced by IsAvailable(), and PrintAvailableDevices().
|
static |
Returns a vector of available SYCL device.
Definition at line 140 of file Device.cpp.
References cloudViewer::core::sy::GetAvailableSYCLDevices().
Referenced by GetAvailableDevices().
|
inline |
Returns the device index (within the same device type).
Definition at line 61 of file Device.h.
References device_id_.
Referenced by cloudViewer::core::cuda::AssertCUDADeviceAvailable(), cloudViewer::core::Open3DDLManagedTensor< DLMT >::getDLPackDevice(), cloudViewer::core::pybind_core_device(), cloudViewer::core::pybind_core_tensor(), and cloudViewer::core::cuda::SupportsMemoryPools().
|
inline |
Returns type of the device, e.g. DeviceType::CPU, DeviceType::CUDA.
Definition at line 58 of file Device.h.
References device_type_.
Referenced by cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryInformationMatrix(), cloudViewer::t::pipelines::kernel::ComputePoseDopplerICP(), cloudViewer::core::Open3DDLManagedTensor< DLMT >::getDLPackDevice(), cloudViewer::core::MemoryManager::GetMemoryManagerDevice(), cloudViewer::core::IsDevice::IsCPU(), cloudViewer::core::IsDevice::IsCUDA(), cloudViewer::core::IsDevice::IsSYCL(), cloudViewer::core::MakeMemoryManager(), cloudViewer::core::pybind_core_device(), and cloudViewer::core::pybind_core_tensor().
| bool cloudViewer::core::Device::IsAvailable | ( | ) | const |
Returns true if the device is available.
Definition at line 108 of file Device.cpp.
References GetAvailableDevices().
Referenced by cloudViewer::core::pybind_core_tensor(), cloudViewer::t::geometry::pybind_lineset(), cloudViewer::t::geometry::pybind_pointcloud(), and cloudViewer::t::geometry::pybind_trianglemesh().
|
inline |
Returns true iff device type is CPU.
Definition at line 46 of file Device.h.
References CPU, and device_type_.
Referenced by cloudViewer::t::geometry::kernel::image::ClipTransform(), cloudViewer::t::geometry::kernel::image::ColorizeDepth(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultHybrid(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultIntensity(), cloudViewer::t::pipelines::odometry::ComputeOdometryResultPointToPlane(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultPointToPlane(), cloudViewer::core::kernel::Copy(), cloudViewer::core::kernel::CopySYCL(), cloudViewer::core::CreateDeviceHashBackend(), cloudViewer::t::geometry::kernel::image::CreateNormalMap(), cloudViewer::t::geometry::kernel::image::CreateVertexMap(), cloudViewer::core::MemoryManager::Memcpy(), cloudViewer::core::ParallelForCPU_(), cloudViewer::t::geometry::kernel::image::PyrDownDepth(), cloudViewer::core::HashBackendBuffer::ResetHeap(), cloudViewer::t::pipelines::odometry::RGBDOdometryMultiScale(), cloudViewer::t::geometry::kernel::image::To(), and cloudViewer::core::kernel::UnaryEW().
|
inline |
Returns true iff device type is CUDA.
Definition at line 49 of file Device.h.
References CUDA, and device_type_.
Referenced by cloudViewer::core::AddMM(), cloudViewer::core::cuda::AssertCUDADeviceAvailable(), cloudViewer::t::pipelines::registration::AssertInputMultiScaleICP(), cloudViewer::t::geometry::kernel::image::ClipTransform(), cloudViewer::t::geometry::kernel::image::ColorizeDepth(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultHybrid(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultIntensity(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultPointToPlane(), cloudViewer::core::kernel::Copy(), cloudViewer::core::CreateDeviceHashBackend(), cloudViewer::t::geometry::kernel::image::CreateNormalMap(), cloudViewer::t::geometry::kernel::image::CreateVertexMap(), cloudViewer::core::HashBackendBuffer::HashBackendBuffer(), cloudViewer::core::LeastSquares(), cloudViewer::core::Matmul(), cloudViewer::core::MemoryManager::Memcpy(), cloudViewer::t::geometry::kernel::image::PyrDownDepth(), cloudViewer::core::HashBackendBuffer::ResetHeap(), cloudViewer::core::nns::FixedRadiusIndex::SearchHybrid(), cloudViewer::core::nns::KnnIndex::SearchKnn(), cloudViewer::core::nns::FixedRadiusIndex::SearchRadius(), cloudViewer::core::nns::FixedRadiusIndex::SetTensorData(), cloudViewer::core::cuda::SupportsMemoryPools(), cloudViewer::core::cuda::Synchronize(), cloudViewer::t::geometry::kernel::image::To(), cloudViewer::core::Tril(), cloudViewer::core::Triu(), cloudViewer::core::Triul(), and cloudViewer::core::kernel::UnaryEW().
|
inline |
Returns true iff device type is SYCL GPU.
Definition at line 52 of file Device.h.
References device_type_, and SYCL.
Referenced by cloudViewer::core::AddMM(), cloudViewer::core::AssertNotSYCL(), cloudViewer::core::kernel::Copy(), cloudViewer::core::kernel::CopySYCL(), cloudViewer::core::LeastSquares(), cloudViewer::core::Matmul(), cloudViewer::core::MemoryManager::Memcpy(), cloudViewer::core::ParallelForSYCL(), cloudViewer::t::geometry::RaycastingScene::RaycastingScene(), cloudViewer::core::Tril(), cloudViewer::core::Triu(), cloudViewer::core::Triul(), and cloudViewer::core::kernel::UnaryEW().
| bool cloudViewer::core::Device::operator!= | ( | const Device & | other | ) | const |
Definition at line 81 of file Device.cpp.
References operator==().
| bool cloudViewer::core::Device::operator< | ( | const Device & | other | ) | const |
Definition at line 85 of file Device.cpp.
References ToString().
| bool cloudViewer::core::Device::operator== | ( | const Device & | other | ) | const |
Definition at line 76 of file Device.cpp.
References device_id_, and device_type_.
Referenced by operator!=().
|
static |
Print all available devices.
Definition at line 144 of file Device.cpp.
References GetAvailableDevices(), and LogInfo.
| std::string cloudViewer::core::Device::ToString | ( | ) | const |
Returns string representation of device, e.g. "CPU:0", "CUDA:0".
Definition at line 89 of file Device.cpp.
References CPU, CUDA, device_id_, device_type_, LogError, SYCL, and patch::to_string().
Referenced by cloudViewer::core::cuda::AssertCUDADeviceAvailable(), cloudViewer::core::TensorList::AssertDevice(), cloudViewer::core::tensor_check::AssertTensorDevice_(), cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::kernel::CopySYCL(), cloudViewer::core::MemoryManagerStatistic::CountFree(), cloudViewer::core::MemoryManagerStatistic::CountMalloc(), cloudViewer::t::geometry::npp::Dilate(), cloudViewer::core::TensorList::Extend(), cloudViewer::t::geometry::npp::Filter(), cloudViewer::t::geometry::npp::FilterBilateral(), cloudViewer::t::geometry::npp::FilterGaussian(), cloudViewer::t::geometry::npp::FilterSobel(), cloudViewer::t::geometry::RGBDImage::GetDevice(), cloudViewer::core::Open3DDLManagedTensor< DLMT >::getDLPackDevice(), cloudViewer::core::MemoryManager::GetMemoryManagerDevice(), cloudViewer::core::MakeMemoryManager(), cloudViewer::core::MemoryManager::Memcpy(), std::hash< cloudViewer::core::Device >::operator()(), std::less< cloudViewer::core::Device >::operator()(), operator<(), cloudViewer::core::ParallelForCPU_(), cloudViewer::core::ParallelForSYCL(), cloudViewer::core::pybind_core_device(), cloudViewer::core::pybind_core_tensor(), cloudViewer::t::geometry::pybind_lineset(), cloudViewer::t::geometry::pybind_pointcloud(), cloudViewer::t::geometry::pybind_trianglemesh(), cloudViewer::core::kernel::Reduction(), cloudViewer::t::geometry::npp::Resize(), cloudViewer::t::geometry::npp::RGBToGray(), cloudViewer::t::geometry::PointCloud::SetPointAttr(), cloudViewer::t::geometry::RGBDImage::ToString(), cloudViewer::t::geometry::TensorMap::ToString(), cloudViewer::t::geometry::TriangleMesh::TriangleMesh(), and cloudViewer::core::kernel::UnaryEW().
|
protected |
Definition at line 83 of file Device.h.
Referenced by Device(), GetID(), operator==(), and ToString().
|
protected |
Definition at line 82 of file Device.h.
Referenced by Device(), GetType(), IsCPU(), IsCUDA(), IsSYCL(), operator==(), and ToString().