[SciPy-user] about weave performance evaluation
Dan Christensen
jdc at uwo.ca
Tue Oct 25 11:43:42 EDT 2005
Pau Gargallo <pau.gargallo at gmail.com> writes:
> I'm not completely sure but it seems to me that there is an error in
> the performance evaluation of pure python, scipy, weave, fortran and
> C++ implementations of the laplace equation solver in
> http://www.scipy.org/documentation/weave/weaveperformance.html
>
> the code used to solve the laplace equation in pure python is:
>
...
>
> my guess is that this implementation overwrites u while running the
> loop. In other terms, when computing the term u[i,j], the terms
> u[i-1,j] and u[i,j-1] are used, and these terms where already modified
> in previous iterations.
> ... comparisons in the execution times would make no sense.
This is discussed at the URL above. Here's what they say:
The expression will use temporaries. Hence, during one iteration, the
computed values at an already computed location will not be used
during the iteration. For instance, in the original for loop, once
the value of u[1,1] is computed, the next value for u[1,2] will use
the newly computed u[1,1] and not the old one. However, since the
numeric expression uses temporaries internally, only the old value of
u[1,1] will be used. This is not a serious issue in this case because
it is known that even when this happens the algorithm will converge
(but in twice as much time, which reduces the benefit by a factor of
2, which still leaves us with a 25 fold increase).
Dan
More information about the SciPy-User
mailing list