[Insight-users] Problem with multi-threaded metric computation

Miller, James V (Research) millerjv at crd.ge.com
Fri Aug 12 12:57:08 EDT 2005


The cost functions are not guarenteed to be thread safe. By this I mean
that you cannot assume that you can share a cost function across
multiple threads and be able to make calls to the cost function
from each thread.

What you can do is create an array of cost functions and use one
per thread (or just create a cost function in each thread that needs
one).

Jim

-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of
Florence Dru
Sent: Friday, August 12, 2005 11:34 AM
To: insight-users at itk.org
Subject: [Insight-users] Problem with multi-threaded metric computation


Hello,
here is my problem: I have parallelized a part of my program that calls 
the "GetValue()" function of my cost function object.
I used the itkMultiThreader class to do this.
But the problem is that when I use more than 1 thread, when the cost 
function object is evaluated a one point the returned values are 
completely incorrect ( in the order of 200 instead of the usual order of 
0.3) and I was wondering whether it could come from the different 
threads that access the same object at the same time, messing up everything.
Could someone help me ?
Thanks beforehand for replying.

Florence DRU
_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list