[Numpy-discussion] Fast threading solution thoughts

Sturla Molden sturla@molden...
Thu Feb 12 07:11:43 CST 2009


On 2/12/2009 1:50 PM, Francesc Alted wrote:

> Hey!  That's very nice to know.  We already have OpenMP support in 
> Cython for free (or apparently it seems so :-)

Not we don't, as variable names are different in C and Cython. But 
adding support for OpenMP would not bloat the Cython language.

Cython must exhange the variable names and leave the comment in C as a 
pragma to the C compiler.

IMHO, OpenMP is the easiest way to use parallel computing in scientific 
projects. It is much easier than manually fiddling with threads, 
processes, MPI, etc. Just write code as you normally would, debug and 
verify. Then you spend five minutes inserting pragmas to the compiler, 
and et voilá you have a parallel program. The same code will then 
compile and run correctly for parallel or sequential execution, 
depending on a compiler switch (-fopenmp). You get load balancing for 
free, as that is built into OpenMP. OpenMPs API is so small that it just 
takes 10 minutes to learn.

OpenMP currently works on SMPs (e.g. multicore CPUs), but there is work 
going on to port it to clusters as well.


S.M.


More information about the Numpy-discussion mailing list