[Numpy-discussion] performance matrix multiplication vs. matlab

David Cournapeau david at silveregg.co.jp
Tue Jan 5 22:49:28 EST 2010


Xue (Sue) Yang wrote:
> Hi,
> 
> I followed what I collected about installation of numpy with lapack and
> atlas and installed numpy on our desktop with RHEL4 and 4 cores.
> 
>> uname -a
> 
> Linux curie.physics.usyd.edu.au 2.6.9-89.0.15.ELsmp #1 SMP Sat Oct 10
> 05:59:16 EDT 2009 i686 i686 i386 GNU/Linux
> 
> I successfully installed lapack-3.1.1, atlas3.8.0 with fortran comfiler:
> gfortran, and numpy-1.3.0 with enthought-python distribution (python2.5).
> 
>> python
>>> import numpy
>>> a = numpy.random.randn(6000, 6000)
>>> numpy.dot(a, a)
> 
> Surprisingly, it only uses 2 cores instead of 4 cores.  Where and how should
> I set up the number of threads for numpy?

Atlas (at least your version, I don't know about 3.9.* series) does not 
support setting the number of threads dynamically - it is a compile time 
option. If the compile time option is indeed 4 threads, it may be that 
ATLAS decided that using 2 threads instead of 4 was more efficient.

You can find this info in atlas_buildinfo.h file (the ATL_NCPU CPP 
define). Note that you should not use atlas 3.8.0, as it has a number of 
serious bugs - you should use 3.8.3.

David



More information about the NumPy-Discussion mailing list