[ITK] [ITK-users] Mini-pipeline filters don't obey SetNumberOfThreads()
Bradley Lowekamp
blowekamp at mail.nih.gov
Thu Nov 6 09:24:45 EST 2014
Hello,
This is a case where I am reminded a lot of Qt's hierarchical object ownership. If one filter owns another then certain properties could be inherited.
While SimpleITK's code generation system there is a possible a way to generate tests for most filters to determine if the filters respect the number of threads. This could be an fun project.
However practically, given that almost always only a single pipeline is being executed per process, I have found that setting the ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS environmental variable sufficient as a corse control. Now if one was working on concurrently running multiple pipeline is a single process the file grain control of number of threads per filter would be more important.
Brad
On Nov 6, 2014, at 7:39 AM, Jim Miller <millerjv at gmail.com> wrote:
> That is a good point. The number of threads should be propagated down to the mini filters. This needs to be handled by the filter developers, much like properly managing the requested regions.
>
> We will have to think if there is a way to do this in a generic manner that may make it easier for the developer.
>
> In the interim, if you need to a filter that uses mini pipelines to behave like this while not restricting other filters, you might be able to tap into the start and end methods to manipulate the global number of threads as each of the filters that uses a mini pipeline executes.
>
> Jim
>
>> On Nov 6, 2014, at 5:47 AM, Joël Schaerer <joel.schaerer at laposte.net> wrote:
>>
>> This brings me to the second problem, which is that forcing the number of threads on mini-pipeline filters such as the NormalizeImageFilter doesn't work. That is, calling normalize_filter->SetNumberOfThreads(1) doesn't work as expected. The reason is actually pretty simple: the filter simply does not pass the information to the filters inside the mini-pipeline. I believe most other mini-pipeline filters will have the same problem.
>>
>> Since the mini-pipeline filters are not accessible from outside the class, I am left with using itk::MultiThreader::SetGlobalMaximumNumberOfThreads which is of course not very satisfactory.
>>
>> I don't see how to fix the problem without calling SetNumberOfThreads on each mini-pipline filter... Hopefully someone will have a better idea!
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
More information about the Community
mailing list