[Insight-users] ThreadedGenerateData()

Matt McCormick matt.mccormick at kitware.com
Thu Mar 21 16:28:59 EDT 2013


Hi Vikash,

On Thu, Mar 21, 2013 at 8:02 PM, Vikash Gupta <vikash.gupta at inria.fr> wrote:
> Dear Itk-Users,
> This might be a naive question but I am pondering over it for some time.
> When the ThreadedGenerateData() function is called in an itk filter, the
> threads refer to the number of CPUs on a computer or the number of cores on
> each CPU.

By default, the
MultiThreader::GetGlobalDefaultNumberOfThreadsByPlatform() method
returns the number of logical CPUs, i.e. number of CPUs multiplied by
the number of cores per CPU.

>
> For example, i have 8 cpus on my laptop with 4 cores on each, so if I call
> SetNumberOfThreads(4), these 4 cores will belong to the same CPU ?
>

The operating system will usually distribute the four threads over
different CPUs.

> On the next lever, if I divide the work on each cpu and then also do
> multithreading in each CPU, will the number of threads correspond to the
> number of cores on each CPU ?

Nope.

It is important be care when doing threading on top of threading.  The
number of threads multiply and performance with decrease if there are
too many.

Hope this helps,
Matt

> Thanks a lot for any insight..
>
> Vikash
>
>
> _____________________________________
> 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://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list