So my gap junction, inhibitory synapse coupled network (200 cells) runs pretty slowly. I tried various variable step methods; but they all ran considerably slower. And the local step method doesn't run at all. And it's not a very noisy network; most of the time, the cells have only a subtly fluctuating membrane potential
What's going on here?
Variable Steps and Integration methods
Moderator: wwlytton

 Posts: 86
 Joined: Thu May 22, 2008 11:54 pm
 Location: Australian National University

 Site Admin
 Posts: 5702
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: Variable Steps and Integration methods
Models of individual cells that are singly connected (may be branched, but have no closed loops), or networks of such cells that are connected by events delivered by NetCons, are represented by a family of equations whose system matrix is tridiagonal. That is, all elements of the matrix are 0 except for the main diagonal and the diagonal immediately above and below it. The computational cost of solving such a system scales with the number of equations (number of compartments in the model).
Closed loops, whether they result from peculiar cellular architectures or gap junctions, introduce offdiagonal nonzero terms that change the system matrix from tridiagonal to sparse. Sparse matrix solvers impose a computational burden that scales with the square of the number of compartments. A model with 100 compartments that involves gap junctions might take 100 times longer to simulate than a model with 100 compartments but no gap junctions.
Closed loops, whether they result from peculiar cellular architectures or gap junctions, introduce offdiagonal nonzero terms that change the system matrix from tridiagonal to sparse. Sparse matrix solvers impose a computational burden that scales with the square of the number of compartments. A model with 100 compartments that involves gap junctions might take 100 times longer to simulate than a model with 100 compartments but no gap junctions.

 Posts: 86
 Joined: Thu May 22, 2008 11:54 pm
 Location: Australian National University
Re: Variable Steps and Integration methods
Well I suppose that makes sense (well has much as anything which contains the phrase "the system matrix is tridiagonal" can make sense to a humble pharmacologist). But It doesn't seem to make sense that variable timestep integrators should run SLOWER.

 Site Admin
 Posts: 5702
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: Variable Steps and Integration methods
Local time step can only work in a network if communication between cells is by events. With local time step integration, each cell has its own time, which is identical across all compartments of that cell. The fact of current exchange between adjacent compartments requires the voltage in every compartment to be at exactly the same time as its neighborsafter all, the current through the axial resistances that separate adjacent compartments is governed by Ohm's law, and Ohm's law requires knowing the potentials at both ends of a resistor at the same time.local step method doesn't run at all
And that's why, if two cells are connected by a gap junction, then they are forced to march at the same pace. So in a network with cells connected by gap junctions, time must be the same across all cells, which means you can only use fixed dt or global variable dt.
Adaptive integration is guaranteed to do only one thing: meet a local error criterion at each advance. A single advance with adaptive integration is about 3x more costly than a single advance with fixed dt. Total run time is shorter only if the integrator can take longer time steps without violating the error criterionit has to take enough of these steps, and they have to be big enough, to make up for the cost of all steps over the entire simulation. So whether you get a net speedup or not remains an empirical question. In any particular case with which I am not already familiar, I would hesitate to bet my lunch money; it's probably safer to play the horses.It doesn't seem to make sense that variable timestep integrators should run SLOWER.