Skip to content

Commit

Permalink
add IDENTITY factorization for debug
Browse files Browse the repository at this point in the history
  • Loading branch information
otvam committed Nov 9, 2023
1 parent 9b40ed7 commit fa0fb7b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions pypeec/data/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ FFT_LIBRARY: "SciPy" # "SciPy" or "FFTW" or "CuPy"
# - SuperLU is typically slower but is always available (integrated with SciPy)
# - UMFPACK is typically faster than SuperLU (available through SciKits)
# - PARDISO is typically faster than UMFPACK (available through Pydiso)
# - IDENTITY is using the identity matrix as a solution (for debug)
FACTORIZATION_LIBRARY: "SuperLU" # "SuperLU" or "UMFPACK" or "PARDISO"

# method for dense matrix multiplication
Expand Down
3 changes: 3 additions & 0 deletions pypeec/lib_check/check_data_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def _check_data(data_config):
"SuperLU",
"UMFPACK",
"PARDISO",
"IDENTITY",
]
datachecker.check_choice("FACTORIZATION_LIBRARY", data_config["FACTORIZATION_LIBRARY"], lib)

Expand Down Expand Up @@ -202,6 +203,8 @@ def _check_library(data_config):
elif data_config["FACTORIZATION_LIBRARY"] == "PARDISO":
lib = importlib.util.find_spec("pydiso")
datachecker.check_assert("library", lib is not None, "PARDISO is not installed")
elif data_config["FACTORIZATION_LIBRARY"] == "IDENTITY":
pass
else:
raise ValueError("invalid matrix factorization library")

Expand Down
5 changes: 5 additions & 0 deletions pypeec/lib_matrix/matrix_factorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- SuperLU is typically slower but is always available (integrated with SciPy)
- UMFPACK is typically faster than SuperLU (available through SciKits)
- PARDISO is typically faster than UMFPACK (available through Pydiso)
# - IDENTITY is using the identity matrix as a solution (for debug)
Todo
----
Expand Down Expand Up @@ -56,6 +57,8 @@
# set number of threads
mkl_solver.set_mkl_pardiso_threads(THREAD_PARDISO)
mkl_solver.set_mkl_threads(THREAD_MKL)
elif FACTORIZATION_LIBRARY == "IDENTITY":
pass
else:
raise ValueError("invalid factorization library")

Expand Down Expand Up @@ -157,6 +160,8 @@ def factor_empty(rhs):
factor = _get_fact_umfpack(mat)
elif FACTORIZATION_LIBRARY == "PARDISO":
factor = _get_fact_pardiso(mat)
elif FACTORIZATION_LIBRARY == "IDENTITY":
factor = factor_empty
else:
raise ValueError("invalid matrix factorization library")

Expand Down

0 comments on commit fa0fb7b

Please sign in to comment.