<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 18, 2014 at 6:40 PM, Julian Taylor <span dir="ltr"><<a href="mailto:jtaylor.debian@googlemail.com" target="_blank">jtaylor.debian@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">< 1.9 lies about alignment it doesn't actually check for new arrays.<br></blockquote><div><br></div><div>When I do the following on 1.8.1 with win 32 bits:<br><br></div><div>x = np.zeros(12, "D")<br></div><div>print x.aligned.flags  == (x.__array_interface__["data"][0] % 16 == 0) # always true<br></div><div>print x.aligned.flags # always true<br></div><div><br>but on 1.9.1:<br><br><div>x = np.zeros(12, "D")<br></div>print x.aligned.flags == (x.__array_interface__["data"][0] % 16 == 0) # always true<br>print x.aligned.flags # not always true<br></div><div><br></div><div>I wonder why numpy 1.8.1 always returned 16 bytes aligned arrays in this case (unlikely to be a coincidence, as I try quite a few times with different sizes).<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
is the array aligned?<br>
<span class=""><br>
On 18.11.2014 19:37, David Cournapeau wrote:<br>
> Additional point: it seems to always return aligned data on 1.8.1 (same<br>
> platform/compiler/everything).<br>
><br>
> On Tue, Nov 18, 2014 at 6:35 PM, David Cournapeau <<a href="mailto:cournape@gmail.com">cournape@gmail.com</a><br>
</span><span class="">> <mailto:<a href="mailto:cournape@gmail.com">cournape@gmail.com</a>>> wrote:<br>
><br>
>     It is on windows 32 bits, but I would need to make this work for<br>
>     complex (pair of double) as well.<br>
><br>
>     Is this a bug (I  assumed array creation methods would always create<br>
>     aligned arrays for their type) ? Seems like quite a bit of code out<br>
>     there would assume this (scipy itself does for example).<br>
><br>
>     (the context is > 100 test failures on scipy 0.14.x on top of numpy<br>
>     1.9., because f2py intent(inout) fails on work arrays created by<br>
>     zeros, this is a windows-32 only failure).<br>
><br>
>     David<br>
><br>
>     On Tue, Nov 18, 2014 at 6:26 PM, Julian Taylor<br>
>     <<a href="mailto:jtaylor.debian@googlemail.com">jtaylor.debian@googlemail.com</a><br>
</span><span class="">>     <mailto:<a href="mailto:jtaylor.debian@googlemail.com">jtaylor.debian@googlemail.com</a>>> wrote:<br>
><br>
>         On 18.11.2014 19:20, David Cournapeau wrote:<br>
>         > Hi,<br>
>         ><br>
>         > I have not followed closely the changes that happen in 1.9.1,<br>
>         but was<br>
>         > surprised by the following:<br>
>         ><br>
>         > x = np.zeros(12, "d")<br>
>         > assert x.flags.aligned # fails<br>
>         ><br>
>         > This is running numpy 1.9.1 built on windows with VS 2008. Is it<br>
>         > expected that zeros may return a non-aligned array ?<br>
>         ><br>
><br>
>         what is the real alignment of the array? Are you on 32 bit or 64<br>
>         bit?<br>
>         What is the alignment of doubles in windows (linux its 4 byte on<br>
>         32 bit<br>
>         8 byte on 64 bit (% special compiler flags)?<br>
>         print x.__array_interface__["data"]<br>
><br>
>         there are problems with complex types but doubles should be<br>
>         aligned even<br>
>         on 32 bit.<br>
>         _______________________________________________<br>
>         NumPy-Discussion mailing list<br>
</span>>         <a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a> <mailto:<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a>><br>
>         <a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<div class=""><div class="h5">><br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> NumPy-Discussion mailing list<br>
> <a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
> <a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
><br>
<br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
</div></div></blockquote></div><br></div></div>