[Python-Dev] Python parallel benchmark

Tom Pinckney thomaspinckney3 at gmail.com
Fri May 16 06:33:08 CEST 2008


Interestingly, I think there's something magic going on with  
numpy.dot() on my mac.

If I just run a program without threading--that is just a numpy matrix  
multiply such as:

import numpy
a = numpy.empty((4000,4000))
b = numpy.empty((4000,4000))
c = numpy.dot(a,b)

then I see both cores fully maxed out on my mac. On a dual-core linux  
machine I see only one core maxed out by this program and it runs  
VASTLY slower on the linux box.

It turns out that numpy on Mac's uses Apple's Accelerate.framekwork  
BLAS and LAPACK which in turn is multi-threaded as of OS X 10.4.8.

On May 15, 2008, at 10:55 PM, Greg Ewing wrote:

> Tom Pinckney wrote:
>> If I look at top while running 2 or more threads, both cores are  
>> being used 100% and there is no idle time on the system.
>
> If you run it with just one thread, does it use up only
> one core's worth of CPU?
>
> If so, this suggests that the GIL is being released. If
> it wasn't, two threads would still only use one core's worth.
>
> Also, if you have only two cores, using more than two
> threads isn't going to gain you anything whatever happens.
>
> -- 
> Greg
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/thomaspinckney3%40gmail.com



More information about the Python-Dev mailing list