Menu

Commit [r23723]  Maximize  Restore  History

Initial try to alter the target function calc_CR72_chi2.

This is the first test to restructure the arrays, to allow for higher dimensional computation.
All numpy arrays have to have same shape to allow to multiply together.
The dimensions should be [ei][si][mi][oi][di]. [Experiment][spins][spec. frq][offset][disp points].
This is complicated with number of disp point can change per spectrometer frequency.

Task #7807 (https://gna.org/task/index.php?7807): Speed-up of dispersion models for Clustered analysis.

This implementation brings a high overhead.
The first test shows no winning of time.
The creation of arrays takes all the time.

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)
3000 0.267 0.000 0.313 0.000 cr72.py:100(r2eff_CR72)
1000 0.056 0.000 0.434 0.000 relax_disp.py:456(calc_CR72_chi2)
3000 0.045 0.000 0.061 0.000 chi2.py:32(chi2)

100 spins:
ncalls tottime percall cumtime percall filename:lineno(function)
300000 26.315 0.000 30.771 0.000 cr72.py:100(r2eff_CR72)
1000 5.498 0.005 42.660 0.043 relax_disp.py:456(calc_CR72_chi2)
300000 4.438 0.000 6.021 0.000 chi2.py:32(chi2)

TESTING

1 spin:
ncalls tottime percall cumtime percall filename:lineno(function)
19013 0.278 0.000 0.278 0.000 {numpy.core.multiarray.array}
1000 0.191 0.000 0.777 0.001 relax_disp.py:457(calc_CR72_chi2)
1000 0.147 0.000 0.197 0.000 cr72.py:101(r2eff_CR72)
3000 0.044 0.000 0.061 0.000 chi2.py:32(chi2)

100 spins:
ncalls tottime percall cumtime percall filename:lineno(function)
1504904 25.215 0.000 25.215 0.000 {numpy.core.multiarray.array}
1000 17.261 0.017 51.180 0.051 relax_disp.py:457(calc_CR72_chi2)
300000 4.637 0.000 6.310 0.000 chi2.py:32(chi2)

tlinnet 2014-06-07

changed /branches/disp_spin_speed/target_functions/relax_disp.py
/branches/disp_spin_speed/target_functions/relax_disp.py Diff Switch to side-by-side view
Loading...
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.