registration: parallelize SAC-IA error metric with OpenMP#6431
registration: parallelize SAC-IA error metric with OpenMP#6431mvieth merged 2 commits intoPointCloudLibrary:masterfrom
Conversation
mvieth
left a comment
There was a problem hiding this comment.
Thank you for the pull request, I have two small comments.
|
@mvieth
Validation:
|
|
How much speedup does this give? Its just if we add this and later perhaps add the other, we would have nested OMP loops, which probably don't scale that well 😄 |
|
I did a quick benchmark: 2 threads -> 1.9 speed-up, 3 threads -> 2.6 speed-up, 4 threads -> 3.2 speed-up, 5 threads -> 3.8 speed-up, 6 threads -> 4.4 speed-up. So not perfect, but pretty good. Parallelizing the outer loop instead would be more difficult, and not that much faster I believe. Not only the updating of the new best transformation would have to be done in an omp-critical section, but also choosing random samples, and probably even more that I am not aware of yet. In contrast,
If we ever decide to do that, we could just remove the |
Summary
This PR parallelizes the error accumulation loop in
SampleConsensusInitialAlignment::computeErrorMetric()using OpenMP.The change uses an OpenMP
parallel forwith areduction(+ : error)and thread-local nearest-neighbor buffers viafirstprivate(...), so the accumulated registration error can be computed in parallel while preserving the original behavior.Changes
registration/include/pcl/registration/impl/ia_ransac.hpperroraccumulatorValidation
Built and ran the existing SAC-IA registration test locally on Windows/MSVC: