One more thing, for the link:
http://www.huyng.com/posts/faster-numpy-dot-product/
Note that this guy has not gone to the numpy mailing list. Often
there is a hidden reason for this, and one must be always wary. It is
likely that he hasn't used any ideas from
http://wiki.scipy.org/PerformanceTips, and is hence seeing such a
difference. If the guy had any courage, he would be communicating on
the numpy/scipy mailing lists for how these packages can be improved.
The fact that he hasn't is a big worry. I have seen this many times
before as I have been optimising relax over the last 10 years, and I
now only use ideas posted to official lists where there is a response
from the core developers confirming that one way is faster than
another. There is a tonne of speeding up information on the internet
that turns out to be rubbish, or there is a better 'standard' way of
doing it.
Regards,
Edward
On 15 June 2014 14:59, Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx> wrote:
Hi Ed.
At the wiki, I added some references for faster dot:
http://wiki.nmr-relax.com/Numpy_linalg
http://www.huyng.com/posts/faster-numpy-dot-product/
from scipy.linalg import fblas as FB
X = FB.dgemm(alpha=1., a=A, b=B, trans_b=True)
2014-06-15 10:30 GMT+02:00 Edward d Auvergne
<NO-REPLY.INVALID-ADDRESS@xxxxxxx>:
Follow-up Comment #199, task #7807 (project relax):
The following python script, to be placed in the base relax directory, and
the
corresponding log file, demonstrate the speed differences of various dot
product operations. This is to help make the numeric dispersion models
faster.
The script tests 3 different operations:
1) Sequential dot products (a = dot(b, c); a = dot(a, d)).
2) Chained dot products (a = b.dot(c).dot(d)).
3) Using the out argument to avoid memory allocation and garbage
collection
(dot(b, c, a); dot(a, d, a)).
The timings are:
1) 3.71 s.
2) 4.05 s.
3) 1.99 s.
As option 1) is the implementation used in the relax trunk, clearly option
3
has the potential to significantly speed up the models.
(file #21021, file #21022)
_______________________________________________________
Additional Item Attachment:
File name: dot_speed.py Size:2 KB
File name: dot_speed.log Size:0 KB
_______________________________________________________
Reply to this item at:
<http://gna.org/task/?7807>
_______________________________________________
Message sent via/by Gna!
http://gna.org/