Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reset_device() and run() results in 'Only a single run statement is supported' #76

Closed
JustasB opened this issue Oct 10, 2018 · 2 comments

Comments

@JustasB
Copy link
Contributor

JustasB commented Oct 10, 2018

In Multiple Runs section in documentation it states that:

code can be run repeatedly “in multiple runs” that are completely independent. This just needs a reset_device command issued after the run(runtime) command

However, I get a the 'Only a single run statement is supported' error when I try to run() after device_reset()

Smallest code to reproduce the error:

from brian2 import *                   
import brian2genn   
set_device('genn')
run(1*second)

from brian2.devices import reset_device
reset_device('genn')

run(1*second) # <- results in above error
@mstimberg
Copy link
Member

Hi,
thanks, that's indeed incorrect/outdated in the documentation. The correct way is to use device.reinit() and device.activate() as described for the C++ standalone mode in Brian2 : https://brian2.readthedocs.io/en/stable/user/computation.html#multiple-builds

I.e., the following should work for Brian2GeNN as well:

from brian2 import *
import brian2genn
set_device('genn')
run(1*second)

device.reinit()
device.activate()

run(1*second)

@JustasB
Copy link
Contributor Author

JustasB commented Oct 11, 2018

@mstimberg Thank you, it's working. Also, thank you for updating the docs.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants