registration: parallelize SAC-IA error metric with OpenMP#6431
Open
zeel2104 wants to merge 2 commits intoPointCloudLibrary:masterfrom
Open
registration: parallelize SAC-IA error metric with OpenMP#6431zeel2104 wants to merge 2 commits intoPointCloudLibrary:masterfrom
zeel2104 wants to merge 2 commits intoPointCloudLibrary:masterfrom
Conversation
mvieth
reviewed
Apr 22, 2026
Member
mvieth
left a comment
There was a problem hiding this comment.
Thank you for the pull request, I have two small comments.
| std::vector<float> nn_distance(1); | ||
|
|
||
| const ErrorFunctor& compute_error = *error_functor_; | ||
| const auto tree = tree_; |
Member
There was a problem hiding this comment.
Suggested change
| const auto tree = tree_; | |
| const auto& tree = tree_; |
I believe a reference would be a good choice here.
|
|
||
| for (const auto& point : cloud) { | ||
| #pragma omp parallel for default(none) shared(cloud, tree, compute_error) \ | ||
| firstprivate(nn_index, nn_distance) reduction(+ : error) |
Member
There was a problem hiding this comment.
Suggested change
| firstprivate(nn_index, nn_distance) reduction(+ : error) | |
| firstprivate(nn_index, nn_distance) reduction(+ : error) num_threads(threads_) |
Please add the option to easily adapt the number of threads via setNumberOfThreads, see https://github.com/PointCloudLibrary/pcl/blob/master/features/include/pcl/features/impl/normal_3d_omp.hpp#L48 and https://github.com/PointCloudLibrary/pcl/blob/master/features/include/pcl/features/normal_3d_omp.h (but no need to also add chunk_size -- the default schedule is fine for now).
Author
|
@mvieth
Validation:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: