choderalab / bayesian-itc

Python tools for the analysis and modeling of isothermal titration calorimetry (ITC) experiments.
GNU General Public License v3.0
5 stars 10 forks source link

Seriously improved performance of CompetitiveBindingModel. #50

Closed bas-rustenburg closed 9 years ago

bas-rustenburg commented 9 years ago

137.756563 steps per minute now, instead of 2.5 steps per minute.

bas-rustenburg commented 9 years ago

Latest data

Thu Feb 19 17:05:57 2015    workdir/optimized.profile

         133769083 function calls (133076201 primitive calls) in 252.724 seconds

   Ordered by: internal time
   List reduced from 5146 to 15 due to restriction <15>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
  7393291   60.660    0.000   85.155    0.000 bitc/models.py:613(ode)
 13772067   31.464    0.000   31.464    0.000 {method 'reduce' of 'numpy.ufunc' objects}
  3188240   26.022    0.000   47.652    0.000 bitc/models.py:617(odegrad)
  1594035   21.566    0.000  213.617    0.000 /home/bas/anaconda/lib/python2.7/site-packages/scipy/optimize/minpack.py:151(_root_hybr)
  1594034   15.419    0.000  101.135    0.000 {scipy.optimize._minpack._hybrj}
   531345   11.233    0.000  234.314    0.000 bitc/models.py:517(equilibrium_concentrations)
  3188070   10.179    0.000   79.485    0.000 /home/bas/anaconda/lib/python2.7/site-packages/scipy/optimize/minpack.py:18(_check_func)
    18459    8.032    0.000  242.680    0.013 bitc/models.py:634(expected_injection_heats)
  3188073    6.679    0.000   13.173    0.000 /home/bas/anaconda/lib/python2.7/site-packages/numpy/core/shape_base.py:8(atleast_1d)
  1594035    6.585    0.000  220.202    0.000 /home/bas/anaconda/lib/python2.7/site-packages/scipy/optimize/minpack.py:41(fsolve)
 13769768    5.670    0.000   42.422    0.000 {method 'sum' of 'numpy.ndarray' objects}
 13769768    5.291    0.000   36.752    0.000 /home/bas/anaconda/lib/python2.7/site-packages/numpy/core/_methods.py:31(_sum)
4801414/4801381    4.358    0.000    4.358    0.000 {numpy.core.multiarray.array}
  3188069    3.477    0.000    7.277    0.000 /home/bas/anaconda/lib/python2.7/site-packages/numpy/core/numerictypes.py:736(issubdtype)
  3848904    3.119    0.000    3.119    0.000 {numpy.core.multiarray.zeros}

I will try numexpr again.

bas-rustenburg commented 9 years ago

@pgrinaway: numexpr made things twice as slow actually.. will have to think of something a little more involved...

bas-rustenburg commented 9 years ago

Might give this a try... http://hplgit.github.io/teamods/cyode/cyode-sphinx/main_cyode.html

jchodera commented 9 years ago

137.756563 steps per minute now, instead of 2.5 steps per minute.

Awesome!

bas-rustenburg commented 9 years ago

Haven't had the chance to look at the ODE performance yet. Merging this since it will already be useful on it's own.