Open tanzeyy opened 2 years ago
Hi, the stdgpu
is the default backend on CUDA. please see the code for reference.
@yuecideng How can I ensure that the GPU is actually performing the voxel down sample? I am running this and my GPU is not being utilized at all.
@tanzeyy Were you able to resolve this?
You should create your point cloud on CUDA device, then the voxel down sample will be performed on GPU automatically. @mslopezg
@yuecideng I currently I load it in like this:
open3d.io.read_point_cloud(filename)
Do I need to be using a special flag to ensure that it is created on the CUDA device, or a particular build? I am on the 0.15.1 release, working on Python 3.8.10
First, you should make sure you have open3d with CUDA enabled:
import open3d as o3d
print(o3d.core.cuda.is_available())
Then you should use open3d.t.io.read_point_cloud
to read point cloud, since only the tensor based PointCloud
can support CUDA backend. Finally you should copy your point cloud on GPU, because the point cloud read from io is always on CPU:
pcd_cu = pcd.cuda()
@yuecideng [Open3D DEBUG] Format auto File assets/pointcloud/pointcloud.ply [Open3D DEBUG] Read t::geometry::PointCloud with following attributes: [Open3D DEBUG] confidence [shape: {112140632, 1}, stride: {1, 1}, Float32] [Open3D DEBUG] reflectance [shape: {112140632, 1}, stride: {1, 1}, UInt8] [Open3D DEBUG] distance [shape: {112140632, 1}, stride: {1, 1}, Float32] [Open3D DEBUG] timestamp [shape: {112140632, 1}, stride: {1, 1}, Float64] [Open3D DEBUG] hitCount [shape: {112140632, 1}, stride: {1, 1}, Int32] [Open3D DEBUG] colors [shape: {112140632, 3}, stride: {3, 1}, UInt8] [Open3D DEBUG] normals [shape: {112140632, 3}, stride: {3, 1}, Float32] [Open3D DEBUG] positions [shape: {112140632, 3}, stride: {3, 1}, Float32] [2022-10-05 18:21:33,412] [INFO] {RasterizationEngine.py:43} - Cleaning PointCloud... [2022-10-05 18:21:33,412] [INFO] {PointCloud.py:64} - Cleaning: Down Sampling Pointcloud... Traceback (most recent call last): File "/home/ubuntu/data/wu-cv-toolkit/adhoc/test_ec2.py", line 51, in <module> config = EC2Engine.run() File "/home/ubuntu/data/wu-cv-toolkit/src/pipelines/EC2Pipeline.py", line 115, in run rasterEngine.rasterize() File "/home/ubuntu/data/wu-cv-toolkit/src/engines/RasterizationEngine.py", line 44, in rasterize self.pointcloud.clean() File "/home/ubuntu/data/wu-cv-toolkit/src/classes/PointCloud.py", line 65, in clean voxel_down_pcd = pcd.voxel_down_sample(voxel_size) RuntimeError: [Open3D Error] (void open3d::core::__OPEN3D_CUDA_CHECK(cudaError_t, const char*, int)) /root/Open3D/cpp/open3d/core/CUDAUtils.cpp:309: /root/Open3D/cpp/open3d/core/MemoryManagerCUDA.cpp:45 CUDA runtime error: out of memory
This is my GPU.
I finally have the GPU working but it is unable to downsample this point cloud due to a memory error. Is it a requirement for the pointcloud to be entirely on the GPU for it to proceed?
If not, how can I progressively compute downsampling with my GPU.
I notice that your point cloud is very large... There are two possible workarounds:
@yuecideng How can I ensure that the GPU is actually performing the voxel down sample? I am running this and my GPU is not being utilized at all.
@tanzeyy Were you able to resolve this?
No, I didn't find a way to use voxel down sampling on GPU. Actually, I inspect the source code and rewrite the algorithm, the idea is using int32 instead of float64, therefore I can do fast hashing with integer division. The final Python program (implemented with Pandas) is twice as fast as the Open3d implementation.
Checklist
master
branch).My Question
Seems like
voxel_down_sample
pybind implementation sets the backend to Default, is it possible to use StdGPU?https://github.com/isl-org/Open3D/blob/6805e7413df0588c9bbcfaad67e18ad2603dca45/cpp/pybind/t/geometry/pointcloud.cpp#L198