tvb-root icon indicating copy to clipboard operation
tvb-root copied to clipboard

Amortized Heun history & coupling

Open maedoc opened this issue 3 years ago • 0 comments

Describe the new feature or enhancement

Large-scale connectivity currently only applies once per time step even in case of Heun or RK4 methods. This is done out of efficiency but is counterproductive because the resulting simulation is less efficient in critical regimes (i.e. much smaller dt is required to produce the correct result). Instead, in the case of Heun or RK4, the coupling scheme should be applied as many times as required for the scheme, i.e. 2x for Heun and 4x for RK4.

Describe your proposed implementation

Much of the cost in computing the time delays is due to random access into history buffer. For higher order schemes, we need at least two time points from history, so both can be fetched at once, such that the afferent coupling term is computed for all steps of the scheme at once in a vectorized fashion.

In terms of functions calls, the coupling call can be moved to the dfun, so that it happens in the same place as the local coupling, but the first call should cache the result for all steps of the scheme and return the relevant one.

maedoc avatar Apr 29 '22 07:04 maedoc