Open felix11h opened 5 years ago
Hi Felix, thanks for the report, I can reproduce the issue with your example script. It seems to be specific to C++ standalone mode, I could imagine that there is some conversion of time to integer time steps at some point that goes over 32bit bounds, or something along these lines. I'll have a closer look soon.
Thanks for the fast reply! I'm very curious to learn what's happening here. I wasn't successful in reproducing the behaviour in a minimal example network, so I've cut my current simulation down to what I hope is a manageable size to track down the issue.
The initial idea was to set the dt
of the run_regularly()
to the duration of the simulation in order to do something once at the beginning of the simulation (activate some units). I was able to do this directly now without using a model equation. I still wanted to report the issue though as it might be important!
I looked into this a bit, and I no longer think it has to do with 32bit integers. It is rather about some rounding tests where we consider things to fall into the same time step if they differ by less than a 10000th of dt – in your example, the first run time is less than that (for the dt
of your run_regularly
) and I think this messes things up. I also noticed that this is not only a standalone problem, with runtime targets you can get similar issues. I'll need to look into this more thoroughly, but I think I have a general idea what the problem is.
As mentioned in #1057 , removing the run_regularly
statement but simply increasing the simulation time to T2 = 500000*second
produces similar behaviour:
Starting simulation at t=0 s for duration 1 s 1 s (100%) simulated in 0.322394 s Starting simulation at t=1 s for duration 500000 s 500000 s (100%) simulated in 0 s Starting simulation at t=500001 s for duration 1 s 1 s (100%) simulated in 0 s
This issue does not seem to be fixed by https://github.com/brian-team/brian2/commit/a59121462dafabf59aefbb74a4cc0cea966c6499.
I'm running into an issue with using run_regularly() in standalone mode that I believe could possibly be a bug.
Below is the network that reproduces the issue. The simulation segment 'T2', although very long, is completely skipped. For example I get an output of
Two things fix the problem:
Brian2 version '2.2.1'. Can anyone reproduce this? Thanks!