[Numpy-discussion] test failures when embedded (in matlab)
Ondřej Čertík
ondrej.certik@gmail....
Thu Jan 3 23:16:33 CST 2013
On Thu, Jan 3, 2013 at 7:54 AM, Robin <robince@gmail.com> wrote:
> Hi All,
>
> When using Numpy from an embedded Python (Python embedded in a Matlab
> mex function) I get a lot of test failures (see attached log).
>
> I am using CentOS 6.3, distribution packaged Python (2.6) and Numpy
> (1.4.1). Running numpy tests from a normal Python interpreter results
> in no errors or failures.
>
> Most of the failures look to be to do with errors calling Fortran
> functions - is it possible there is some linking / ABI problem? Would
> there be any way to overcome it?
>
> I get similar errors using EPD 7.3.
>
> Any advice appreciated,
In your log I can see failures of the type:
======================================================================
ERROR: test_cdouble (test_linalg.TestDet)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib64/python2.6/site-packages/numpy/linalg/tests/test_linalg.py",
line 44, in test_cdouble
self.do(a, b)
File "/usr/lib64/python2.6/site-packages/numpy/linalg/tests/test_linalg.py",
line 129, in do
d = linalg.det(a)
File "/usr/lib64/python2.6/site-packages/numpy/linalg/linalg.py",
line 1503, in det
raise TypeError, "Illegal input to Fortran routine"
TypeError: Illegal input to Fortran routine
So I can only offer a general advice, that I learned while fixing
release critical bugs in NumPy:
I would look into the source file numpy/linalg/linalg.py, line 1503
and start debugging
to figure out why the TypeError is raised. Which exact numpy do you use?
In the latest master, the line numbers are different and the det()
routine seems to be reworked. But in general,
you can see there a code like this:
results = lapack_routine(n, n, a, n, pivots, 0)
info = results['info']
if (info < 0):
raise TypeError("Illegal input to Fortran routine")
so that typically means that some wrong argument are being passed to
the Lapack routine. Try to print the "info" variable and then lookup
the Lapack documentation, it should say more (e.g. which exact
argument is wrong). Then you can go from there, e.g. I would put some
debug print statements into the code which gets called in
lapack_routine(), i.e. is it lapack_lite from NumPy, or some other
Lapack implementation? And so on.
Ondrej
More information about the NumPy-Discussion
mailing list