[SciPy-user] odeint -- segmentation fault
Giovanni Samaey
Giovanni.Samaey at cs.kuleuven.ac.be
Mon Aug 30 14:27:47 CDT 2004
Dear scipy users and developers,
I have the following problem with odeint:
Suppose I would call odeint as follows
y=odeint(dydt,y,t,....),
where dydt is a complicated function that also calls odeint.
So dydt is written as
def dydt(y,t):
<blabla>
intermed=odeint(rhs,y0,t,...)
<blabla>
rhs is written in C and wrapped through SWIG
In my case, I get segmentation faults doing this.
Unfortunately, I was not able to cook up an artificial example that is
simple, and behaves like this. What I can tell is that,
1) if I let dydt return a zero array (or any "direct" computation of the
derivative), then the program works, while if dydt uses odeint, it
crashes.
2) The return value of odeint does not have to be *used* for the crash
to happen: e.g. one can use the complicated routine inside dydt, but
still return zeros, and the crash would take place.
3) Using the complicated routine inside a loop that performs e.g.
forward Euler, gives no problem at all.
The crash really occurs when the value of dydt is passed into odeint.
(This was tested by stepping with pdb.)
So a segmentation fault occurs when odeint accesses the result of
calling dydt if that function also uses odeint in a complicated way.
Maybe the fact that inside dydt, odeint is calling a C routine for its
time derivative, has something to do with it?
Since I do not have access to odeint's code, I cannot tell what is going
on, nor how to solve this...
How could this problem be solved effectively?
Best,
Giovanni
--
Giovanni Samaey http://www.cs.kuleuven.ac.be/~giovanni/
Katholieke Universiteit Leuven email: giovanni at cs.kuleuven.ac.be
Departement Computerwetenschappen phone: +32-16-327081
Celestijnenlaan 200A, B-3001 Heverlee, Belgium fax: +32-16-327996
Office: A04.36
More information about the SciPy-user
mailing list