bmcage / odes

The ODES scikit for ordinary differential and algebraic equations, an extension to scipy
https://scikits-odes.readthedocs.io/
Other
124 stars 45 forks source link

SUNDIALS_BLAS_LAPACK not present in sundials 6 #147

Open martinjrobins opened 1 year ago

martinjrobins commented 1 year ago

I'm trying to use the latest version of scikits.odes that uses sundials v6. I'm having trouble getting scikits.odes to recognise the lapack dense solver, and am getting the following error:

======================================================================
ERROR: test_model_solver_ode_jacobian_python (test_solvers.test_scikits_solvers.TestScikitsSolvers)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/PyBaMM/PyBaMM/tests/unit/test_solvers/test_scikits_solvers.py", line 185, in test_model_solver_ode_jacobian_python
    solution = solver.solve(model, t_eval)
  File "/home/runner/work/PyBaMM/PyBaMM/pybamm/solvers/base_solver.py", line 875, in solve
    new_solution = self._integrate(
  File "/home/runner/work/PyBaMM/PyBaMM/pybamm/solvers/scikits_ode_solver.py", line 159, in _integrate
    sol = ode_solver.solve(t_eval, y0)
  File "/home/runner/work/PyBaMM/PyBaMM/.tox/coverage/lib/python3.9/site-packages/scikits/odes/ode.py", line 333, in solve
    return self._integrator.solve(tspan, y0)
  File "scikits/odes/sundials/cvode.pyx", line 1768, in scikits.odes.sundials.cvode.CVODE.solve
  File "scikits/odes/sundials/cvode.pyx", line 1806, in scikits.odes.sundials.cvode.CVODE._solve
  File "scikits/odes/sundials/cvode.pyx", line 1610, in scikits.odes.sundials.cvode.CVODE._init_step
ValueError: LinSolver: LAPACK not available, cannot execute solver type: lapackdense

It looks like scikits.odes is looking for the SUNDIALS_BLAS_LAPACK define in sundials_config.h, as per this line

https://github.com/bmcage/odes/blob/dc2dcccbc9a2e26743e037ad03699beaa3a1bbc4/setup_build.py#L107

but I don't think sundials v6 defines this, even if the sundials lapack solvers are compiled. Instead in my sundials_config.h I have:

#define SUNDIALS_SUNLINSOL_LAPACKBAND 1
#define SUNDIALS_SUNLINSOL_LAPACKDENSE 1
testcan commented 1 year ago

Hello,

I got same issues using the latest version of scikits.odes. Did you manage to fix it?

Thanks