<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 29, 2017 at 4:14 AM, marc <span dir="ltr"><<a href="mailto:marc.barbry@mailoo.org" target="_blank">marc.barbry@mailoo.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear Scipy developers,<br>
<br>
We are developing a program that perform a large number of sparse matrix multiplications. We recently wrote a Python version of this program for several reasons (the original code is in Fortran).<br>
<br>
We are trying now to improve the performance of the Python version and we noticed that one of the bottlenecks are the sparse matrix multiplications, as example,<br>
<br>
import numpy as np<br>
from scipy.sparse import csr_matrix<br>
<br>
row = np.array([0, 0, 1, 2, 2, 2])<br>
col = np.array([0, 2, 2, 0, 1, 2])<br>
data = np.array([1, 2, 3, 4, 5, 6], dtype=np.float32)<br>
<br>
csr = csr_matrix((data, (row, col)), shape=(3, 3))<br>
print(csr.toarray())<br>
<br>
A = np.array([1, 2, 3], dtype=np.float32)<br>
<br>
print(csr*A)<br>
<br>
<br>
I started to look at the Scipy code to see how this functions were implemented, and realized that there is no openmp parallelization over the for loops. Like in function csr_matvec in sparse/sparsetools/csr.h (line 1120). Is it possible to parallelize this loops with openmp? </blockquote><div><br></div><div>Short answer: no openmp in scipy. It has been discussed a number of times before, see for example <a href="http://numpy-discussion.10968.n7.nabble.com/Cython-based-OpenMP-accelerated-quartic-polynomial-solver-td41263.html#a41298">http://numpy-discussion.10968.n7.nabble.com/Cython-based-OpenMP-accelerated-quartic-polynomial-solver-td41263.html#a41298</a><br><br></div><div>Cheers,<br></div><div>Ralf<br><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Do you have maybe better ideas to improve the performances for this kind of operations?<br>
<br>
Best regards,<br>
Marc Barbry<br>
______________________________<wbr>_________________<br>
SciPy-Dev mailing list<br>
<a href="mailto:SciPy-Dev@python.org" target="_blank">SciPy-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scipy-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/scipy-dev</a><br>
</blockquote></div><br></div></div>