[Insight-users] How to control the number of Threads.

Luis Ibanez luis.ibanez at kitware.com
Wed Jul 23 13:46:57 EDT 2008


Hi Mishali,


Yes, ITK will choose the number of threads, typically it will be equal
to the number of processors (or cores) in your computer. That is, ITK
try to use all your processors.


If you want to change this default, you can do the following:


a) If you are in Linux, you can set the environment variable:

              ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS

OR

b) In your application you can call the static methods:

      itk::MultiThreader::SetGlobalMaximumNumberOfThreads( n );

      itk::MultiThreader::SetGlobalDefaultNumberOfThreads( n );

OR

c) in an specific filter, you can directly call

               filter->SetNumberOfThreads( n );


    Regards,


        Luis



----------------------
Mishali Naik wrote:
> Thanks a lot, Luis. The number of threads to be spawned is automatically 
> chosen by ITK, right? Is there a way to configure the number of threads? 
> thanks!
> 
> Luis Ibanez wrote:
> 
>>
>> Hi Mishali,
>>
>>
>> There are no specific examples in multi-threading for registrtation,
>> because there is no need to make any code changes in order to use
>> multi-threading.
>>
>> Simply reconfigure with CMake and turn on the variables:
>>
>>
>>             ITK_USE_REVIEW
>>             ITK_USE_OPTIMIZED_REGISTRATION_METHODS
>>
>>
>>    Regards,
>>
>>
>>       Luis
>>
>>
>> -----------------------
>> Mishali Naik wrote:
>>
>>> Hi Luis,
>>>            Thanks a lot for all your help. I couldn't find any 
>>> multi-threaded image registration examples in the Insight package - 
>>> can you maybe point to any multi-threaded examples? thanks a lot.
>>> - Mishali
>>>
>>> Luis Ibanez wrote:
>>>
> 


More information about the Insight-users mailing list