[SciPy-Dev] Multithreading sparse matrix to dense vector(s) multiplication

Gregory Lee grlee77 at gmail.com
Mon Mar 16 14:44:03 EDT 2020


On Mon, Mar 16, 2020 at 12:56 PM Jorge Guerra <jeguerra at ucdavis.edu> wrote:

> Hello everyone,
>
> I'm quite new to the SciPy development community. I've identified a
> potential improvement that would be very helpful:
>
> in scipy/sparse/sparsetools/csr.h @ lines 1092 and 1129 in the
> csr_matvec() and mat_vecs() methods I would like to parallelize the outer
> for loop over the rows of the input sparse matrix. The current serial code
> looks just about optimal, but should take advantage of a multicore machine.
> This is a place where SciPy is deficient.
>
>
Welcome,

Have you tried this to verify that you do indeed get a performance
improvement with multithreading? I seem to recall sparse matrix-vector
mulitiplication is more difficult to accelerate than dense matrix-vector
multiplication because it tends to be memory bound. A quick search just now
turned up the following paper that discusses some of the difficulties
involved:
http://www.cslab.ece.ntua.gr/~nkoziris/papers/pdp08understanding.pdf



> Going through the compilation, SciPy depends on pThreads. However, my
> proposed change would be trivial by including OpenMP, but I don't
> necessarily want to add to the overall dependencies.
>
> Would anyone more familiar with pThreads be willing to collaborate with me
> to accomplish this proposed task? Or perhaps advice on an alternative to
> get multithreaded sparse matrix to dense vector multiplication implemented?
>
> Thank you all!
>
> Jorge
>
> --
> *Jorge E. Guerra, PhD.*
> *Research Scientist, CIMMS/NOAA*
> *Earth Systems Research Laboratory, Boulder, CO*
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at python.org
> https://mail.python.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20200316/d8d4c2ba/attachment-0001.html>


More information about the SciPy-Dev mailing list