PointCloudLibrary / PointCloudLibrary/pcl
Parallel Surface Reconstuction
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 4.7k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 6
Description
Your Environment
- Operating System and version: Windows 10
- Compiler: Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506
- PCL Version: 1.8.1
Expected Behavior
Running Poisson surface reconstruction on separate point clouds each in separate threads should works without crashing
Current Behavior
An Access Violation Exceptions is thrown.
Possible Solution
Don't use static memory:
set MEMORY_ALLOCATOR_BLOCK_SIZE to zero in the following files:
&
To test the effect on performance I did a really basic test. Using a single point cloud, default Poisson Recon settings and running on a single thread, I measured how long it takes to perform the reconstruction. The results:
Debug build, static memory, duration: 42 483 037 μs
Debug build, dynamic memory, duration: 40 880 744 μs
Release build, static memory, duration: 4 066 210 μs
Release build, dynamic memory, duration: 4 177 797 μs
At first glace it seems there is minimal performance effect, so what is the rational of using static memory?
Code to Reproduce
#define PCL_NO_PRECOMPILE
#include <thread>
#include <vector>
#include <pcl/point_types.h>
#include <pcl/surface/poisson.h>
#include <pcl/io/ply_io.h>
pcl::PolygonMesh mesh_1;
pcl::PolygonMesh mesh_2;
pcl::PointCloud<pcl::PointNormal>::Ptr cloud_in_1(new pcl::PointCloud<pcl::PointNormal>());
pcl::PointCloud<pcl::PointNormal>::Ptr cloud_in_2(new pcl::PointCloud<pcl::PointNormal>());
void thread1Process()
{
pcl::Poisson<pcl::PointNormal> surf_con;
surf_con.setInputCloud(cloud_in_1);
surf_con.performReconstruction(mesh_1);
}
int main(int argc, char* argv[])
{
//------------------ LOAD FILES ------------------//
std::string path_dir = "C:\\Projects\\Snugg\\2.Development\\4.Repo\\temp\\MeasurementFinder\\build\\000Yon\\temp_m_f.ply";
pcl::PLYReader reader;
reader.read(path_dir, *cloud_in_1);
reader.read(path_dir, *cloud_in_2);
std::thread t1(thread1Process);
pcl::Poisson<pcl::PointNormal> surf_con;
surf_con.setInputCloud(cloud_in_2);
surf_con.performReconstruction(mesh_2);
t1.join();
pcl::io::savePLYFile("mesh_1.ply", mesh_1);
pcl::io::savePLYFile("mesh_2.ply", mesh_2);
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the allocator definitions at surface/include/pcl/surface/impl/poisson.hpp:55 and surface/include/pcl/surface/3rdparty/poisson4/multi_grid_octree_data.hpp:41. Build and run the supplied two-thread reproduction on the stated PCL and Windows environment, then trace the access violation during concurrent Poisson reconstruction. Done means separate point clouds can be reconstructed concurrently without crashing, with relevant regression coverage if the repository provides a suitable test location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100