Hi Roger:
Your explanation is very reasonable and helpful here. Actually the
original(default) number of  BLAS threads is 2 on my computer. I just turn
it to 4 threads by hand later for comparison.

There is another question. I'm also confused that in my experiment *mclapply(2
cores)+BLAS(single thread)* is *faster* than *BLAS(2 threads) *and also
faster than* mclapply(2 cores)*. That means the combination does make sense
here.  I know mclapply employs "fork" in POSIX system. But what is the
difference? What makes the combination faster than each element of them?

Thanks all of you. Have a nice day~

Xuening


2014-02-23 2:33 GMT+08:00 Roger Bivand <Roger.Bivand@nhh.no>:

> On Sat, 22 Feb 2014, beleites,claudia wrote:
>
>  Hi Xuening,
>>
>> 2 physical vs 2 physical * 2 logical threads: See e.g. here:
>> http://unix.stackexchange.com/a/88290
>>
>> You say you have 2 *physical* cores. That's the number you want to use
>> for the parallel execution. Logical cores are just 2 (or more) threads
>> running on the same physical core. IIRC, this can speed up things mainly if
>> the 2 threads run very different operations.
>>
>
> Yes, this is my experience - I turn off Intel hyperthreads in BIOS to
> prevent software getting confused. BLAS sees available compute resources,
> so your BLAS may be installed to see 4 cores, but doesn't know that two are
> hyperthreads and compete for physical resources. It may be that by limiting
> BLAS to 2, it gets privileged access to the two real cores, and other OS
> (or other) tasks running at the same time use the hyperthreads.
>
> Roger
>
>
>> --
Xuening Zhu
--------------------------------------------------------
Master of Business Statistics
Guanghua School of Management, Peking University

	[[alternative HTML version deleted]]

