Pierre Schnizer wrote:
> Up to now I could not yet reproduce the odeiv memory leak.
Huh! That may be a useful clue; I can't *fail* to reproduce it. Here's
an example (minimally modified from the help(pygsl.odeiv) one) which shows
it for me:
--
from pygsl import odeiv
from numpy import zeros
mu = 10.0
def func(t, y, *w):
f = zeros(2) * 1.0
f[0] = y[1]
f[1] = -y[0] - mu * y[1] * (y[0] ** 2 -1);
return f
def jac(t, y):
dfdy = zeros(2,2)
dfdy[0, 0] = 0.0
dfdy[0, 1] = 1.0
dfdy[1, 0] = -2.0 * mu * y[0] * y[1] - 1.0
dfdy[1, 1] = -mu * (y[0]**2 - 1.0)
dfdt = zeros(2)
return dfdy, dfdt
dimension = 2
step = odeiv.step_gear1(dimension, func, jac)
control = odeiv.control_y_new(step, 1e-6, 1e-6)
evolve = odeiv.evolve(step, control, dimension)
h = 1
t = 0.0
t1 = 100.0
y = (1.0, 0.0)
while t<t1:
t, h, y = evolve.apply(t, t1, h, y)
y = y[0]
print t, y[0], y[1]
--
Here's an even simpler version:
--
from numpy import sin
import pygsl.odeiv as odeiv
def func(t, y, *args):
f = sin(y)
return f
dimension = 1
step = odeiv.step_gear1(dimension, func, None)
control = odeiv.control_y_new(step, 1e-6, 1e-6)
evolve = odeiv.evolve(step, control, dimension)
h = 1
t = 0.0
t1 = 1e6
y = [1.0]
while t<t1:
t, h, y = evolve.apply(t, t1, h, y)
y = y[0]
print t, y[0]
--
The evolve.apply leak occurs regardless of dimension, tolerance, and
integrator; presence or absence of Jacobian; direct use of numpy or not;
and so on.
I'm happy to provide any other configuration information that might help.
At the moment I'm using a wrapper script which kills my program after half
an hour (!) and restarts from the last checkpoint, which is kind of silly,
but still easier than rewriting. :)
Doug
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
pygsl-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pygsl-discuss