[Numpy-discussion] [OT] Starving CPUs article featured in IEEE's ComputingNow portal

Anne Archibald peridot.faceted@gmail....
Mon Mar 22 14:58:42 CDT 2010


On 22 March 2010 14:42, Pauli Virtanen <pav@iki.fi> wrote:
> la, 2010-03-20 kello 17:36 -0400, Anne Archibald kirjoitti:
>> I was in on that discussion. My recollection of the conclusion was
>> that on the one hand they're useful, carefully applied, while on the
>> other hand they're very difficult to reliably detect (since you don't
>> want to forbid operations on non-overlapping slices of the same
>> array).
>
> I think one alternative brought up was
>
>        copy if unsure whether the slices overlap
>
> which would make
>
>        A[whatever] = A[whatever2]
>
> be always identical in functionality to
>
>        A[whatever] = A[whatever2].copy()
>
> which is how things should work. This would permit optimizing simple
> cases (at least 1D), and avoids running into NP-completeness (for numpy,
> the exponential growth is however limited by NPY_MAXDIMS which is 64,
> IIRC).

It can produce surprise copies, but I could certainly live with this.
Or maybe a slight modification: "always produces values equivalent to
using a copy", to allow handling the common A[:-1]=A[1:] without a
copy. Of course, we'd have to wait for someone to implement it...

> This would be a change in semantics, but in a very obscure corner that
> hopefully nobody relies on.

It would certainly be nice to replace unspecified behaviour by
specified behaviour if it can be done with minimal cost. And I think
it could be, with some careful programming.

Anne


More information about the NumPy-Discussion mailing list