[vtkusers] vtkKdTree threading problem

amutka alan.mutka at gmail.com
Wed Jan 22 02:35:57 EST 2014


Dear all,

my problem is related to vtkKDTree::FindClosesPoint which I need to call
from multiple threads. 
If the  code  below is called from a single thread, it takes N seconds, and
if it is called from 8 threads than it takes around 5*N seconds...my results
are 6(single) seconds and 28 (8 cores) seconds....
Each Kdtree is created in separated thread, and also each is build from
separated vtkPoints object....
The problem is in FindClosestPoint which is not fully thread safe from my
experience, even the documentation says different...I have tried
VTKThreading and BOOST threading, no difference.
Do you have any suggestion what could be the problem? Thank you!


        vtkSmartPointer<vtkKdTree> kdTree =
vtkSmartPointer<vtkKdTree>::New();
	kdTree->BuildLocatorFromPoints(somePoints[threadID]);
	double point[3];
	double dist;
	for(int i=0;i<100;i++)
	{
		for(int j=0;j<100;j++)
		{
			for(int z=0;z<100;z++)
			{
				point[0] = i;
				point[1] = j;
				point[2] = z;
				kdTree->FindClosestPoint(point,dist);
			}
		}
	} 




--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkKdTree-threading-problem-tp5725537.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list