[Insight-users] how to temparaly disable multithreading or limit the # of threads
Luis Ibanez
luis.ibanez at kitware.com
Tue Nov 18 08:36:00 EST 2008
Hi Pinpress.
Yeap, you have encountered the classical trade-off between memory
and speed.
When using multiple threads, there is a need for replication of
data. Although the ration shouldn't be quite as linear as you
seem to be observing.
Could you please provide specific numbers ?
In particular:
a) Image size in pixels ?
b) Number of samples in the Metric ?
c) Number of bins in the Metric ?
d) Are you using the Optimized Registratin methods in the Code/Review
directory ?
e) Do you have the flag for explicit PDF derivatives ON ?
f) Do you have the flag for caching terms of the jacobian ON ?
How much RAM do you actually have in this machine.
Did it ever started swapping memory to disk ?
The correctness of your conclusions about scalability is subject
to the verification that the capabilities of your machine match
the memory requirements of the problem.
In other words, if the settings of the numbers above is such that
you end up requiring too much memory from your computer, then the
poor performance of the algorithm at high number of threads may
not be attributed directly to the scalability of the algorithm,
but to the actual limitations of the hardware.
Please let us know about the specific numbers above, so that
we can arrive to conclusions based on facts.
Regards,
Luis
-----
PS. For the humorous note, your statement of
"I did not go beyond 4 threads,
as it may cause my computer to die"
reminds me of Demetri Martin's joke about batteries:
"Batteries are the most dramatic objects...
other things stop working or the break
But batteries..
THEY DIE".
http://www.youtube.com/watch?v=XiFrfeJ8dKM
---------------
pinpress wrote:
> Thanks, Bill!
>
> It worked perfect. In addition, I was able to set the global # of threads to
> other values (e.g., 2).
>
> By the way, I noticed that by setting the # of threads to N, the program
> (which was based on DeformableRegistration14.cxx) would allocate almost N
> times memory of the amount when N=1 (not quite, but close) , and would
> quickly exhaust all that's available.
>
> In addition, I had a small test on the scalability. Here are some results of
> the program (stripping most of the I/O):
>
> # of threads time
> 1 4'23''
> 2 3'56''
> 4 5'5''
>
> It appears that the scalability is poor! I did not go beyond 4 threads, as
> it may cause my computer to die.
>
>
>
> Bill Lorensen-2 wrote:
>
>>Try:
>>
>>itk::MultiThreader::SetGlobalDefaultNumberOfThreads(1);
>>
>>Bill
>>
>
>
More information about the Insight-users
mailing list