[Numpy-discussion] Numpy and OpenMP

Damian Eads eads@soe.ucsc....
Sat Mar 15 16:22:49 CDT 2008

Robert Kern wrote:
> 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.

Perhaps I'm missing something. How is locking and synchronization an 
issue when each thread is writing to a mutually exclusive part of the 
output buffer?



More information about the Numpy-discussion mailing list