<div dir="ltr">Hmm... I am running scipy 0.19.1 (added that line to gist to be sure). When it loaded as aligned was the timing comparable to `Xnp`?<div><br></div><div>Just to be sure, I  created a new conda ipython environment and installed scipy -- version is 0.19.1. Flags are still the same.</div><div><br></div><div>The docs for scipy.io.loadmat don't seem to have an aligned option -- will ping Matthew Brett....</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 28, 2017 at 10:35 AM, CJ Carey <span dir="ltr"><<a href="mailto:perimosocordiae@gmail.com" target="_blank">perimosocordiae@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I tried reproducing the results from your gist using scipy 0.19.0, and I found that Xmat is aligned after loadmat:<div><br></div><div><div>In [3]: Xmat = sio.loadmat('data.mat')['X']</div><div><br></div><div>In [4]: Xmat.flags</div><div>Out[4]: </div><div>  C_CONTIGUOUS : False</div><div>  F_CONTIGUOUS : True</div><div>  OWNDATA : False</div><div>  WRITEABLE : True</div><div>  ALIGNED : True</div><div>  UPDATEIFCOPY : False</div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Mon, Aug 28, 2017 at 1:26 PM, Robert Kern <span dir="ltr"><<a href="mailto:robert.kern@gmail.com" target="_blank">robert.kern@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><span>On Mon, Aug 28, 2017 at 10:13 AM, Jonathan Taylor <<a href="mailto:jonathan.taylor@stanford.edu" target="_blank">jonathan.taylor@stanford.edu</a>> wrote:<br>><br>> Thanks for all the help.<br>><br>> That said, I'm not sure it is an issue of the strides. I can easily recreate the slowdown as in the above gist ( <a href="https://gist.github.com/da7b2ef6ef109511af06a9cebbfc8ed1" target="_blank">https://gist.github.com/da7b2e<wbr>f6ef109511af06a9cebbfc8ed1</a> ). Also, modifying the flags of a user-created ndarray so they agree with the loaded one is still noticably faster than using the array from `scipy.io.loadmat`<br><br></span>Ah yeah, if the data is aligned, then that might end up faster. Your optimized BLAS will be able to use certain CPU instructions that require aligned data. Setting the ALIGNED flag to false won't actually make the data unaligned; your BLAS checks the data itself, not the numpy flag.<span><br><br>> For my purposes, a copy is just fine, but I think this might be an issue that could be looked into. Perhaps I should file an issue on github?<br><br></span>It might be worth checking if scipy.io.loadmat() can be made to ensure that it always creates aligned arrays. There isn't anything to be done about .dot(), though.<br><br>--<br>Robert Kern</div>
<br></div></div><span class="">______________________________<wbr>_________________<br>
SciPy-Dev mailing list<br>
<a href="mailto:SciPy-Dev@python.org" target="_blank">SciPy-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scipy-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/scipy-dev</a><br>
<br></span></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
SciPy-Dev mailing list<br>
<a href="mailto:SciPy-Dev@python.org">SciPy-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scipy-dev" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/scipy-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Jonathan Taylor                          <br>Dept. of Statistics                      <br>Sequoia Hall, 137                          <br>390 Serra Mall<br>Stanford, CA 94305<br>Tel:   650.723.9230<br>Fax:   650.725.8977<br>Web: <a href="http://www-stat.stanford.edu/~jtaylo" target="_blank">http://www-stat.stanford.edu/~jtaylo</a></div>
</div>