[SciPy-dev] f2py and ATLAS crashing bug

Anne Archibald aarchiba@physics.mcgill...
Sun Nov 8 17:42:56 CST 2009


I am still trying to fix the bug where non-aligned matrices can cause
ATLAS to segfault, and I think I need to improve my understanding of
f2py somewhat.

First of all, I'll note that the bug appears in several routines (eig,
svd, qr, rq, hessenberg, and schur that I have found so far) but only
when the overwrite_a flag is passed in. So I tried to determine how
overwrite_a is used in these routines, and I am puzzled. The python
routines appear to pass it unmodified to the FORTRAN routines. The
.pyf files mention it in the python call signatures, but nowhere else;
from the f2py files it looks like it should be ignored. But clearly it
has some effect, since it allows crashes.

Second, if I copy the input arrays in python, the copies are aligned
and the problem goes away. So I was hoping that enforcing a copy in
f2py if the arrays were misaligned would solve the problem. But (for
example) in svd, the relevant array already has intent(copy), so it's
not clear how the bug is being triggered. (And adding align8 does not
cure it.) The array also has intent(in) but not intent(out), so f2py
may not be expecting the underlying gesdd to modify the array (which
it is presumably doing if overwrite_a has an effect).

There is still the draconian solution of raising an exception when
operating on misaligned arrays, but I'd like to find a better solution
for this problem.


More information about the Scipy-dev mailing list