bmcage/odes

test_lsodi fails on aarch64

flokli opened this issue · 4 comments

While packaging scikits-odes for nixpkgs, I noticed TestDae.test_lsodi fails on aarch64-linux

============================= test session starts ==============================
platform linux -- Python 3.7.4, pytest-4.6.3, py-1.7.0, pluggy-0.12.0
rootdir: /nix/store/avziwbawg0ibqccizgxfmhjcnjbbg7nd-python3.7-scikits.odes-2.4.0/lib/python3.7/site-packages/scikits/odes/tests
collected 81 items
test_dae.py ...F                                                         [  4%]
test_dop.py .                                                            [  6%]
test_get_info.py .....                                                   [ 12%]
test_odeint.py .....                                                     [ 18%]
test_on_funcs.py ............                                            [ 33%]
test_on_funcs_ida.py ............                                        [ 48%]
test_user_return_vals_cvode.py ........................                  [ 77%]
test_user_return_vals_ida.py ..................                          [100%]

=================================== FAILURES ===================================
______________________________ TestDae.test_lsodi ______________________________
self = <odes.tests.test_dae.TestDae testMethod=test_lsodi>
    def test_lsodi(self):
        """Check the lsodi solver"""
        for problem_cls in PROBLEMS_LSODI:
            problem = problem_cls()
>           self._do_problem(problem, 'lsodi', **problem.lsodi_pars)
test_dae.py:59:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_dae.py:34: in _do_problem
    soln = ig.step(time, z[i], zprime[i])
../dae.py:439: in step
    return self._integrator.step(t, y_retn, yp_retn)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <scikits.odes.lsodiint.lsodi object at 0xffff7ae2b310>, t = 400.0
y_retn = array([4.70187465e-01, 3.48124556e-06, 5.29809054e-01])
yp_retn = array([4.50537891e-01, 3.22315111e-06, 5.49458886e-01])
    def step(self, t, y_retn, yp_retn = None):
        """ See dae.DaeBase
        """
        if not self.initialized:
            raise ValueError('Method ''init_step'' has to be called prior to the'
                    'first call of ''step'' method, or after changing options')
        if t > 0.0:
            if self.tstop is None:
                itask = 1
                self.call_args[3] = 1
            else:
                itask = self.call_args[3]
                self.call_args[3] = 4
            self.y, self.yp, self.t = self.__run(self.y, self.yp, self.t, t)
            self.call_args[3] = itask
        else:
            itask = self.call_args[3]
            if self.tstop is None:
                self.call_args[3] = 2
            else:
                self.call_args[3] = 5
            self.y, self.yp, self.t  = self.__run(self.y, self.yp, self.t, -t)
            self.call_args[3] = itask
        y_retn[:] = self.y[:]
        if yp_retn is not None:
>           yp_retn[:] = self.yp[:]
E           TypeError: 'NoneType' object is not subscriptable
../lsodiint.py:376: TypeError
----------------------------- Captured stdout call -----------------------------
lsodi: excess work done on this call (check all inputs).
lsodi: present residual is [-1.17961196e-15  5.42101086e-20 -6.17733149e-12]
=============================== warnings summary ===============================
test_dae.py::TestDae::test_ida_old_api
test_dae.py::TestDae::test_ida_old_api
test_dae.py::TestDae::test_ida_old_api
  /nix/store/avziwbawg0ibqccizgxfmhjcnjbbg7nd-python3.7-scikits.odes-2.4.0/lib/python3.7/site-packages/scikits/odes/dae.py:389: DeprecationWarning: Old api is deprecated, move to new api
    return self._integrator.init_step(t0, y0, yp0, y_ic0_retn, yp_ic0_retn)
-- Docs: https://docs.pytest.org/en/latest/warnings.html
=============== 1 failed, 80 passed, 3 warnings in 1.94 seconds ================
builder for '/nix/store/p3r9d2bn6dl34ghgpq7fv3v0i4p9ql5l-python3.7-scikits.odes-2.4.0.drv' failed with exit code 1

It's only that one test, and it runs on both x86_64-linux and x86_64-darwin just fine. Anybody knows what's going on here?

As the test starts with if yp_retn is not None:, this is only possible if self.yp is None.
This can only be None of lsodi returns bad data in the call to self.__run
So this should indicate an error in lsodi (fortran). I assume there is no test code for lsodi that can be tried on aarch64?
lsodi is a very old fortran solver, only added for historical reasons and to allow to compare how newer solvers like sundials stack up. It is not critical if it fails, but should be documented.

I do have access to an aarch64 box (any raspiv3 should do too), but I'm not really into any of these solvers, so can't really debug it myself.

Can you give this a try somewhere?

Otherwise I could also file a PR that disables that test, raises an Exception if you try to run it on aarch64, and adds something to the README it's not supported on that platform.

No raspiv3 available at the moment. Best is probably a PR to disable that test on aarch64 with README. Even if we can verify lsodi fails on aarch64, there are no developers anymore on lsodi, it is a predecessor of the current sundials.

I added #104 which does as suggested.