sundials4py: expose optional KLU SUNLinearSolver bindings#966
Conversation
balos1
left a comment
There was a problem hiding this comment.
We need to add a python example that uses the KLU SUNLinearSolver too. A python version of https://github.com/llnl/sundials/blob/main/examples/arkode/C_klu/ark_brusselator1D_klu.c would be good.
We also need to add to the docs how one can build sundials4py with KLU enabled.
|
@copilot the format_check is failing, apply the formatting |
Applied the formatting fix in commit |
Co-authored-by: Daniel R. Reynolds <dreynolds@umbc.edu> Co-authored-by: Cody Balos <cjbalos@gmail.com>
Co-authored-by: Cody Balos <cjbalos@gmail.com>
#966 (comment) #966 (comment) #966 (comment) #966 (comment) #966 (comment) Keep the KLU example mention removed from the Python usage text while preserving the examples role target so the documentation link remains valid. Signed-off-by: Cody Balos <balos1@llnl.gov>
#966 (comment) Add Python unit-test coverage for the KLU solver constructor, reinit, ordering, and factorization accessors. Register the opaque KLU accessor types so the getter bindings can return Python objects by reference. Signed-off-by: Cody Balos <balos1@llnl.gov>
#966 (comment) Use NumPy reshape in the KLU Brusselator example so N_Vector data is handled as (N, 3) arrays for state, residual, Jacobian, masks, and output. Signed-off-by: Cody Balos <balos1@llnl.gov>
|
@copilot apply the changes in the diff produced by the failing litgen_check |
Applied the |
sundials4pyexposedSUNLINEARSOLVER_KLUin enums but did not expose the KLU constructor/configuration APIs.sunlinsol_klu.cpp) and generated binding surface (sunlinsol_klu_generated.hpp) forSUNLinSol_KLU,SUNLinSol_KLUReInit,SUNLinSol_KLUSetOrdering, andSUNKLU_*constants.sundials4py.cppbehind#if defined(SUNDIALS_KLU_ENABLED).bindings/sundials4py/CMakeLists.txtto compile/link KLU bindings only whenSUNDIALS_ENABLE_SUNLINSOL_KLUis enabled.sunlinsol_kluentry tobindings/sundials4py/sunlinsol/generate.yaml.test_sunlinearsolver.pywith runtime skip when KLU is unavailable.examples/python/arkode/ark_brusselator1D_klu.py, a Python port of the C KLU example (examples/arkode/C_klu/ark_brusselator1D_klu.c) demonstratingSUNLinSol_KLUin an ARKODE solve.doc/shared/Python/Usage.rstwith instructions for buildingsundials4pywith KLU enabled viaCMAKE_ARGS(including SuiteSparse discovery) and referenced the new KLU Python example.