fixes #147: SUNDIALS_BLAS_LAPACK not present in sundials 6
Tested with scikits.odes 2.7.0 (at commit 57466a97a278f687a6b0a92343b767c495834b31), python 3.11.4, and sundials 6.6.1 compiled against oneMKL 2023.0 Update 2 on Ubuntu 22.04.3 LTS. The test details below were taken from this comment in #97:
Testing code and output w/ and w/o lapack
With lapack
import numpy as np
from scikits.odes.odeint import odeint
tout = np.linspace(0, 1)
initial_values = np.array([1])
def right_hand_side(t, y, ydot):
ydot[0] = y[0]
output = odeint(right_hand_side, tout, initial_values,linsolver='lapackdense')
print(output.values.y)
In a bash shell
export MKL_VERBOSE=1
ipython
<run code above>
MKL_VERBOSE oneMKL 2023.0 Update 2 Product build 20230613 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 2 (Intel(R) AVX2) enabled processors, Lnx 1.90GHz lp64 gnu_thread
MKL_VERBOSE SDOT(2,0x562640d4f1a0,1,0x562640d4f1a0,1) 1.89ms CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:2
... <lots of redacted MKL_VERBOSE and output.values.y output>
[2.66339741]
[2.7183115 ]]
With out lapack
import numpy as np
from scikits.odes.odeint import odeint
tout = np.linspace(0, 1)
initial_values = np.array([1])
def right_hand_side(t, y, ydot):
ydot[0] = y[0]
output = odeint(right_hand_side, tout, initial_values,linsolver='dense')
print(output.values.y)
same bash shell/ipython session as above with lapack
... <lots of redacted output.values.y output and no MKL_VERBOSE output>
[2.66339741]
[2.7183115 ]]
@stuart-nolan Can you see if the new refactor has solved your issue?
No.
Looks like this PR needs to be updated and applied for scikits.odes 3.0. I'll do that but I may not get to it quickly.
I'm not sure if you plan to merge this. No worries if you don't as interest in this capability seems low and I'm not using it.
Tested with scikits-odes v3.0.0, python 3.11.4, sundials 6.6.1, oneMKL 2024.2, on Ubuntu 22.04.4 LTS.
At some point in the coming months I'll upgrade to python 3.12.x and possibly sundials 7.x.x and test if this still works.
@stuart-nolan If you have time, can you try to rebase this (and hopefully the CI will run), thanks!
it will rebase, but it wont build (python 3.12.7, sundials 7.1.1, oneMKL 2025.0, ubuntu 24.04 lts).
Errors seem to start in cvode.pyx before anything lapack related which i dont recall previously:
...
Error compiling Cython file:
------------------------------------------------------------
...
# Linsolver
linsolver = opts['linsolver'].lower()
if nonlinsolver == 'newton':
if linsolver == 'dense':
A = SUNDenseMatrix(N, N, self.sunctx)
LS = SUNLinSol_Dense(self.y0, A, self.sunctx)
^
------------------------------------------------------------
src/scikits_odes_sundials/cvode.pyx:1448:36: Cannot convert 'SUNLinearSolver' to Python object
Error compiling Cython file:
------------------------------------------------------------
...
if nonlinsolver == 'newton':
if linsolver == 'dense':
A = SUNDenseMatrix(N, N, self.sunctx)
LS = SUNLinSol_Dense(self.y0, A, self.sunctx)
# check if memory was allocated
if (A == NULL or LS == NULL):
^
------------------------------------------------------------
src/scikits_odes_sundials/cvode.pyx:1450:36: Invalid types for '==' (Python object, void *)
... errors continue
FWIW it dose build without this commit but cvodes dose not seem to be linked to sundials (it is on past versions w/ and w/o this commit). I'm not sure if this is related. Other parts seem ok:
ldd cvodes.cpython-312-x86_64-linux-gnu.so
linux-vdso.so.1 (0x00007ffca13c0000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007344ece00000)
/lib64/ld-linux-x86-64.so.2 (0x00007344ed249000)
ldd cvode.cpython-312-x86_64-linux-gnu.so
linux-vdso.so.1 (0x00007ffd6cbba000)
libsundials_cvode.so.7 => /home/ul/.local/lib/sundials-7.1.1.mkl/libsundials_cvode.so.7 (0x00007280dc793000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007280dc400000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007280dc68e000)
libsundials_core.so.7 => /home/ul/.local/lib/sundials-7.1.1.mkl/libsundials_core.so.7 (0x00007280dc67a000)
/lib64/ld-linux-x86-64.so.2 (0x00007280dc869000)
This will take some time for me to sort out and I may not get to it anytime soon.
After
git revert a4ed8ae89b68a1f7cb7758a2f871b05be79bd393
pip -v install packages/*
the test code above works as expected (python 3.12.7, sundials 7.1.1, oneMKL 2025.0, ubuntu 24.04 lts).
I still don't see links to sundials in cvodes.cpython-312-x86_64-linux-gnu.so.
I'll force push a rebase.
This is as far as I'm going to take this.