OctoMap / octomap

An Efficient Probabilistic 3D Mapping Framework Based on Octrees. Contains the main OctoMap library, the viewer octovis, and dynamicEDT3D.
http://octomap.github.io
1.93k stars 657 forks source link

Is Octomap race-free? #311

Open RenHao116 opened 3 years ago

RenHao116 commented 3 years ago

For offline processing, is updateNode or castRay functions race-free? May I insert multiple rays or update multiple nodes in parallel? Not really familiar with Openmp or CUDA but as far as I can tell from the code, the nodes are not protected from data-racing. Please tell me if this could be useful for anyone and I may make a pull request with a concurrent Octomap. Please help me point out if this is a duplicated issue. Thanks

ahornung commented 3 years ago

updateNode is not race free, but castRay is (as it's const).

Nodes are not protected themselves, because any update will eventually touch multiple nodes up the tree to the root. Parallelization is done with OpenMP (conditionally enabled via CMake) with data structures for parallelization in place (hint: search for "OMP" in the code). The update itself is not parallelized and marked as critical section.