You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I fail to simulate an LIF network with 2 neurons for a long duration run (1e6*second) in cpp_standalone mode. NO warning or error appears, and no data of spike trains is generated.
However, if I switch to a shorter run duration, like 1e5*second, the code works fine. And also, if I split the whole run duration into multiple pieces, such as replacing run(duration) with
for_inrange(10):
run(duration/10)
the code works fine. I'm wondering is there a maximum run duration value in Brian2 cpp_standalone mode, or is it due to the data type issue? Could you please give me some help?
I attach my code below, and the command to run the simulation case I mentioned is below.
Hi @NeoNeuron. Thanks for the report. This is an actual bug in Brian's C++ standalone mode. Internally, Brian uses integer time steps to avoid rounding issues, (i.e. instead of doing t += dt every time step, we do i += 1; t = i*dt). When setting this up in the beginning of a run, the code by mistake casts the time step to a 32bit integer, and it can therefore not handle more than ~2·10⁹ time steps (your 10⁶s correspond to 10¹⁰ time steps with the default dt). Basically it wraps over and the "end timestep" becomes smaller than the "start time step", and nothing gets simulated.
I did actually fix this issue a couple of years ago as part of #1057, but progress stalled on this PR (which was originally about an unrelated issue about using multiple clocks with dts of different orders of magnitude). I am going to pull out the fix into an independent PR that we can hopefully merge soon.
In case you can't wait and want to fix things manually, you can manually replace all mentions of int by int64_t in brian2/devices/cpp_standalone/brianlib/clocks.h.
Issue statement
I fail to simulate an LIF network with 2 neurons for a long duration run (1e6*second) in cpp_standalone mode. NO warning or error appears, and no data of spike trains is generated.
However, if I switch to a shorter run duration, like 1e5*second, the code works fine. And also, if I split the whole run duration into multiple pieces, such as replacing
run(duration)
withthe code works fine. I'm wondering is there a maximum run duration value in Brian2 cpp_standalone mode, or is it due to the data type issue? Could you please give me some help?
I attach my code below, and the command to run the simulation case I mentioned is below.
Versions
The text was updated successfully, but these errors were encountered: