Performance Improvement - Need help
- To: mathgroup at smc.vnet.net
- Subject: [mg62256] Performance Improvement - Need help
- From: Lee Newman <leenewm at umich.edu>
- Date: Thu, 17 Nov 2005 17:03:50 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Dear Group,
I am working with computational model that has a main loop which
executes about 10^6 to 10^7 times over the course of a simulation --
taking about 30 hrs. The bottleneck function (below) includes and outer
product and some matrix algebra. I have optimized it to the best of my
knowledge, but would desperately like to know if any further optimization
might be possible (including calling external functions in C or other
language). Any suggestions would be greatly appreciated.
FUNCTION ---------------------------------------------------------
UpdateSynapses = Compile[{{matrix, _Real, 2}, {vector1, _Real, 1},
{vector2,_Real, 1}, {thresh1, _Real}, {thresh2, _Real}, {C1, _Real},
{C2, _Real}, {maxval, _Real}},
Module[{coactivation},
coactivation = Outer[Times,
FloorZero[vector2-thresh2], FloorZero[vector1- thresh1]];
C2* maxval*coactivation + (1 - C2* coactivation - C1)*matrix
] (* end module *)
, {{FloorZero[__], _Real, 1}} ];
Notes:
(1) vector1 is 1x100; vector2 is 1x1500; matrix is 100x100; matrix2 is
100x1500; all vectors/matrices are comprised of reals (range 0 to 1)
and are packed.
(2) FloorZero=Compile[{{list, _Real, 1}}, UnitStep[list] * list].
Eliminating this
function does not significantly affect performance.
(2) run time ~ 30hrs for 10^7 iterations (Pentium 4, 2.8GHz, 1GB RAM)
Regards,
Lee Newman
- Follow-Ups:
- Re: Performance Improvement - Need help
- From: "Carl K. Woll" <carlw@wolfram.com>
- Re: Performance Improvement - Need help