[SciPy-user] Performance Python with Weave article updated
Prabhu Ramachandran
prabhu at aero.iitm.ernet.in
Tue Sep 21 21:49:19 EDT 2004
>>>>> "PP" == Pearu Peterson <pearu at cens.ioc.ee> writes:
PP> I was a bit surprised on the bad performance in the fortran
PP> test case. So, I took a closer look into laplace.py and found
PP> there a bug in fortranTimeStep() method; the line
PP> u, err = flaplace.timestep(g.u, g.dx, g.dy)
PP> should read
PP> g.u, err = flaplace.timestep(g.u, g.dx, g.dy)
PP> With this corrected code the performace in fortran case
PP> increased two times:
Aha! Thanks! I noticed slower times but did not investigate
carefully because the code was unchanged from the last time. I also
upgraded to sarge and thought it was something to do with the newer
version of g77.
After you pointed out the error, I initially thought the reason for
the two fold improvement was a convergence related issue. However, I
recall that I had specifically tailored the test case so that all of
the methods do indeed run 100 iterations. So, it appears the cost is
in copying and converting the Numeric array from a C-contiguous one to
Fortran-contiguous one. With the old code, this had to be done on
each iteration, doubling the time. Has something changed in f2py in
this regard? When I put up the article the first time, the old
(buggy) code did perform well.
cheers,
prabhu
More information about the SciPy-User
mailing list