Author: tlinnet Date: Sat Jun 7 22:36:00 2014 New Revision: 23725 URL: http://svn.gna.org/viewcvs/relax?rev=23725&view=rev Log: Altered profiling script to report cumulative timings and save to temporary files. Task #7807 (https://gna.org/task/index.php?7807): Speed-up of dispersion models for Clustered analysis. This indeed shows that the efficiency has gone down: ----- Checked on MacBook Pro 2.4 GHz Intel Core i5 8 GB 1067 Mhz DDR3 RAM. Python Distribution -- Python 2.7.3 |EPD 7.3-2 (32-bit)| Timing for: 3 fields, [600. * 1E6, 800. * 1E6, 900. * 1E6] ('sfrq: ', 600000000.0, 'number of cpmg frq', 15) ('sfrq: ', 800000000.0, 'number of cpmg frq', 20) ('sfrq: ', 900000000.0, 'number of cpmg frq', 22) iterations of function call: 1000 Timed for simulating 1 or 100 clustered spins. For TRUNK 1 spin: ncalls tottime percall cumtime percall filename:lineno(function) 1 0.000 0.000 0.434 0.434 <string>:1(<module>) 1 0.001 0.001 0.434 0.434 pf:354(single) 1000 0.002 0.000 0.432 0.000 pf:340(calc) 1000 0.007 0.000 0.429 0.000 relax_disp.py:908(func_CR72_full) 1000 0.054 0.000 0.416 0.000 relax_disp.py:456(calc_CR72_chi2) 3000 0.256 0.000 0.300 0.000 cr72.py:100(r2eff_CR 100 spins: ncalls tottime percall cumtime percall filename:lineno(function) 1 0.000 0.000 42.035 42.035 <string>:1(<module>) 1 0.002 0.002 42.035 42.035 pf:378(cluster) 1000 0.004 0.000 41.957 0.042 pf:340(calc) 1000 0.011 0.000 41.953 0.042 relax_disp.py:908(func_CR72_full) 1000 5.378 0.005 41.928 0.042 relax_disp.py:456(calc_CR72_chi2) 300000 25.942 0.000 30.276 0.000 cr72.py:100(r2eff_CR72) 300000 4.362 0.000 5.903 0.000 chi2.py:32(chi2) TESTING 1 spin: ncalls tottime percall cumtime percall filename:lineno(function) 1 0.000 0.000 0.792 0.792 <string>:1(<module>) 1 0.001 0.001 0.792 0.792 pf:354(single) 1000 0.002 0.000 0.789 0.001 pf:340(calc) 1000 0.011 0.000 0.787 0.001 relax_disp.py:966(func_CR72_full) 1000 0.187 0.000 0.769 0.001 relax_disp.py:457(calc_CR72_chi2) 26013 0.290 0.000 0.290 0.000 {numpy.core.multiarray.array} 1000 0.147 0.000 0.198 0.000 cr72.py:101(r2eff_CR72) 2001 0.002 0.000 0.086 0.000 numeric.py:167(asarray) 3000 0.045 0.000 0.062 0.000 chi2.py:32(chi2) 100 spins: ncalls tottime percall cumtime percall filename:lineno(function) 1 0.000 0.000 46.821 46.821 <string>:1(<module>) 1 0.002 0.002 46.821 46.821 pf:378(cluster) 1000 0.004 0.000 46.744 0.047 pf:340(calc) 1000 0.017 0.000 46.740 0.047 relax_disp.py:966(func_CR72_full) 1000 15.422 0.015 46.708 0.047 relax_disp.py:457(calc_CR72_chi2) 1511904 23.475 0.000 23.475 0.000 {numpy.core.multiarray.array} 300000 4.175 0.000 5.668 0.000 chi2.py:32(chi2) 2001 0.004 0.000 4.804 0.002 numeric.py:167(asarray) 1000 0.010 0.000 2.438 0.002 fromnumeric.py:1774(amax) 1000 0.006 0.000 2.428 0.002 fromnumeric.py:32(_wrapit) 300000 0.353 0.000 1.493 0.000 fromnumeric.py:1379(sum) 1000 1.281 0.001 1.444 0.001 cr72.py:101(r2eff_CR72) Modified: branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_cr72.py Modified: branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_cr72.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_cr72.py?rev=23725&r1=23724&r2=23725&view=diff ============================================================================== --- branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_cr72.py (original) +++ branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_cr72.py Sat Jun 7 22:36:00 2014 @@ -27,6 +27,7 @@ from numpy import array, arange, asarray, int32, float64, ones, pi, zeros import pstats import sys +import tempfile # Add to system path, according to if len(sys.argv) == 1: @@ -49,28 +50,39 @@ # Alter setup. def main(): - s_filename = 'single' + # Calc for single. + s_filename = tempfile.NamedTemporaryFile(delete=False).name # Profile for a single spin. cProfile.run('single(iter=1000)', s_filename) - c_filename = 'cluster' + # Read all stats files into a single object + s_stats = pstats.Stats(s_filename) + + # Clean up filenames for the report + s_stats.strip_dirs() + + # Sort the statistics by the cumulative time spent in the function. cumulative, time, calls + s_stats.sort_stats('cumulative') + + # Print report for single. + s_stats.print_stats() + + # Calc for cluster. + c_filename = tempfile.NamedTemporaryFile(delete=False).name # Profile for a cluster of 100 spins. cProfile.run('cluster(iter=1000)', c_filename) # Read all stats files into a single object - s_stats = pstats.Stats(s_filename) c_stats = pstats.Stats(c_filename) #stats.add(c_filename) # Clean up filenames for the report - s_stats.strip_dirs() c_stats.strip_dirs() # Sort the statistics by the cumulative time spent in the function. cumulative, time, calls - s_stats.sort_stats('time') - c_stats.sort_stats('time') - - s_stats.print_stats() + c_stats.sort_stats('cumulative') + + # Print report for clustered. c_stats.print_stats()