quantum chemistry sounds complicated. that means any advice i can give you makes me a genius! just kidding. i've heard through the grapevine that reentrant functions mess up profilers.<br><br><div class="gmail_quote">On Fri, May 1, 2009 at 2:54 PM, Rick Muller <span dir="ltr"><<a href="mailto:rpmuller@gmail.com">rpmuller@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I'm the main programmer for the PyQuante package, a quantum chemistry<br>
package in Python. I'm trying to speed up one of my rate determining<br>
steps. Essentially, I have to decide between two algorithms:<br>
<br>
1. Packed means that I compute N**4/8 integrals, and then do a bunch<br>
of indexing operations to unpack;<br>
2. Unpacked means that I compute all N**4 integrals, but don't have to<br>
do any indexing.<br>
<br>
Raw timing the two options show that packed is clearly faster (12.5<br>
sec vs 20.6 sec). However, the profilings show very different results.<br>
I have the results below. Clearly I'm going to use the packed scheme.<br>
My question to the mailing list is what am I doing wrong with my<br>
profiling that it shows such poor predictions? I rely on profiling a<br>
great deal to tune my algorithms, and I'm used to seeing differences,<br>
but nothing close to this magnitude.<br>
<br>
Here is packed:<br>
ncalls tottime percall cumtime percall filename:lineno(function)<br>
11021725 84.493 0.000 84.493 0.000 :0(ijkl2intindex)<br>
18 62.064 3.448 119.865 6.659 Ints.py:150(getK)<br>
18 32.063 1.781 61.186 3.399 Ints.py:131(getJ)<br>
52975 9.404 0.000 19.658 0.000 CGBF.py:189(coulomb)<br>
313643 2.542 0.000 2.542 0.000 :0(range)<br>
52975 2.260 0.000 2.260 0.000 :0(contr_coulomb)<br>
218200 1.377 0.000 1.377 0.000 CGBF.py:51(norm)<br>
211900 1.337 0.000 1.337 0.000 CGBF.py:53(powers)<br>
211900 1.336 0.000 1.336 0.000 CGBF.py:56(exps)<br>
211900 1.329 0.000 1.329 0.000 CGBF.py:58(pnorms)<br>
211900 1.328 0.000 1.328 0.000 CGBF.py:52(origin)<br>
211900 1.328 0.000 1.328 0.000 CGBF.py:57(coefs)<br>
1 0.979 0.979 21.108 21.108 Ints.py:112(get2ints)<br>
11790 0.197 0.000 0.197 0.000 :0(dot)<br>
11828 0.166 0.000 0.166 0.000 :0(zeros)<br>
<br>
Here is unpacked:<br>
ncalls tottime percall cumtime percall filename:lineno(function)<br>
18 16.158 0.898 17.544 0.975 Ints.py:167(getK)<br>
52975 9.301 0.000 19.515 0.000 CGBF.py:189(coulomb)<br>
18 4.584 0.255 5.904 0.328 Ints.py:146(getJ)<br>
313643 2.630 0.000 2.630 0.000 :0(range)<br>
52975 2.254 0.000 2.254 0.000 :0(contr_coulomb)<br>
218200 1.375 0.000 1.375 0.000 CGBF.py:51(norm)<br>
211900 1.330 0.000 1.330 0.000 CGBF.py:58(pnorms)<br>
211900 1.325 0.000 1.325 0.000 CGBF.py:53(powers)<br>
211900 1.325 0.000 1.325 0.000 CGBF.py:57(coefs)<br>
211900 1.323 0.000 1.323 0.000 CGBF.py:56(exps)<br>
211900 1.321 0.000 1.321 0.000 CGBF.py:52(origin)<br>
1 0.782 0.782 20.373 20.373 Ints.py:114(get2ints)<br>
1875 0.156 0.000 0.384 0.000 CGBF.py:106(nuclear)<br>
11790 0.147 0.000 0.147 0.000 :0(dot)<br>
17856 0.112 0.000 0.112 0.000 PGBF.py:63(coef)<br>
<font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br>