Skip to content

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

@Woodpecker0

Description

@Woodpecker0

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions