Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I wonder whether Nearest_Search support multi-thread operation ? #6

Closed
Woodpecker0 opened this issue Apr 28, 2021 · 2 comments
Closed

Comments

@Woodpecker0
Copy link

Woodpecker0 commented Apr 28, 2021

Thanks for your work, it's elegant and useful.

I would like to use nearest search in a openmp section, eg:

`
#pragma omp parallel for num_threads(4)
for (int i = 0; i < laserCloudSurfLastDSNum; i++)
{
PointType pointOri, pointSel, coeff;
std::vector pointSearchInd;
std::vector pointSearchSqDis;

pointOri = laserCloudSurfLastDS->points[i];
pointAssociateToMap(&pointOri, &pointSel); 
kdtreeSurfFromMap->nearestKSearch(pointSel, 5, pointSearchInd, pointSearchSqDis); //replaced by ikd-tree

}
`
Is it possible to do multiple search at the same time ? It seems that a mutex is used within the Nearest_Search(), which means that parallel operations actually save no time. Am i right ?

@Ecstasy-EC
Copy link
Member

Ecstasy-EC commented May 30, 2021

Sorry for my late reply.

Our ikd-Tree supports multi-thread nearest search. The mutex locks are only used to avoid memory conflicts in lazy label updates thus the multi-thread operations definitely save time. We have already tested the multi-thread nearest search in our LIO applications using the openmp. So don't worry about this.

@Woodpecker0
Copy link
Author

Woodpecker0 commented Jun 2, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants