[SciPy-Dev] scipy.sparse and OpenMP

David Warde-Farley wardefar@iro.umontreal...
Fri Mar 23 11:06:01 CDT 2012


On 2012-03-05, at 5:15 AM, Maximilian Nickel <nickel@dbs.ifi.lmu.de> wrote:

> Hi everyone,
> I've been working with fairly large sparse matrices on a
> multiprocessor system lately and noticed that scipy.sparse is
> single-threaded. Since I needed faster computations, I've quickly
> added some OpenMP #pragma directives in scipy/sparse/sparsetools to
> the functions that I've been using in order to enable multithreading,
> what worked out nicely. I wondered if you would be interested in a
> more complete OpenMP-enabled version of scipy.sparse.setuptools. I've
> attached the patch of the quick-and-dirty changes that I made so far
> to this mail, to give you an idea.
> 
> Best regards
> Max
> <sparse-openmp.patch>

I am actually interested in this topic as well, especially considering Cython's recent support for them via cython.parallel.

One thing I've heard Mark Florisson say is that code running with OpenMP pragmas in any thread other than the main one can cause bad things to happen, so I guess any SciPy policy on the inclusion of OpenMP pragmas will have to take the possibility of existing client code running a CPU bound thread in the background (which may be pretty remote, if current code doesn't release the GIL). Of course the caveats must also be weighed and, if accepted, quite clearly documented.

David


More information about the SciPy-Dev mailing list