Open jinningwang opened 4 weeks ago
Jinning,
Thanks! UNFPACK support comes for free with KVXOPT or cvxopt. Once we replace the sparse matrices handling with SciPy, we will automatically switch to using UMFPACK from there.
Get Outlook for iOShttps://aka.ms/o0ukef
From: Jinning Wang @.>
Sent: Thursday, August 15, 2024 9:59:25 AM
To: CURENT/andes @.>
Cc: Hantao Cui @.>; Assign @.>
Subject: Re: [CURENT/andes] Deprecate native dependency on umfpack
(Issue #562)
Assigned #562https://github.com/CURENT/andes/issues/562 to @cuihantaohttps://github.com/cuihantao.
— Reply to this email directly, view it on GitHubhttps://github.com/CURENT/andes/issues/562#event-13896180517, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABSNZA3I7LJUYTXCKOSCQBTZRSX33AVCNFSM6AAAAABMSIHBJ2VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJTHA4TMMJYGA2TCNY. You are receiving this because you were assigned.Message ID: @.***>
I'm thinking that, maybe we can benchmark the performance of involved methods? Here is a code to my mind.
Feel free to let me know if you have any other comments.
scipy.sparse.linalg import spsolve
# assume `A` is a 2D matrix and `b` is a vector
# method1
x1 = spsolve(A, b, use_umfpack=True)
# method2
x2 = spsolve(A, b, use_umfpack=False)
Sure. This is benchmarking UMFPACK and SuperLU performance. And remember the default solver is KLU, which is probably 30% faster than UMFPACK. And.. using KVXOPT to handle sparse matrices can be 20%-50% faster than using SciPy for systems with, say, 10,000 buses.
On Aug 15, 2024, at 11:12 AM, Jinning Wang @.***> wrote:
I'm thinking that, maybe we can benchmark the performance of involved methods? Here is a code to my mind.
Feel free to let me know if you have any other comments.
scipy.sparse.linalg import spsolve
assume
A
is a 2D matrix andb
is a vectormethod1
x1 = spsolve(A, b, use_umfpack=True)
method2
x2 = spsolve(A, b, use_umfpack=False) — Reply to this email directly, view it on GitHub https://github.com/CURENT/andes/issues/562#issuecomment-2291495059, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSNZA72HTK7S2KU3GAU5PDZRTANDAVCNFSM6AAAAABMSIHBJ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJRGQ4TKMBVHE. You are receiving this because you were mentioned.
Is your feature request related to a problem? Please describe. The native dependency on
umfpack
viakvxopt
can introduce license issue. The involved implementation in ANDES is in: https://github.com/CURENT/andes/blob/5ab784b75347a98d07c004e32d7c4b39d407ea2e/andes/linsolvers/suitesparse.py#L7-L8Further, it can be traced back to
SuiteSparse
viakvxopt
: https://github.com/sanurielf/kvxopt/blob/cc4cd9a4f2f27c2f5cac1363ba0f36574b16b0bd/setup.py#L76-L93Describe the solution you'd like
For reference, package
SciPy
provides wrappers ofumfpack
(via a BSD licensed packagescikit-umfpack
), but doesn't include it as a dependency.Code: https://github.com/scipy/scipy/blob/9e9d534b7afac90e8d2fa23be1d0ab1201c1bde1/scipy/sparse/linalg/_dsolve/linsolve.py#L13-L19
Documentation: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.use_solver.html
Dependency: In the dependency, the package
scikit-umfpack
is included in [test] rather than in [build-system]. https://github.com/scipy/scipy/blob/9e9d534b7afac90e8d2fa23be1d0ab1201c1bde1/pyproject.toml#L18-L32Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context