comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Confusion about nthread and ncore
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Confusion about nthread and ncore [message #89726] Thu, 20 November 2014 10:04 Go to next message
chuxiangning is currently offline  chuxiangning
Messages: 17
Registered: September 2012
Junior Member
Hi All
It has always been confusing to me how IDL handles nthread and ncores.
I have an i7 which has 4 physical cores and 8 threads.
Matlab recognizes i7 as 4 cores and uses 4 threads. IDL recognizes i7 as 8 threads.
In my opinion, in a computation-heavy program, 4 threads should be used instead of 8, because using 8 threads actually slows down the program.
Is this correct?
Re: Confusion about nthread and ncore [message #89731 is a reply to message #89726] Fri, 21 November 2014 03:59 Go to previous messageGo to next message
Sergey Anfinogentov is currently offline  Sergey Anfinogentov
Messages: 11
Registered: September 2012
Junior Member
It depends on the code.
The best way is to make an experiment using your computer and your code.

You can measure the execution time of your program with default settings then you can change threads count via "cpu,TPOOL_NTHREADS = 4" and ,measure the execution time again.


четверг, 20 ноября 2014 г., 18:04:10 UTC пользователь chu xiangning написал:
> Hi All
> It has always been confusing to me how IDL handles nthread and ncores.
> I have an i7 which has 4 physical cores and 8 threads.
> Matlab recognizes i7 as 4 cores and uses 4 threads. IDL recognizes i7 as 8 threads.
> In my opinion, in a computation-heavy program, 4 threads should be used instead of 8, because using 8 threads actually slows down the program.
> Is this correct?
Re: Confusion about nthread and ncore [message #89737 is a reply to message #89731] Tue, 25 November 2014 09:38 Go to previous messageGo to next message
chuxiangning is currently offline  chuxiangning
Messages: 17
Registered: September 2012
Junior Member
Thanks for your suggestion!
I've tested my program under different cases by setting nthreads to different values. (cpu,tpool_nthreads = 3)
I have an i7 cpu, which has 4 cores and 8 threads(2 per cpu).
It turns out the program runs faster when I set nthread to 4 instead of 8 (IDL default). This result is expected anyway.
As a suggestion to IDL, I would suggest they change the default value of nthreads according to number of cores.


nthread time (sec)
1 7.923
2 4.458
3 3.451
4 3.055
6 3.162
8 3.298
Re: Confusion about nthread and ncore [message #89745 is a reply to message #89737] Thu, 27 November 2014 01:05 Go to previous messageGo to next message
victor.cazcarra is currently offline  victor.cazcarra
Messages: 4
Registered: May 2013
Junior Member
El martes, 25 de noviembre de 2014 18:38:48 UTC+1, chu xiangning escribió:
> Thanks for your suggestion!
> I've tested my program under different cases by setting nthreads to different values. (cpu,tpool_nthreads = 3)
> I have an i7 cpu, which has 4 cores and 8 threads(2 per cpu).
> It turns out the program runs faster when I set nthread to 4 instead of 8 (IDL default). This result is expected anyway.
> As a suggestion to IDL, I would suggest they change the default value of nthreads according to number of cores.
>
>
> nthread time (sec)
> 1 7.923
> 2 4.458
> 3 3.451
> 4 3.055
> 6 3.162
> 8 3.298

Hi,

I think that it always depends on your program. if your program can do some works in parrallel automatically, for example if you work with big matricies IDL do some parallelization so it is better not using all the threads.

I was working with IDL_bridge trying to split a big loop to work in parallel and for me it worked better using the number of threads instead of the number of cores.

I am not a hardware expert but I guess that it also depends on the structure of your processor.

In any case, It is a good idea always testing your program and choose the best compromise between number of threads and time.
Re: Confusion about nthread and ncore [message #89753 is a reply to message #89745] Sat, 29 November 2014 16:40 Go to previous message
chuxiangning is currently offline  chuxiangning
Messages: 17
Registered: September 2012
Junior Member
On Thursday, November 27, 2014 1:05:52 AM UTC-8, Víctor Cazcarra wrote:
> El martes, 25 de noviembre de 2014 18:38:48 UTC+1, chu xiangning escribió:
>> Thanks for your suggestion!
>> I've tested my program under different cases by setting nthreads to different values. (cpu,tpool_nthreads = 3)
>> I have an i7 cpu, which has 4 cores and 8 threads(2 per cpu).
>> It turns out the program runs faster when I set nthread to 4 instead of 8 (IDL default). This result is expected anyway.
>> As a suggestion to IDL, I would suggest they change the default value of nthreads according to number of cores.
>>
>>
>> nthread time (sec)
>> 1 7.923
>> 2 4.458
>> 3 3.451
>> 4 3.055
>> 6 3.162
>> 8 3.298
>
> Hi,
>
> I think that it always depends on your program. if your program can do some works in parrallel automatically, for example if you work with big matricies IDL do some parallelization so it is better not using all the threads.
>
> I was working with IDL_bridge trying to split a big loop to work in parallel and for me it worked better using the number of threads instead of the number of cores.
>
> I am not a hardware expert but I guess that it also depends on the structure of your processor.
>
> In any case, It is a good idea always testing your program and choose the best compromise between number of threads and time.

Thanks for weighing in.
Yes it depends on the programs.
In some of my program, I also have large matrix and IDL automatically use parallel calculation.
The problem is, by setting CPU to use number of cores instead of number of threads, the program runs faster.
It is also true if you run several IDLs together.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: rebinning two arrays? or re: finding exclusive elements between 2 not-quite identical arrays?
Next Topic: How to check if the widget_table is empty?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 07:23:47 PDT 2025

Total time taken to generate the page: 0.00405 seconds