<div class="gmail_quote">On Wed, Dec 22, 2010 at 11:16 AM, Francesc Alted <span dir="ltr"><<a href="mailto:faltet@pytables.org">faltet@pytables.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
A Wednesday 22 December 2010 19:52:45 Mark Wiebe escrigué:<br>
<div class="im">> On Wed, Dec 22, 2010 at 10:41 AM, Francesc Alted<br>
<<a href="mailto:faltet@pytables.org">faltet@pytables.org</a>>wrote:<br>
> > NumPy version 2.0.0.dev-147f817<br>
><br>
> There's your problem, it looks like the PYTHONPATH isn't seeing your<br>
> new build for some reason.  That build is off of this commit in the<br>
> NumPy master branch:<br>
><br>
> <a href="https://github.com/numpy/numpy/commit/147f817eefd5efa56fa26b03953a51d" target="_blank">https://github.com/numpy/numpy/commit/147f817eefd5efa56fa26b03953a51d</a><br>
> 533cc27ec<br>
<br>
</div>Uh, I think I'm a bit lost here.  I've cloned this repo:<br>
<br>
$ git clone git://<a href="http://github.com/m-paradox/numpy.git" target="_blank">github.com/m-paradox/numpy.git</a><br>
<br>
Is that wrong?<br></blockquote><div><br></div><div>That's right, it was my mistake to assume that the page for a branch on github would give you that branch.  You need the 'new_iterator' branch, so after that clone, you should do this:</div>
<div><br></div><div>$ git checkout origin/new_iterator</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">
> > Ah, okay.  However, Numexpr is not meant to accelerate calculations<br>
> > with small operands.  I suppose that this is where your new<br>
> > iterator makes more sense: accelerating operations where some of<br>
> > the operands are small (i.e. fit in cache) and have to be<br>
> > broadcasted to match the dimensionality of the others.<br>
><br>
> It's not about small operands, but small chunks of the operands at a<br>
> time, with temporary arrays for intermediate calculations.  It's the<br>
> small chunks + temporaries which must fit in cache to get the<br>
> benefit, not the whole array.<br>
<br>
</div>But you need to transport those small chunks from main memory to cache<br>
before you can start doing the computation for this piece, right?  This<br>
is what I'm saying that the bottleneck for evaluating arbitrary<br>
expressions (like "3*a+b-(a/c)", i.e. not including transcendental<br>
functions, nor broadcasting) is memory bandwidth (and more in particular<br>
RAM bandwidth).<br></blockquote><div><br></div><div>In the example expression, I believe the evaluation would go something like this.  Assuming the memory allocator keeps giving back the same locations to 'luf', all temporary variables will already be in cache after the first chunk.</div>
<div><br></div><div>temp1 = 3 * a             # a is read from main memory</div><div>temp2 = temp1 + b     # b is read from main memory</div><div>temp3 = a / c             # a is already in cache, c is read from main memory</div>
<div>result = temp2 + temp3 # result is written to data from main memory</div><div><br></div><div>So there are 4 reads and writes to chunks from outside of the cache, but 12 total reads and writes to chunks, so speeding up the parts already in cache would appear to be beneficial.  The benefit will get better with more complicated expressions.  I think as long as the operation is slower than a memcpy, the RAM bandwidth isn't the main bottleneck to be concerned with, but instead produces an upper bound on performance.  I'm not sure how to precisely measure that overhead, though.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
> The numexpr front page explains this<br>
> fairly well in the section "Why It Works":<br>
><br>
> <a href="http://code.google.com/p/numexpr/#Why_It_Works" target="_blank">http://code.google.com/p/numexpr/#Why_It_Works</a><br>
<br>
</div>I know.  I wrote that part (based on the notes by David Cooke, the<br>
original author ;-)<br></blockquote><div><br></div><div>Cool :)</div><div><br></div><div>-Mark </div></div>