[Numpy-discussion] Numpy matrix multiplication slow even though ATLAS linked

Pauli Virtanen pav@iki...
Fri Oct 31 08:45:56 CDT 2008


Thu, 30 Oct 2008 22:19:01 +0000, Jan-Willem van de Meent wrote:

> On Thursday 30 October 2008 18:41:51 Charles R Harris wrote:
>> On Thu, Oct 30, 2008 at 5:19 AM, Jan-Willem van de Meent <
>>
>> vandemeent@damtp.cam.ac.uk> wrote:
>> > Dear all,
>> >
>> > This is my first post to this list. I am having perfomance issues
>> > with with numpy/atlas. Doing dot(a,a) for a 2000x2000 matrix takes 
>> > about 1m40s, even though numpy is appears to link to my atlas
>> > libraries:

Can you try to benchmark your ATLAS library using a simple C or Fortran 
program to check if the problem is in Numpy, or in Atlas itself.

For comparison,

	gfortran -o test test.f90 -lblas

	time ./test   # ATLAS
	-> 0.55 s

	LD_PRELOAD=/usr/lib/libblas.so.3.0 time ./test  # reference BLAS
	-> 5.6 s


test.f90
--------
program main
    integer, parameter :: n = 1000
    double precision, dimension(n,n) :: a, b, c
    integer :: i, j

    do i = 1, n
        do j = 1,n
            a(i,j) = i+j
            b(i,j) = i-j
        end do
    end do

    call dgemm('N', 'N', n, n, n, 1d0, a, n, b, n, 0d0, c, n)
end program main



More information about the Numpy-discussion mailing list