Confusion about nthread and ncore [message #89726] |
Thu, 20 November 2014 10:04  |
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 #89753 is a reply to message #89745] |
Sat, 29 November 2014 16:40  |
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.
|
|
|