[Numpy-discussion] Numpy and OpenMP

Robert Kern robert.kern@gmail....
Sat Mar 15 14:59:12 CDT 2008

On Sat, Mar 15, 2008 at 2:48 PM, Gnata Xavier <xavier.gnata@gmail.com> wrote:
> Hi,
>  Numpy is great : I can see several IDL/matlab projects switching to numpy :)
>  However, it would be soooo nice to be able to put some OpenMP into the
>  numpy code.
>  It would be nice to be able to be able to use several CPU using the
>  numpy syntax ie A=sqrt(B).
>  Ok, we can use some inline C/C++ code but it is not so easy.
>  Ok, we can split the data over several python executables (one per CPU)
>  but A=sqrt(B) is so simple...
>  numpy + recent gcc with OpenMP  --> :) ?
>  Any comments ?

Eric Jones tried to use multithreading to split the computation of
ufuncs across CPUs. Ultimately, the overhead of locking and unlocking
made it prohibitive for medium-sized arrays and only somewhat
disappointing improvements in performance for quite large arrays. I'm
not familiar enough with OpenMP to determine if this result would be
applicable to it. If you would like to try, we can certainly give you
pointers as to where to start.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco

More information about the Numpy-discussion mailing list