brian2genn
brian2genn copied to clipboard
Error: Only a single run statement is supported for the genn device.
Hi,
I just ran the example code like below:
from brian2 import *
import brian2genn
set_device('genn', directory='simple_example')
N = 10000
tau = 10*ms
Iin = 0.11/ms
eqs = '''
dV/dt = -V/tau + Iin : 1
'''
G = NeuronGroup(N, eqs, threshold='V>1', reset='V=0', refractory=5 * ms)
run(10*ms)
The error is: Only a single run statement is supported for the genn device.
So what is the problem? Thanks.
That is very strange, the same example runs just fine on my install/setup. Can you post the log file?
Are you maybe running more than one simulation in the same process (ipython session, jupyter notebook, ...)? If that's the case, you'll have to use
device.reinit()
device.activate()
during the runs (see the Brian2 documentation).
That is very strange, the same example runs just fine on my install/setup. Can you post the log file?
runfile('//file/Usersc$/cji39/Home/Downloads/brian2genn-1.3.1/examples/simple_example.py', wdir='//file/Usersc$/cji39/Home/Downloads/brian2genn-1.3.1/examples') Traceback (most recent call last):
File "\file\Usersc$\cji39\Home\Downloads\brian2genn-1.3.1\examples\simple_example.py", line 14, in
File "D:\Anaconda\lib\site-packages\brian2\units\fundamentalunits.py", line 2392, in new_f result = f(*args, **kwds)
File "D:\Anaconda\lib\site-packages\brian2\core\magic.py", line 374, in run namespace=namespace, profile=profile, level=2+level)
File "D:\Anaconda\lib\site-packages\brian2\core\magic.py", line 232, in run namespace=namespace, profile=profile, level=level+1)
File "D:\Anaconda\lib\site-packages\brian2\core\base.py", line 278, in device_override_decorated_function return getattr(curdev, name)(*args, **kwds)
File "D:\Anaconda\lib\site-packages\brian2genn\device.py", line 1608, in network_run 'Only a single run statement is supported for the genn device.')
NotImplementedError: Only a single run statement is supported for the genn device.
Are you maybe running more than one simulation in the same process (ipython session, jupyter notebook, ...)? If that's the case, you'll have to use device.reinit() device.activate() during the runs (see the Brian2 documentation).
When I used these two, it showed another problem like below:
runfile('//file/Usersc$/cji39/Home/Downloads/brian2genn-1.3.1/examples/simple_example.py', wdir='//file/Usersc$/cji39/Home/Downloads/brian2genn-1.3.1/examples') running brian code generation ... building genn executable ... _cython_magic_c2fa97ad808a39961664d70a1ae4bfcd.cpp D:\Anaconda\include\pyconfig.h(59): fatal error C1083: 无法打开包括文件: “io.h”: No such file or directory cl: 命令行 warning D9025 :正在重写“/W3”(用“/w”) Traceback (most recent call last):
File "D:\Anaconda\lib\site-packages\brian2genn\device.py", line 782, in build self.compile_source(debug, directory, use_GPU)
File "D:\Anaconda\lib\site-packages\brian2genn\device.py", line 994, in compile_source check_call(cmd.format(genn_path=genn_path), cwd=directory, env=env)
File "D:\Anaconda\lib\subprocess.py", line 363, in check_call raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '"C:\Users\cji39\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\vcvarsall.bat" x86_amd64 && D:\genn\lib\bin\genn-buildmodel.bat magicnetwork_model.cpp && nmake /f WINmakefile clean && nmake /f WINmakefile' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "\file\Usersc$\cji39\Home\Downloads\brian2genn-1.3.1\examples\simple_example.py", line 15, in
File "D:\Anaconda\lib\site-packages\brian2\units\fundamentalunits.py", line 2392, in new_f result = f(*args, **kwds)
File "D:\Anaconda\lib\site-packages\brian2\core\magic.py", line 374, in run namespace=namespace, profile=profile, level=2+level)
File "D:\Anaconda\lib\site-packages\brian2\core\magic.py", line 232, in run namespace=namespace, profile=profile, level=level+1)
File "D:\Anaconda\lib\site-packages\brian2\core\base.py", line 278, in device_override_decorated_function return getattr(curdev, name)(*args, **kwds)
File "D:\Anaconda\lib\site-packages\brian2genn\device.py", line 1634, in network_run level=level + 1)
File "D:\Anaconda\lib\site-packages\brian2\devices\cpp_standalone\device.py", line 1514, in network_run self.build(direct_call=False, **self.build_options)
File "D:\Anaconda\lib\site-packages\brian2genn\device.py", line 788, in build returncode=ex.returncode)
RuntimeError: Project compilation failed (Command "C:\Users\cji39\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\vcvarsall.bat" x86_amd64 && D:\genn\lib\bin\genn-buildmodel.bat magicnetwork_model.cpp && nmake /f WINmakefile clean && nmake /f WINmakefile failed with error code 1). See the output above (if any) for more details.
This is getting confusing. How are you running things? The easiest way to run things correctly is to make sure that you run each script in its own process. If you are running your script from an IDE like PyCharm or Spyder make sure to not select "Run with Python console" (PyCharm), or select "Run in a dedicated console" (Spyder). The two lines I posted work as well, you might have put them in the wrong place (indicated by a message about Cython compilation which should not be happening).
This is getting confusing. How are you running things? The easiest way to run things correctly is to make sure that you run each script in its own process. If you are running your script from an IDE like PyCharm or Spyder make sure to not select "Run with Python console" (PyCharm), or select "Run in a dedicated console" (Spyder). The two lines I posted work as well, you might have put them in the wrong place (indicated by a message about Cython compilation which should not be happening).
I ran it in Spyder and did not select those items you mentioned. I add these two lines like below:
from brian2 import * import brian2genn
set_device('genn') prefs.devices.genn.path = 'D:\genn' device.reinit() device.activate() N = 10000 tau = 10*ms Iin = 0.11/ms eqs = ''' dV/dt = -V/tau + Iin : 1 ''' G = NeuronGroup(N, eqs, threshold='V>1', reset='V=0', refractory=5 * ms)
run(10*ms)
I got the error:
RuntimeError: Project compilation failed (Command "C:\Users\cji39\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\vcvarsall.bat" x86_amd64 && D:\genn\lib\bin\genn-buildmodel.bat magicnetwork_model.cpp && nmake /f WINmakefile clean && nmake /f WINmakefile failed with error code 1). See the output above (if any) for more details.
I ran it in Spyder and did not select those items you mentioned
To follow my advice, you should select "run in a dedicated console" in Spyder. Sorry, if that wasn't clear.
If you are still getting a compilation error, then this is something unrelated to your initial issue. In that case we'd need the full output and/or the log files.