[Numpy-discussion] Openmp support (was numpy's future (1.1 and beyond): which direction(s) ?)

David Cournapeau david at ar.media.kyoto-u.ac.jp
Sun Mar 23 10:25:42 EDT 2008


Gnata Xavier wrote:
> Well of course my goal was not to say that my simple testcase can be 
> copied/pasted into numpy :)
> Of ourse it is one of the best case to use openmp.
> Of course pragma can be more complex than that (you can tell variables 
> that can/cannot be shared for instance).
>
> The size : Using openmp will be slower on small arrays, that is clear 
> but the user doing very large computations is smart enough to know when 
> he need to split it's job into threads. The obvious solution is to 
> provide the user with // and non // functions.

IMHO, that's a really bad solution. It should be dynamically enabled 
(like in matlab, if I remember correctly). And this means having a plug 
subsystem to load/unload different implementation... that is one of the 
thing I was interested in getting done for numpy 1.1 (or above).

For small arrays: how much slower ? Does it make the code slower than 
without open mp ? For example, what does your code says when N is 10, 
100, 1000 ?

>
> sse : sse can help a lot but multithreading just scales where sse 
> mono-thread based solutions don't.

It depends: it scales pretty well if you use several processus, and if 
you can design your application in a multi-process way.

>
> Build/link : It is an issue. It has to be tested. I do not know because 
> I haven't even tried.
>
> So, IMHO it would be nice to try to put some OpenMP simple pragmas into 
> numpy *only to see what is going on*.
>
> Even if it only work with gcc or even if...I do not know... It would be 
> a first step. step by step :)

I agree about the step by step approach; I am just not sure I agree with 
your steps, that's all. Personally, I would first try getting a plug-in 
system working with numpy. But really, prove me wrong. Do it, try 
putting some pragma at some places in the ufunc machinery or somewhere 
else; as I said earlier, I would be happy to add support for open mp at 
the build level, at least in numscons. I would love being proven wrong 
and having a numpy which scales well with multi-core :)

cheers,

David



More information about the NumPy-Discussion mailing list