Closed yaoyuki closed 2 years ago
Hi @yaoyuki,
I apologize for the late reply. I have updated the basic usage section in the README.
Based on that example, you could do something like this to check the difference in solve speed between the two solvers:
In [1]: import pypardiso
In [2]: import numpy as np
In [3]: import scipy.sparse as sp
In [4]: import scipy.sparse.linalg as spl
In [5]: n = 1000
In [6]: A = sp.rand(n, n, density=0.1, format='csr')
In [7]: b = np.random.rand(n)
In [8]: %time x_scipy = spl.spsolve(A, b)
CPU times: user 397 ms, sys: 0 ns, total: 397 ms
Wall time: 147 ms
In [9]: %time x_pypardiso = pypardiso.spsolve(A, b)
CPU times: user 222 ms, sys: 20.1 ms, total: 242 ms
Wall time: 178 ms
In [10]: n = 10000
In [11]: A = sp.rand(n, n, density=0.1, format='csr')
In [12]: b = np.random.rand(n)
In [13]: %time x_scipy = spl.spsolve(A, b)
CPU times: user 5min, sys: 856 ms, total: 5min
Wall time: 1min 15s
In [14]: %time x_pypardiso = pypardiso.spsolve(A, b)
CPU times: user 38 s, sys: 680 ms, total: 38.7 s
Wall time: 15 s
But please be aware that the solver performance always depends on your specific problem and your hardware, so a real benchmark is difficult. The discussion in this issue kinnala/scikit-fem/issues/690 has some very detailed benchmarking between pypardiso and the scipy superLU solver.
Does that answer your question?
thx! yes, I thought it would be helpful to have an example to check if one has set up the environment correctly, given that Intel MKL seems tricky. I think it would be great if readme includes the difference in time. As you say, it does depend on the environment, but just as a guide.
(In my own environment, I don't see a big difference for this specific example, but it seems the problem is on my side.)
Hi,
Is it possible to set up benchmarking comparison with a specific example between scipy.sparse.spsolve and Pardiso?
I set up PyPardiso in my environment, but I did not see any improvement, and wondering if I set up the environment correctly. Some introductory examples would be helpful for users.