-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Enhancement on support for linear equation solvers #7837
Labels
Comments
neozhaoliang
pushed a commit
that referenced
this issue
May 8, 2023
Issue: #7837 ### Brief Summary As described in Issue #7837 , I first implemented Plan # 1 to enforce a more consistent naming for the current solvers. All solver code are untouched, except for the naming: ``` ti.linalg.SparseSolver => no change ti.linalg.CG => ti.linalg.SparseCG ti.linalg.taichi_cg_solver => ti.linalg.MatrixFreeCG ``` The Python test scripts are also updated accordingly. This doesn't mean Plan # 3 is abandoned though: we can unify `SparseCG` and `MatrixFreeCG` in the future if that's the route we want. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
neozhaoliang
added a commit
that referenced
this issue
May 8, 2023
Issue: #7837 ### Brief Summary As a follow-up PR related to issue #7837 and PR #7911, split the description for linear solver from `sparse_matrix.md`. More information will be filled into the additional `linear_solver.md` page once PR #7911 is merged, to reflect the latest usage information of the linear solvers. --------- Co-authored-by: Zhao Liang <mathzhaoliang@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
quadpixels
pushed a commit
to quadpixels/taichi
that referenced
this issue
May 13, 2023
Issue: taichi-dev#7837 ### Brief Summary As described in Issue taichi-dev#7837 , I first implemented Plan # 1 to enforce a more consistent naming for the current solvers. All solver code are untouched, except for the naming: ``` ti.linalg.SparseSolver => no change ti.linalg.CG => ti.linalg.SparseCG ti.linalg.taichi_cg_solver => ti.linalg.MatrixFreeCG ``` The Python test scripts are also updated accordingly. This doesn't mean Plan # 3 is abandoned though: we can unify `SparseCG` and `MatrixFreeCG` in the future if that's the route we want. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
quadpixels
pushed a commit
to quadpixels/taichi
that referenced
this issue
May 13, 2023
…7921) Issue: taichi-dev#7837 ### Brief Summary As a follow-up PR related to issue taichi-dev#7837 and PR taichi-dev#7911, split the description for linear solver from `sparse_matrix.md`. More information will be filled into the additional `linear_solver.md` page once PR taichi-dev#7911 is merged, to reflect the latest usage information of the linear solvers. --------- Co-authored-by: Zhao Liang <mathzhaoliang@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
quadpixels
pushed a commit
to quadpixels/taichi
that referenced
this issue
May 13, 2023
WIP. Don't merge. Issue: taichi-dev#7837 Issue: taichi-dev#7921 ### Brief Summary Update contents in `linear_solver.md` to reflect the latest changes and development progress on the linear solver. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Purpose
The purpose of this RFC is to discuss the plan on refactoring the linear solvers available under
ti.linalg
. Generally speaking, all solvers target at solvingwhere$A$ is a $n \times n$ matrix and $n$ is the number of unknowns.
Current status
Currently, users have four options if they need to solve a set of large-scale linear equations.
SparseMatrix
API to build a sparse matrix, and then solve it usingti.linalg.SparseSolver
. [example]SparseMatrix
API to build a sparse matrix, and then solve it usingti.linalg.CG
. [example]ti.linalg.taichi_cg_solver
to which you pass aLinearOperator
to representA brief summary of the supported solvers:
SparseMatrix
SparseMatrix
SparseMatrix
SparseMatrix
We notice that the naming of the provided solvers are not consistent and intuitive. For example,
ti.linalg.taichi_cg_solver
andti.linalg.CG
exist simultaneously, and it's unclear which one should be used for a certain circumstanceti.linalg.CG
is intended (only) forSparseMatrix
, but a user might expect it to be able to handle more data typesProposed plan
I proposed the following plans to resolve the naming issue, as well as promote a better separation of concerns:
Plan 1. Keep the file organization untouched; use a more intuitive naming to suggest their usage. Namely,
Plan 2. Construct an extensible module structure for each matrix type. Specifically, the solvers will be reorganized into subdirectories suggesting its target matrix type:
This way, user can use the solvers by the following imports:
Plan 3. Unify the solver API, and let the solver to determine which version it should use. In this case,
ti.linalg.CG
andti.linalg.taichi_cg_solver
will be combined into oneti.linalg.CG
. From a user's perspective, calling the CG solver will simply beno matter
A
is aLinearOperator
or aSparseMatrix
.Additional comments
Which plan do you prefer? To be sure, each plan has its own pros and cons, and we welcome all users and developers' opinion on this issue!
The text was updated successfully, but these errors were encountered: