Closed ajitlimaye closed 5 years ago
In c:\genn\lib there is indeed a project named generate.vcxproj, and some code in it is apparently trying to find the project "C:\Microsoft.Cpp.default.props". This seems to be a value for a key in the registry - is my guess even close? If so, what is the name of the registry key? On a wild hunch, I defined an environment variable as follows:
os.environ['VCTargetsPath'] = 'C:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\V140'
With this, I get a different error - as follows:
INFO The following preferences have been changed for Brian2GeNN, reset them manually if you use a different device later in the same script: codegen.loop_invariant_optimisations, core.network.default_schedule [brian2.devices.genn]
running brian code generation ...
building genn executable ...
Microsoft (R) Build Engine version 4.7.3190.0
[Microsoft .NET Framework, version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 4/30/2019 6:46:32 PM.
Project "c:\genn\lib\generate.vcxproj" on node 1 (default targets).
Project "c:\genn\lib\generate.vcxproj" (1) is building "c:\genn\lib\lib_genn.vcxproj" (2) on node 1 (default targets).
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Current.targets(64,5): error MSB4062: The "SetEnv" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Build.CppTasks.Common.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [c:\genn\lib\lib_genn.vcxproj]
Done Building Project "c:\genn\lib\lib_genn.vcxproj" (default targets) -- FAILED.
Done Building Project "c:\genn\lib\generate.vcxproj" (default targets) -- FAILED.
Build FAILED.
"c:\genn\lib\generate.vcxproj" (default target) (1) ->
"c:\genn\lib\lib_genn.vcxproj" (default target) (2) ->
(SetBuildDefaultEnvironmentVariables target) ->
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Current.targets(64,5): error MSB4062: The "SetEnv" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Build.CppTasks.Common.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [c:\genn\lib\lib_genn.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.17
model build complete
del main.exe *.obj *.ilk *.pdb 2>nul
cd magicnetwork_model_CODE && nmake clean /nologo
'".\generateALL.exe"' is not recognized as an internal or external command,
operable program or batch file.
Microsoft (R) Program Maintenance Utility Version 14.00.24245.0
Copyright (C) Microsoft Corporation. All rights reserved.
The system cannot find the path specified.
NMAKE : fatal error U1077: 'cd' : return code '0x1'
Stop.
---------------------------------------------------------------------------
CalledProcessError Traceback (most recent call last)
~\Anaconda3\lib\site-packages\brian2genn\device.py in build(self, directory, compile, run, use_GPU, debug, with_output, direct_call)
781 try:
--> 782 self.compile_source(debug, directory, use_GPU)
783 except CalledProcessError as ex:
~\Anaconda3\lib\site-packages\brian2genn\device.py in compile_source(self, debug, directory, use_GPU)
993 cmd += ' && nmake /f WINmakefile clean && nmake /f WINmakefile'
--> 994 check_call(cmd.format(genn_path=genn_path), cwd=directory, env=env)
995 else:
~\Anaconda3\lib\subprocess.py in check_call(*popenargs, **kwargs)
290 cmd = popenargs[0]
--> 291 raise CalledProcessError(retcode, cmd)
292 return 0
CalledProcessError: Command '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 && c:\genn\lib\bin\genn-buildmodel.bat magicnetwork_model.cpp && nmake /f WINmakefile clean && nmake /f WINmakefile' returned non-zero exit status 2.
During handling of the above exception, another exception occurred:
RuntimeError Traceback (most recent call last)
<ipython-input-3-14a141395004> in <module>
14 spikemon = SpikeMonitor(G)
15
---> 16 run(50*ms)
17
18 plot(statemon.t/ms, statemon.v[0])
~\Anaconda3\lib\site-packages\brian2\units\fundamentalunits.py in new_f(*args, **kwds)
2373 get_dimensions(newkeyset[k]))
2374
-> 2375 result = f(*args, **kwds)
2376 if 'result' in au:
2377 if au['result'] == bool:
~\Anaconda3\lib\site-packages\brian2\core\magic.py in run(duration, report, report_period, namespace, profile, level)
369 '''
370 return magic_network.run(duration, report=report, report_period=report_period,
--> 371 namespace=namespace, profile=profile, level=2+level)
372 run.__module__ = __name__
373
~\Anaconda3\lib\site-packages\brian2\core\magic.py in run(self, duration, report, report_period, namespace, profile, level)
229 self._update_magic_objects(level=level+1)
230 Network.run(self, duration, report=report, report_period=report_period,
--> 231 namespace=namespace, profile=profile, level=level+1)
232
233 def store(self, name='default', filename=None, level=0):
~\Anaconda3\lib\site-packages\brian2\core\base.py in device_override_decorated_function(*args, **kwds)
272 curdev = get_device()
273 if hasattr(curdev, name):
--> 274 return getattr(curdev, name)(*args, **kwds)
275 else:
276 return func(*args, **kwds)
~\Anaconda3\lib\site-packages\brian2genn\device.py in network_run(self, net, duration, report, report_period, namespace, profile, level, **kwds)
1632 report_period=report_period,
1633 namespace=namespace,
-> 1634 level=level + 1)
1635 self.run_statement_used = True
1636
~\Anaconda3\lib\site-packages\brian2\devices\cpp_standalone\device.py in network_run(self, net, duration, report, report_period, namespace, profile, level, **kwds)
1374 'device.build call to use multiple run '
1375 'statements with this device.')
-> 1376 self.build(direct_call=False, **self.build_options)
1377
1378 def network_store(self, net, *args, **kwds):
~\Anaconda3\lib\site-packages\brian2genn\device.py in build(self, directory, compile, run, use_GPU, debug, with_output, direct_call)
786 'See the output above (if any) for more '
787 'details.').format(cmd=ex.cmd,
--> 788 returncode=ex.returncode)
789 )
790 if run:
RuntimeError: Project compilation failed (Command "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 && c:\genn\lib\bin\genn-buildmodel.bat magicnetwork_model.cpp && nmake /f WINmakefile clean && nmake /f WINmakefile failed with error code 2).
See the output above (if any) for more details.
Right then - enough flailing. I shall wait for an informed, considered response from people who know what they are doing (i.e. not me . . . yet!)
@neworderofjamie , I am afraid this might be a windows build problem in GeNN rather than a brian2genn specific issue but I could be wrong. What do you think?
c:\genn\lib\generate.vcxproj(26,3): error MSB4019: The imported project "C:\Microsoft.Cpp.default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
suggests that this is last year's mystery https://github.com/genn-team/genn/issues/189 which seems to often happen if you have multiple visual studios installed. I think, counter-intuitively, trying to blank this environment variable out is the best fix so try:
SET VCTargetsPath ""
Blanking VCTargetsPath did not help, so I did the following:
Following these steps, I re-ran my test script, and this time I get permission errors, but it is difficult to tell from the messages exactly which file cannot be accessed. The exact test script, and the error messages, are reproduced below:
Test script:
import os
# For now, we set up environment variables locally so I can control them - eventually, move these to
# Windows environment variables.
#
os.environ['GENN_PATH'] = 'c:\\genn'
os.environ['PATH'] = os.environ['PATH'] + ';' + 'c:\\genn\\lib\\bin'
os.environ['CUDA_PATH'] = 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v9.2'
from brian2 import *
import brian2genn
set_device('genn')
# Define the path to vcvarsall.bat
#
prefs.codegen.cpp.msvc_vars_location = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build'
start_scope()
tau = 10*ms
eqs = '''
dv/dt = (1-v)/tau : 1 (unless refractory)
'''
G = NeuronGroup(1, eqs, threshold='v>0.8', reset='v = 0', refractory=5*ms, method='exact')
statemon = StateMonitor(G, 'v', record=0)
spikemon = SpikeMonitor(G)
run(50*ms)
plot(statemon.t/ms, statemon.v[0])
for t in spikemon.t:
axvline(t/ms, ls='--', c='C1', lw=3)
xlabel('Time (ms)')
ylabel('v');
Error Trace:
INFO The following preferences have been changed for Brian2GeNN, reset them manually if you use a different device later in the same script: codegen.loop_invariant_optimisations, core.network.default_schedule [brian2.devices.genn]
running brian code generation ...
building genn executable ...
---------------------------------------------------------------------------
PermissionError Traceback (most recent call last)
<ipython-input-1-4cd8243ff4d2> in <module>
27 spikemon = SpikeMonitor(G)
28
---> 29 run(50*ms)
30
31 plot(statemon.t/ms, statemon.v[0])
~\Anaconda3\lib\site-packages\brian2\units\fundamentalunits.py in new_f(*args, **kwds)
2373 get_dimensions(newkeyset[k]))
2374
-> 2375 result = f(*args, **kwds)
2376 if 'result' in au:
2377 if au['result'] == bool:
~\Anaconda3\lib\site-packages\brian2\core\magic.py in run(duration, report, report_period, namespace, profile, level)
369 '''
370 return magic_network.run(duration, report=report, report_period=report_period,
--> 371 namespace=namespace, profile=profile, level=2+level)
372 run.__module__ = __name__
373
~\Anaconda3\lib\site-packages\brian2\core\magic.py in run(self, duration, report, report_period, namespace, profile, level)
229 self._update_magic_objects(level=level+1)
230 Network.run(self, duration, report=report, report_period=report_period,
--> 231 namespace=namespace, profile=profile, level=level+1)
232
233 def store(self, name='default', filename=None, level=0):
~\Anaconda3\lib\site-packages\brian2\core\base.py in device_override_decorated_function(*args, **kwds)
272 curdev = get_device()
273 if hasattr(curdev, name):
--> 274 return getattr(curdev, name)(*args, **kwds)
275 else:
276 return func(*args, **kwds)
~\Anaconda3\lib\site-packages\brian2genn\device.py in network_run(self, net, duration, report, report_period, namespace, profile, level, **kwds)
1632 report_period=report_period,
1633 namespace=namespace,
-> 1634 level=level + 1)
1635 self.run_statement_used = True
1636
~\Anaconda3\lib\site-packages\brian2\devices\cpp_standalone\device.py in network_run(self, net, duration, report, report_period, namespace, profile, level, **kwds)
1374 'device.build call to use multiple run '
1375 'statements with this device.')
-> 1376 self.build(direct_call=False, **self.build_options)
1377
1378 def network_store(self, net, *args, **kwds):
~\Anaconda3\lib\site-packages\brian2genn\device.py in build(self, directory, compile, run, use_GPU, debug, with_output, direct_call)
780 if compile:
781 try:
--> 782 self.compile_source(debug, directory, use_GPU)
783 except CalledProcessError as ex:
784 raise RuntimeError(('Project compilation failed (Command {cmd} '
~\Anaconda3\lib\site-packages\brian2genn\device.py in compile_source(self, debug, directory, use_GPU)
992 cmd += ' -c'
993 cmd += ' && nmake /f WINmakefile clean && nmake /f WINmakefile'
--> 994 check_call(cmd.format(genn_path=genn_path), cwd=directory, env=env)
995 else:
996 buildmodel_cmd = os.path.join(genn_path, 'lib', 'bin', 'genn-buildmodel.sh')
~\Anaconda3\lib\subprocess.py in check_call(*popenargs, **kwargs)
284 check_call(["ls", "-l"])
285 """
--> 286 retcode = call(*popenargs, **kwargs)
287 if retcode:
288 cmd = kwargs.get("args")
~\Anaconda3\lib\subprocess.py in call(timeout, *popenargs, **kwargs)
265 retcode = call(["ls", "-l"])
266 """
--> 267 with Popen(*popenargs, **kwargs) as p:
268 try:
269 return p.wait(timeout=timeout)
~\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors)
707 c2pread, c2pwrite,
708 errread, errwrite,
--> 709 restore_signals, start_new_session)
710 except:
711 # Cleanup if the child failed starting.
~\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
995 env,
996 os.fspath(cwd) if cwd is not None else None,
--> 997 startupinfo)
998 finally:
999 # Child is launched. Close the parent's copy of those pipe
PermissionError: [WinError 5] Access is denied
Thanks.
Ajit
Hi Marcel & Thomas:
As an experiment, I tried running the following abbreviated script (to eliminate any issues with plotting):
import os
# For now, we set up environment variables locally so I can control them - eventually, move these to
# Windows environment variables.
#
os.environ['GENN_PATH'] = 'c:\\genn'
os.environ['PATH'] = os.environ['PATH'] + ';' + 'c:\\genn\\lib\\bin'
os.environ['CUDA_PATH'] = 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v9.2'
from brian2 import *
import brian2genn
set_device('genn')
# Define the path to vcvarsall.bat
#
prefs.codegen.cpp.msvc_vars_location = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build'
start_scope()
tau = 10*ms
eqs = '''
dv/dt = (1-v)/tau : 1 (unless refractory)
'''
G = NeuronGroup(1, eqs, threshold='v>0.8', reset='v = 0', refractory=5*ms, method='exact')
statemon = StateMonitor(G, 'v', record=0)
spikemon = SpikeMonitor(G)
run(50*ms)
This gives the same errors as shown earlier in this thread. Then I tried the same script directly in a shell (i.e. without using JupyterLab). This gives ADDITIONAL information as shown below. What is particularly interesting is the bit which says the "Brian 2 encountered an unexpected error . . ." - this does not appear when running in Jupyter.
The full error trace is shown below, and I have also attached the file brian_debug_4088owuf.log that the message asks the user to include in the report.
running brian code generation ...
building genn executable ...
ERROR Brian 2 encountered an unexpected error. If you think this is bug in Brian 2, please report this issue either to the mailing list at <http://groups.google.com/group/brian-development/>, or to the issue tracker at <https://github.com/brian-team/brian2/issues>. Please include this file with debug information in your report: C:\Users\Ajit\AppData\Local\Temp\brian_debug_4088owuf.log You can also include a copy of the redirected std stream outputs, available at C:\Users\Ajit\AppData\Local\Temp\brian_stdout_ur9jnzxp.log and C:\Users\Ajit\AppData\Local\Temp\brian_stderr_e571c15w.log Thanks! [brian2]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2\units\fundamentalunits.py", line 2375, in new_f
result = f(*args, **kwds)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2\core\magic.py", line 371, in run
namespace=namespace, profile=profile, level=2+level)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2\core\magic.py", line 231, in run
namespace=namespace, profile=profile, level=level+1)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2\core\base.py", line 274, in device_override_decorated_function
return getattr(curdev, name)(*args, **kwds)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2genn\device.py", line 1634, in network_run
level=level + 1)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2\devices\cpp_standalone\device.py", line 1376, in network_run
self.build(direct_call=False, **self.build_options)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2genn\device.py", line 782, in build
self.compile_source(debug, directory, use_GPU)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2genn\device.py", line 994, in compile_source
check_call(cmd.format(genn_path=genn_path), cwd=directory, env=env)
File "C:\Users\Ajit\Anaconda3\lib\subprocess.py", line 286, in check_call
retcode = call(*popenargs, **kwargs)
File "C:\Users\Ajit\Anaconda3\lib\subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\Ajit\Anaconda3\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\Users\Ajit\Anaconda3\lib\subprocess.py", line 997, in _execute_child
startupinfo)
PermissionError: [WinError 5] Access is denied
I didn't attach the other file specified in the message (brian_stdout_ur9jnzxp.log) because it is empty. I have run out of things to try: any guidance or suggestions from the experts would be greatly appreciated.
Thanks!
Can you post C:\Users\Ajit\AppData\Local\Temp\brian_stderr_e571c15w.log or is it empty as well? (also, please bear with us - Marcel is still on vacation).
I know that supporting Brian2 is a volunteer effort, and I thank you, Marcel and the brian-team for helping the user community!
While experimenting with various versions of Visual Studio, I appear to have broken Cython (I think I corrupted my PATH variable). Even after "repairing" the Visual Studio 2017 installation, and re-installing Anaconda & Brian2, manually clearing the cache ("brian2.clear_cache('cython'), when I run brian2.test(), I get the following error. Any suggestions on how I can fix this (after I fix this, I'll look for the file you asked for to see if it is empty)?
So far, I've re-installed Visual Studio 2017 and Anaconda (after first uninstalling them), but that has not resolved this error. I also ran "repair" on Visual Studio 2017, but that didn't help either.
>>> brian2.test()
Running tests in C:\Users\Ajit\Anaconda3\lib\site-packages\brian2 for targets numpy, cython (excluding long tests)
Testing codegen-independent code
Resetting to default preferences
Running tests that do not use code generation
.................S.................S........WARNING Integrating equations with GSL is still considered experimental [brian2.stateupdaters.GSL]
.........WARNING C:\Users\Ajit\Anaconda3\lib\site-packages\Cython\Compiler\Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\Ajit\.cython\brian_extensions\_cython_magic_758f051e3ba79ebc10a9676b2e2ebdd7.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
[py.warnings]--- Logging error ---
b'"\x00R\x00u\x00n\x00n\x00i\x00n\x00g\x00 \x00m\x00y\x00 \x00.\x00b\x00a\x00s\x00h\x00r\x00c\x00 \x00f\x00o\x00r\x00 \x00W\x00i\x00n\x00d\x00o\x00w\x00s\x00 \x00(\x00e\x00:\x00\\\x00R\x00e\x00s\x00e\x00a\x00r\x00c\x00h\x00\\\x00b\x00a\x00s\x00h\x00r\x00c\x00_\x00w\x00i\x00n\x00.\x00b\x00a\x00t\x00)\x00,\x00 \x00c\x00u\x00r\x00r\x00e\x00n\x00t\x00l\x00y\x00 \x00e\x00m\x00p\x00t\x00y\x00 \x00e\x00x\x00c\x00e\x00p\x00t\x00 \x00f\x00o\x00r\x00 \x00t\x00h\x00i\x00s\x00 \x00m\x00e\x00s\x00s\x00a\x00g\x00e\x00"\x00\r\x00\n\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00\r\x00\n\x00*\x00*\x00 \x00V\x00i\x00s\x00u\x00a\x00l\x00 \x00S\x00t\x00u\x00d\x00i\x00o\x00 \x002\x000\x001\x007\x00 \x00D\x00e\x00v\x00e\x00l\x00o\x00p\x00e\x00r\x00 \x00C\x00o\x00m\x00m\x00a\x00n\x00d\x00 \x00P\x00r\x00o\x00m\x00p\x00t\x00 \x00v\x001\x005\x00.\x009\x00.\x001\x001\x00\r\x00\n\x00*\x00*\x00 \x00C\x00o\x00p\x00y\x00r\x00i\x00g\x00h\x00t\x00 \x00(\x00c\x00)\x00 \x002\x000\x001\x007\x00 \x00M\x00i\x00c\x00r\x00o\x00s\x00o\x00f\x00t\x00 \x00C\x00o\x00r\x00p\x00o\x00r\x00a\x00t\x00i\x00o\x00n\x00\r\x00\n\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00\r\x00\n\x00T\x00h\x00e\x00 \x00s\x00y\x00n\x00t\x00a\x00x\x00 \x00o\x00f\x00 \x00t\x00h\x00e\x00 \x00c\x00o\x00m\x00m\x00a\x00n\x00d\x00 \x00i\x00s\x00 \x00i\x00n\x00c\x00o\x00r\x00r\x00e\x00c\x00t\x00.\x00\r\x00\n\x00'
WARNING Cannot use Cython, a test compilation failed: [WinError 6] The handle is invalid (OSError) [brian2.codegen.runtime.cython_rt.cython_rt.failed_compile_test]
I finally got my machine back to where it is passing the Brian2 self-test. So I went to the brian2genn page here (https://brian2genn.readthedocs.io/en/latest/introduction/) for the instructions. But the link to "GeNN Installation Instructions" is gone - did you move it? I need to re-install genn so I can send you the other file that you requested.
I closed the issue in error (clicked on "Close and comment" rather than "Comment".
Installation instructions are in the README: https://github.com/genn-team/genn/blob/master/README.md
OK. I installed genn (4.0.0-RC1), and then tried the following test (in a JupyterLab window):
from brian2 import *
import brian2genn
set_device('genn')
prefs.devices.genn.path = 'C:\genn-4.0.0-RC1'
prefs.codegen.cpp.msvc_vars_location = 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build'
start_scope()
tau = 10*ms
eqs = '''
dv/dt = (1-v)/tau : 1 (unless refractory)
'''
G = NeuronGroup(1, eqs, threshold='v>0.8', reset='v = 0', refractory=5*ms, method='exact')
statemon = StateMonitor(G, 'v', record=0)
spikemon = SpikeMonitor(G)
run(50*ms)
plot(statemon.t/ms, statemon.v[0])
for t in spikemon.t:
axvline(t/ms, ls='--', c='C1', lw=3)
xlabel('Time (ms)')
ylabel('v');
This yields the following messages:
INFO The following preferences have been changed for Brian2GeNN, reset them manually if you use a different device later in the same script: codegen.loop_invariant_optimisations, core.network.default_schedule [brian2.devices.genn]
running brian code generation ...
building genn executable ...
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-1-aabf2b5d13d8> in <module>
16 spikemon = SpikeMonitor(G)
17
---> 18 run(50*ms)
19
20 plot(statemon.t/ms, statemon.v[0])
~\Anaconda3\lib\site-packages\brian2\units\fundamentalunits.py in new_f(*args, **kwds)
2373 get_dimensions(newkeyset[k]))
2374
-> 2375 result = f(*args, **kwds)
2376 if 'result' in au:
2377 if au['result'] == bool:
~\Anaconda3\lib\site-packages\brian2\core\magic.py in run(duration, report, report_period, namespace, profile, level)
369 '''
370 return magic_network.run(duration, report=report, report_period=report_period,
--> 371 namespace=namespace, profile=profile, level=2+level)
372 run.__module__ = __name__
373
~\Anaconda3\lib\site-packages\brian2\core\magic.py in run(self, duration, report, report_period, namespace, profile, level)
229 self._update_magic_objects(level=level+1)
230 Network.run(self, duration, report=report, report_period=report_period,
--> 231 namespace=namespace, profile=profile, level=level+1)
232
233 def store(self, name='default', filename=None, level=0):
~\Anaconda3\lib\site-packages\brian2\core\base.py in device_override_decorated_function(*args, **kwds)
272 curdev = get_device()
273 if hasattr(curdev, name):
--> 274 return getattr(curdev, name)(*args, **kwds)
275 else:
276 return func(*args, **kwds)
~\Anaconda3\lib\site-packages\brian2genn\device.py in network_run(self, net, duration, report, report_period, namespace, profile, level, **kwds)
1632 report_period=report_period,
1633 namespace=namespace,
-> 1634 level=level + 1)
1635 self.run_statement_used = True
1636
~\Anaconda3\lib\site-packages\brian2\devices\cpp_standalone\device.py in network_run(self, net, duration, report, report_period, namespace, profile, level, **kwds)
1374 'device.build call to use multiple run '
1375 'statements with this device.')
-> 1376 self.build(direct_call=False, **self.build_options)
1377
1378 def network_store(self, net, *args, **kwds):
~\Anaconda3\lib\site-packages\brian2genn\device.py in build(self, directory, compile, run, use_GPU, debug, with_output, direct_call)
780 if compile:
781 try:
--> 782 self.compile_source(debug, directory, use_GPU)
783 except CalledProcessError as ex:
784 raise RuntimeError(('Project compilation failed (Command {cmd} '
~\Anaconda3\lib\site-packages\brian2genn\device.py in compile_source(self, debug, directory, use_GPU)
992 cmd += ' -c'
993 cmd += ' && nmake /f WINmakefile clean && nmake /f WINmakefile'
--> 994 check_call(cmd.format(genn_path=genn_path), cwd=directory, env=env)
995 else:
996 buildmodel_cmd = os.path.join(genn_path, 'lib', 'bin', 'genn-buildmodel.sh')
~\Anaconda3\lib\subprocess.py in check_call(*popenargs, **kwargs)
284 check_call(["ls", "-l"])
285 """
--> 286 retcode = call(*popenargs, **kwargs)
287 if retcode:
288 cmd = kwargs.get("args")
~\Anaconda3\lib\subprocess.py in call(timeout, *popenargs, **kwargs)
265 retcode = call(["ls", "-l"])
266 """
--> 267 with Popen(*popenargs, **kwargs) as p:
268 try:
269 return p.wait(timeout=timeout)
~\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors)
707 c2pread, c2pwrite,
708 errread, errwrite,
--> 709 restore_signals, start_new_session)
710 except:
711 # Cleanup if the child failed starting.
~\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
995 env,
996 os.fspath(cwd) if cwd is not None else None,
--> 997 startupinfo)
998 finally:
999 # Child is launched. Close the parent's copy of those pipe
FileNotFoundError: [WinError 2] The system cannot find the file specified
Ouch ... I probably should have warned earlier, but GeNN 4 is not yet supported by brian2genn (it's only a release candidate as of yet). Please use the last stable release from GeNN (3.3.0).
Then, the errors you copied only tell me that something went wrong during the "buildmodel", the "make" or the "execution" stage of brian2genn. In order to say something sensible I would have to see stderr output produced during those stages.
But in the meantime, can you run your test script outside JupyterLab (e.g. from a powershell) and see whether you can locate a newly created sub-directory "GeNNworkspace"? It should contain the relevant C++ files for GeNN. If you find this, we can try to debug your problem on the GeNN level.
Sorry about that . . . I downloaded GeNN 3.3.0, and ran my test script in a shell window. This yielded the following:
(base) E:\Research>python
Python 3.6.7 (default, Feb 28 2019, 07:28:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ['CUDA_PATH'] = 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1'
>>> from brian2 import *
>>> import brian2genn
>>> set_device('genn')
INFO The following preferences have been changed for Brian2GeNN, reset them manually if you use a different device later in the same script: codegen.loop_invariant_optimisations, core.network.default_schedule [brian2.devices.genn]
>>> prefs.devices.genn.path = 'C:\\genn\\genn-3.3.0'
>>> prefs.codegen.cpp.msvc_vars_location = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build'
>>> start_scope()
>>>
>>> tau = 10*ms
>>> eqs = '''
... dv/dt = (1-v)/tau : 1 (unless refractory)
... '''
>>>
>>> G = NeuronGroup(1, eqs, threshold='v>0.8', reset='v = 0', refractory=5*ms, method='exact')
>>>
>>> statemon = StateMonitor(G, 'v', record=0)
>>> spikemon = SpikeMonitor(G)
>>>
>>> run(50*ms)
running brian code generation ...
building genn executable ...
ERROR Brian 2 encountered an unexpected error. If you think this is bug in Brian 2, please report this issue either to the mailing list at <http://groups.google.com/group/brian-development/>, or to the issue tracker at <https://github.com/brian-team/brian2/issues>. Please include this file with debug information in your report: C:\Users\Ajit\AppData\Local\Temp\brian_debug_jut9f7p9.log You can also include a copy of the redirected std stream outputs, available at C:\Users\Ajit\AppData\Local\Temp\brian_stdout_9wshfu39.log and C:\Users\Ajit\AppData\Local\Temp\brian_stderr__to655kx.log Thanks! [brian2]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2\units\fundamentalunits.py", line 2375, in new_f
result = f(*args, **kwds)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2\core\magic.py", line 371, in run
namespace=namespace, profile=profile, level=2+level)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2\core\magic.py", line 231, in run
namespace=namespace, profile=profile, level=level+1)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2\core\base.py", line 274, in device_override_decorated_function
return getattr(curdev, name)(*args, **kwds)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2genn\device.py", line 1634, in network_run
level=level + 1)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2\devices\cpp_standalone\device.py", line 1376, in network_run
self.build(direct_call=False, **self.build_options)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2genn\device.py", line 782, in build
self.compile_source(debug, directory, use_GPU)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2genn\device.py", line 994, in compile_source
check_call(cmd.format(genn_path=genn_path), cwd=directory, env=env)
File "C:\Users\Ajit\Anaconda3\lib\subprocess.py", line 286, in check_call
retcode = call(*popenargs, **kwargs)
File "C:\Users\Ajit\Anaconda3\lib\subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\Ajit\Anaconda3\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\Users\Ajit\Anaconda3\lib\subprocess.py", line 997, in _execute_child
startupinfo)
PermissionError: [WinError 5] Access is denied
>>>
The directory GeNNworkspace does get created, and a tarball (or rather zipball) of it is attached. GeNNworkspace_ZIP.zip
Ok - so it seems "buildmodel" already fails. Can you please use a shell & go to the GeNNworkspace directory and run "c:\genn\lib\bin\genn-buildmodel.bat magicnetwork_model.cpp" and please post the error messages received.
The messages were as follows:
(base) E:\Research\GeNNworkspace>set GENN_PATH='c:\genn\genn-3.3.0'
(base) E:\Research\GeNNworkspace>c:\genn\genn-3.3.0\lib\bin\genn-buildmodel.bat magicnetwork_model.cpp
'msbuild' is not recognized as an internal or external command,
operable program or batch file.
'".\generateALL.exe"' is not recognized as an internal or external command,
operable program or batch file.
model build complete
(base) E:\Research\GeNNworkspace>
hum ... I think we are now running into separate problems with the debugging approach. Can you execute the appropriate vcvarsall.bat
before trying c:\genn\lib\bin\genn-buildmodel.bat magicnetwork_model.cpp
? Or have you done that already?
I cleaned up my Visual Studio installation so only Visual Studio 2017 is installed. I do have both CUDA 10.1 and 9.2 installed: CUDA_PATH points to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1. With that, here is the trace:
(base) E:\Research>set GENN_PATH='c:\genn\genn-3.3.0'
(base) E:\Research>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.11
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86_x64'
(base) E:\Research>cd GeNNworkspace
(base) E:\Research\GeNNworkspace>dir
Volume in drive E has no label.
Volume Serial Number is 440E-415C
Directory of E:\Research\GeNNworkspace
05/08/2019 02:21 PM <DIR> .
05/08/2019 02:21 PM <DIR> ..
05/08/2019 02:21 PM <DIR> b2glib
05/08/2019 02:21 PM <DIR> brianlib
05/08/2019 02:21 PM <DIR> code_objects
05/08/2019 02:21 PM 3,792 engine.cpp
05/08/2019 02:21 PM 1,033 engine.h
05/08/2019 02:21 PM 5,399 magicnetwork_model.cpp
05/08/2019 02:21 PM 4,166 main.cpp
05/08/2019 02:21 PM 904 main.h
05/08/2019 02:21 PM 0 network.cpp
05/08/2019 02:21 PM 193 network.h
05/08/2019 02:21 PM 14,099 objects.cpp
05/08/2019 02:21 PM 2,399 objects.h
05/08/2019 02:21 PM <DIR> results
05/08/2019 02:21 PM <DIR> static_arrays
05/08/2019 02:21 PM 0 synapses_classes.cpp
05/08/2019 02:21 PM 2,084 synapses_classes.h
05/08/2019 02:21 PM 428 WINmakefile
12 File(s) 34,497 bytes
7 Dir(s) 8,910,438,449,152 bytes free
(base) E:\Research\GeNNworkspace>c:\genn\genn-3.3.0\lib\bin\genn-buildmodel.bat magicnetwork_model.cpp
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
Switch: 'c:\genn\genn-3.3.0'\lib\generate.vcxproj
'".\generateALL.exe"' is not recognized as an internal or external command,
operable program or batch file.
model build complete
(base) E:\Research\GeNNworkspace>
it seems to suggest that generate.vcxproj
cannot be found in c:\genn\genn-3.3.0\lib\
. Is it not there?
Are the quotation marks around c:\genn\genn-3.3.0
causing trouble?
It is there. However, the quotation marks around c:\genn\genn-3.3.0
were causing trouble: when I removed them, I got the far more satisfactory trace below:
(base) E:\Research>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.11
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86_x64'
(base) E:\Research>set GENN_PATH=c:\genn\genn-3.3.0
(base) E:\Research>echo %GENN_PATH%
c:\genn\genn-3.3.0
(base) E:\Research>cd GeNNworkspace
(base) E:\Research\GeNNworkspace>c:\genn\genn-3.3.0\lib\bin\genn-buildmodel.bat magicnetwork_model.cpp
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 5/9/2019 9:00:03 AM.
Project "c:\genn\genn-3.3.0\lib\generate.vcxproj" on node 1 (default targets).
Project "c:\genn\genn-3.3.0\lib\generate.vcxproj" (1) is building "c:\genn\genn-3.3.0\lib\lib_genn.vcxproj" (2) on node
1 (default targets).
PrepareForBuild:
Creating directory "obj\x64\Release\".
Creating directory "lib\".
Creating directory "obj\x64\Release\lib_genn.tlog\".
InitializeBuildStatus:
Creating "obj\x64\Release\lib_genn.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\CL.exe /c /Ii
nclude /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" /Zi /nologo /W1 /WX- /diagnostics:classic
/O2 /Gm- /EHsc /MT /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"obj\x64\Release\\" /Fd"obj\x64\Release\li
b_genn.pdb" /Gd /TP /FC /errorReport:queue src\binomial.cc src\global.cc src\modelSpec.cc src\neuronModels.cc src\syn
apseModels.cc src\postSynapseModels.cc src\utils.cc src\codeStream.cc src\codeGenUtils.cc src\sparseUtils.cc src\hr_t
ime.cc src\currentSourceModels.cc src\newNeuronModels.cc src\newWeightUpdateModels.cc src\newPostsynapticModels.cc sr
c\initSparseConnectivitySnippet.cc src\initVarSnippet.cc src\currentSource.cc src\neuronGroup.cc src\synapseGroup.cc
src\standardSubstitutions.cc src\standardGeneratedSections.cc
binomial.cc
global.cc
modelSpec.cc
neuronModels.cc
synapseModels.cc
postSynapseModels.cc
utils.cc
codeStream.cc
codeGenUtils.cc
sparseUtils.cc
hr_time.cc
currentSourceModels.cc
newNeuronModels.cc
newWeightUpdateModels.cc
newPostsynapticModels.cc
initSparseConnectivitySnippet.cc
initVarSnippet.cc
currentSource.cc
neuronGroup.cc
synapseGroup.cc
Generating Code...
Compiling...
standardSubstitutions.cc
standardGeneratedSections.cc
Generating Code...
Lib:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\Lib.exe /OUT:
"lib\genn.lib" /NOLOGO /MACHINE:X64 obj\x64\Release\binomial.obj
obj\x64\Release\global.obj
obj\x64\Release\modelSpec.obj
obj\x64\Release\neuronModels.obj
obj\x64\Release\synapseModels.obj
obj\x64\Release\postSynapseModels.obj
obj\x64\Release\utils.obj
obj\x64\Release\codeStream.obj
obj\x64\Release\codeGenUtils.obj
obj\x64\Release\sparseUtils.obj
obj\x64\Release\hr_time.obj
obj\x64\Release\currentSourceModels.obj
obj\x64\Release\newNeuronModels.obj
obj\x64\Release\newWeightUpdateModels.obj
obj\x64\Release\newPostsynapticModels.obj
obj\x64\Release\initSparseConnectivitySnippet.obj
obj\x64\Release\initVarSnippet.obj
obj\x64\Release\currentSource.obj
obj\x64\Release\neuronGroup.obj
obj\x64\Release\synapseGroup.obj
obj\x64\Release\standardSubstitutions.obj
obj\x64\Release\standardGeneratedSections.obj
lib_genn.vcxproj -> c:\genn\genn-3.3.0\lib\lib\genn.lib
FinalizeBuildStatus:
Deleting file "obj\x64\Release\lib_genn.tlog\unsuccessfulbuild".
Touching "obj\x64\Release\lib_genn.tlog\lib_genn.lastbuildstate".
Done Building Project "c:\genn\genn-3.3.0\lib\lib_genn.vcxproj" (default targets).
PrepareForBuild:
Creating directory "E:\Research\GeNNworkspace\obj_generate\x64\Release\".
Creating directory "E:\Research\GeNNworkspace\obj_generate\x64\Release\generate.tlog\".
InitializeBuildStatus:
Creating "E:\Research\GeNNworkspace\obj_generate\x64\Release\generate.tlog\unsuccessfulbuild" because "AlwaysCreate"
was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\CL.exe /c /Ii
nclude /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" /Zi /nologo /W1 /WX- /diagnostics:classic
/O2 /D "MODEL=\"E:\Research\GeNNworkspace\magicnetwork_model.cpp\"" /D "NVCC=\"C:/Program Files/NVIDIA GPU Computing
Toolkit/CUDA/v10.1/bin/nvcc.exe\"" /Gm- /EHsc /MT /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"E:\Researc
h\GeNNworkspace\obj_generate\x64\Release\\" /Fd"E:\Research\GeNNworkspace\obj_generate\x64\Release\vc141.pdb" /Gd /TP
/FC /errorReport:queue src\generateALL.cc src\generateCPU.cc src\generateInit.cc src\generateKernels.cc src\generate
Runner.cc
generateALL.cc
generateCPU.cc
generateInit.cc
generateKernels.cc
generateRunner.cc
Generating Code...
Link:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\link.exe /ERR
ORREPORT:QUEUE /OUT:"E:\Research\GeNNworkspace\generateALL.exe" /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.li
b comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib lib\genn.lib "C:\Prog
ram Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib\x64\cudart.lib" "C:\Program Files\NVIDIA GPU Computing Toolkit\
CUDA\v10.1\lib\x64\cuda.lib" /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG:FULL
/PDB:"E:\Research\GeNNworkspace\generateALL.pdb" /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"E:\Research\GeNNworkspace\g
enerateALL.lib" /MACHINE:X64 E:\Research\GeNNworkspace\obj_generate\x64\Release\generateALL.obj
E:\Research\GeNNworkspace\obj_generate\x64\Release\generateCPU.obj
E:\Research\GeNNworkspace\obj_generate\x64\Release\generateInit.obj
E:\Research\GeNNworkspace\obj_generate\x64\Release\generateKernels.obj
E:\Research\GeNNworkspace\obj_generate\x64\Release\generateRunner.obj
generate.vcxproj -> E:\Research\GeNNworkspace\generateALL.exe
FinalizeBuildStatus:
Deleting file "E:\Research\GeNNworkspace\obj_generate\x64\Release\generate.tlog\unsuccessfulbuild".
Touching "E:\Research\GeNNworkspace\obj_generate\x64\Release\generate.tlog\generate.lastbuildstate".
Done Building Project "c:\genn\genn-3.3.0\lib\generate.vcxproj" (default targets).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:47.46
call was .\generateALL.exe E:\Research\GeNNworkspace
optimizing block size...
Global memory required for core model: 0 MB.
17179869184 for device 0
dry-run compile for device 0
""C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin/nvcc.exe" -cubin -x cu -arch sm_61 -O3 -I"%GENN_PATH%\lib\include" -o "E:\Research\GeNNworkspace\runner.cubin" "E:\Research\GeNNworkspace\magicnetwork_model_CODE\runner.cc""
runner.cc
Global memory required for core model: 0 MB.
17179869184 for device 0
dry-run compile for device 0
""C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin/nvcc.exe" -cubin -x cu -arch sm_61 -O3 -I"%GENN_PATH%\lib\include" -o "E:\Research\GeNNworkspace\runner.cubin" "E:\Research\GeNNworkspace\magicnetwork_model_CODE\runner.cc""
runner.cc
Global memory required for core model: 0 MB.
17179869184 for device 1
dry-run compile for device 1
""C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin/nvcc.exe" -cubin -x cu -arch sm_61 -O3 -I"%GENN_PATH%\lib\include" -o "E:\Research\GeNNworkspace\runner.cubin" "E:\Research\GeNNworkspace\magicnetwork_model_CODE\runner.cc""
runner.cc
Global memory required for core model: 0 MB.
17179869184 for device 1
dry-run compile for device 1
""C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin/nvcc.exe" -cubin -x cu -arch sm_61 -O3 -I"%GENN_PATH%\lib\include" -o "E:\Research\GeNNworkspace\runner.cubin" "E:\Research\GeNNworkspace\magicnetwork_model_CODE\runner.cc""
runner.cc
Using device 0 (Quadro P5000), with up to 640 warps of summed kernel occupancy.
pre synapse reset block size: 0
synapse block size: 0
learn block size
```: 0
synapseDynamics block size: 0
neuron block size: 32
init block size:0
sparse init block size:0
Global memory required for core model: 0 MB.
17179869184 for device 0
model build complete
(base) E:\Research\GeNNworkspace>
Then I tried again in a JupyterLab window after setting the environment variable GENN_PATH to c:\genn\genn-3.3.0 and adding c:\genn\genn-3.3.0\lib\bin to the PATH. But something is still missing in that environment because I still get the FileNotFoundError.
What to do?
Ok ... this looks much more promising. But it's only half the way; let's still continue on the GeNN level and let's now try nmake /f WINmakefile clean && nmake /f WINmakefile
in the GeNNworspace directory. What does that yield?
if successful, follow up with .\main.exe test 0.01 1
Curiouser and curiouser: that all seemed to work as expected. Trace below:
(base) E:\Research\GeNNworkspace>nmake /f WINmakefile clean && nmake /f WINmakefile
Microsoft (R) Program Maintenance Utility Version 14.16.27030.1
Copyright (C) Microsoft Corporation. All rights reserved.
del main.exe *.obj *.ilk *.pdb 2>nul
cd magicnetwork_model_CODE && nmake clean /nologo
del runner.obj 2>nul
Microsoft (R) Program Maintenance Utility Version 14.16.27030.1
Copyright (C) Microsoft Corporation. All rights reserved.
cl /nologo /EHsc /Ox /w /arch:AVX2 /MP /c /Fomain.obj main.cpp /I %CD% /I brianlib/randomkit /I"C:\genn\genn-3.3.0\lib\include" /I"C:\genn\genn-3.3.0\userproject\include" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"
main.cpp
cl /nologo /EHsc /Ox /w /arch:AVX2 /MP /c /Foobjects.obj objects.cpp /I %CD% /I brianlib/randomkit /I"C:\genn\genn-3.3.0\lib\include" /I"C:\genn\genn-3.3.0\userproject\include" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"
objects.cpp
cl /nologo /EHsc /Ox /w /arch:AVX2 /MP /c /Focode_objects/statemonitor_codeobject.obj code_objects/statemonitor_codeobject.cpp /I %CD% /I brianlib/randomkit /I"C:\genn\genn-3.3.0\lib\include" /I"C:\genn\genn-3.3.0\userproject\include" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"
statemonitor_codeobject.cpp
cl /nologo /EHsc /Ox /w /arch:AVX2 /MP /c /Focode_objects/spikemonitor_codeobject.obj code_objects/spikemonitor_codeobject.cpp /I %CD% /I brianlib/randomkit /I"C:\genn\genn-3.3.0\lib\include" /I"C:\genn\genn-3.3.0\userproject\include" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"
spikemonitor_codeobject.cpp
cl /nologo /EHsc /Ox /w /arch:AVX2 /MP /c /Fobrianlib/randomkit/randomkit.obj brianlib/randomkit/randomkit.cc /I %CD% /I brianlib/randomkit /I"C:\genn\genn-3.3.0\lib\include" /I"C:\genn\genn-3.3.0\userproject\include" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"
randomkit.cc
cd magicnetwork_model_CODE && nmake /nologo
"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin/nvcc.exe" -c -x cu -arch sm_61 -O3 -I"C:\genn\genn-3.3.0\lib\include" runner.cc
runner.cc
cl /nologo /EHsc /Ox /w /arch:AVX2 /MP /Femain.exe main.obj objects.obj code_objects/statemonitor_codeobject.obj code_objects/spikemonitor_codeobject.obj brianlib/randomkit/randomkit.obj magicnetwork_model_CODE\runner.obj advapi32.lib "C:\genn\genn-3.3.0\lib\lib\genn.lib" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib\x64\cudart.lib" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib\x64\cuda.lib"
(base) E:\Research\GeNNworkspace>.\main.exe test 0.01 1
# DT 0.000100
# totalTime 0.010000
# We are running with fixed time step 0.000100
0.01 done ...
everything finished.
(base) E:\Research\GeNNworkspace>
So now the issue is with running in JupyterLab!
It appears so. Maybe you can try an intermediate test where you run your Python script from a powershell (rather than from JupyterLab). Have you tried that?
I just did co, up to and including "run(50ms)" but leaving out the plotting bits. That yielded the following error trace (I've also attached [brian_debug_ibwoh3ej.log](https://github.com/brian-team/brian2genn/files/3163416/brian_debug_ibwoh3ej.log: the redirected std stream output files are empty):
(base) PS>python
Python 3.6.7 (default, Feb 28 2019, 07:28:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from brian2 import *
>>> import brian2genn
>>> set_device('genn')
INFO The following preferences have been changed for Brian2GeNN, reset them manually if you use a different device later in the same script: codegen.loop_invariant_optimisations, core.network.default_schedule [brian2.devices.genn]
>>> prefs.codegen.cpp.msvc_vars_location = 'C:\\Program Files (x86)\\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build'
>>> start_scope()
>>>
>>> tau = 10*ms
>>> eqs = '''
... dv/dt = (1-v)/tau : 1 (unless refractory)
... '''
>>>
>>> G = NeuronGroup(1, eqs, threshold='v>0.8', reset='v = 0', refractory=5*ms, method='exact')
>>>
>>> statemon = StateMonitor(G, 'v', record=0)
>>> spikemon = SpikeMonitor(G)
>>>
>>> run(50*ms)
running brian code generation ...
building genn executable ...
ERROR Brian 2 encountered an unexpected error. If you think this is bug in Brian 2, please report this issue either to the mailing list at <http://groups.google.com/group/brian-development/>, or to the issue tracker at <https://github.com/brian-team/brian2/issues>. Please include this file with debug information in your report: C:\Users\Ajit\AppData\Local\Temp\brian_debug_ibwoh3ej.log You can also include a copy of the redirected std stream outputs, available at C:\Users\Ajit\AppData\Local\Temp\brian_stdout_iy3ubgrb.log and C:\Users\Ajit\AppData\Local\Temp\brian_stderr_07f1gj4d.log Thanks! [brian2]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2\units\fundamentalunits.py", line 2375, in new_f
result = f(*args, **kwds)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2\core\magic.py", line 371, in run
namespace=namespace, profile=profile, level=2+level)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2\core\magic.py", line 231, in run
namespace=namespace, profile=profile, level=level+1)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2\core\base.py", line 274, in device_override_decorated_function
return getattr(curdev, name)(*args, **kwds)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2genn\device.py", line 1634, in network_run
level=level + 1)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2\devices\cpp_standalone\device.py", line 1376, in network_run
self.build(direct_call=False, **self.build_options)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2genn\device.py", line 782, in build
self.compile_source(debug, directory, use_GPU)
File "C:\Users\Ajit\Anaconda3\lib\site-packages\brian2genn\device.py", line 994, in compile_source
check_call(cmd.format(genn_path=genn_path), cwd=directory, env=env)
File "C:\Users\Ajit\Anaconda3\lib\subprocess.py", line 286, in check_call
retcode = call(*popenargs, **kwargs)
File "C:\Users\Ajit\Anaconda3\lib\subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\Ajit\Anaconda3\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\Users\Ajit\Anaconda3\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
>>>
I performed a controlled experiment, in which I gave the following Python commands:
from brian2 import *
import brian2genn
set_device('genn')
prefs.codegen.cpp.msvc_vars_location = 'C:\\Program Files (x86)\\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat'
start_scope()
tau = 10*ms
eqs = '''
dv/dt = (1-v)/tau : 1 (unless refractory)
'''
G = NeuronGroup(1, eqs, threshold='v>0.8', reset='v = 0', refractory=5*ms, method='exact')
statemon = StateMonitor(G, 'v', record=0)
spikemon = SpikeMonitor(G)
run(50*ms)
. . . in each of the following environments:
In every case, I got the "FileNotFoundError" indicated earlier in this thread. However, in every case, a GeNNworkspace directory was created - the JupyterLab run just put that directory in a different place.
But if I "cd" into this resulting GeNNworkspace
directory for any of the three alternatives described above, and give the following commands:
"C:\\Program Files (x86)\\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
genn-buildmodel magicnetwork_model.cpp
nmake /f WINmakefile clean && nmake /f WINmakefile
.\main.exe test 0.01 1
. . . everything runs properly with the following final output:
# DT 0.000100
# totalTime 0.010000
# We are running with fixed time step 0.000100
0.01 done ...
everything finished.
So it looks like the GeNNworkspace directory is being created properly, but something chokes after that step.
I am sorry, but it's impossible to tell what's going on from this ... can it be that the path settings that work in your manual tests are lost when the calls are issued from Python? ... @mstimberg , are you back? Any ideas?
BTW: have you set the GENN_PATH and modifications to PATH permanently or only within the particular shell (SET
or SETX
?)
I think we got thrown off by my unforced errors with the Windows PATH. Once I rebuilt my machine and set up GENN_PATH, CUDA_PATH, adding %GENN_PATH%\lib\bin and the path to vcvarsall.bat in the system (rather than user) environment variables, we reached the crux of the problem.
It seems GeNN works in two steps: first it builds GeNNworkspace (and contents). Second, it uses that workspace to build the final solution.
I think the first step is solid - it works in all three environments to properly build GeNNworkspace, since I can manually finish the job successfully. So the issue seems to be the automation of the following:
"C:\\Program Files (x86)\\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
genn-buildmodel magicnetwork_model.cpp
nmake /f WINmakefile clean && nmake /f WINmakefile
.\main.exe test 0.01 1
Hi, I'm back :) I had a quick look at the discussion, and I don't see anything obvious for now. However, Brian2GeNN is hiding all output from GeNN by default which makes things much harder to debug. @swami74: could you replace set_device('genn')
by set_device('genn', debug=True)
in your minimal example? This should make it clearer where the error occurs.
Hi Marcel: I turned on debug as you suggested, and gave the following input:
from brian2 import *
import brian2genn
set_device('genn', debug=True)
prefs.codegen.cpp.msvc_vars_location = 'C:\\Program Files (x86)\\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat'
start_scope()
tau = 10*ms
eqs = '''
dv/dt = (1-v)/tau : 1 (unless refractory)
'''
G = NeuronGroup(1, eqs, threshold='v>0.8', reset='v = 0', refractory=5*ms, method='exact')
statemon = StateMonitor(G, 'v', record=0)
spikemon = SpikeMonitor(G)
run(50*ms)
This yielded the following trace:
INFO The following preferences have been changed for Brian2GeNN, reset them manually if you use a different device later in the same script: codegen.loop_invariant_optimisations, core.network.default_schedule [brian2.devices.genn]
running brian code generation ...
building genn executable ...
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-1-fe1476121a2d> in <module>
15 spikemon = SpikeMonitor(G)
16
---> 17 run(50*ms)
~\Anaconda3\lib\site-packages\brian2\units\fundamentalunits.py in new_f(*args, **kwds)
2373 get_dimensions(newkeyset[k]))
2374
-> 2375 result = f(*args, **kwds)
2376 if 'result' in au:
2377 if au['result'] == bool:
~\Anaconda3\lib\site-packages\brian2\core\magic.py in run(duration, report, report_period, namespace, profile, level)
369 '''
370 return magic_network.run(duration, report=report, report_period=report_period,
--> 371 namespace=namespace, profile=profile, level=2+level)
372 run.__module__ = __name__
373
~\Anaconda3\lib\site-packages\brian2\core\magic.py in run(self, duration, report, report_period, namespace, profile, level)
229 self._update_magic_objects(level=level+1)
230 Network.run(self, duration, report=report, report_period=report_period,
--> 231 namespace=namespace, profile=profile, level=level+1)
232
233 def store(self, name='default', filename=None, level=0):
~\Anaconda3\lib\site-packages\brian2\core\base.py in device_override_decorated_function(*args, **kwds)
272 curdev = get_device()
273 if hasattr(curdev, name):
--> 274 return getattr(curdev, name)(*args, **kwds)
275 else:
276 return func(*args, **kwds)
~\Anaconda3\lib\site-packages\brian2genn\device.py in network_run(self, net, duration, report, report_period, namespace, profile, level, **kwds)
1632 report_period=report_period,
1633 namespace=namespace,
-> 1634 level=level + 1)
1635 self.run_statement_used = True
1636
~\Anaconda3\lib\site-packages\brian2\devices\cpp_standalone\device.py in network_run(self, net, duration, report, report_period, namespace, profile, level, **kwds)
1374 'device.build call to use multiple run '
1375 'statements with this device.')
-> 1376 self.build(direct_call=False, **self.build_options)
1377
1378 def network_store(self, net, *args, **kwds):
~\Anaconda3\lib\site-packages\brian2genn\device.py in build(self, directory, compile, run, use_GPU, debug, with_output, direct_call)
780 if compile:
781 try:
--> 782 self.compile_source(debug, directory, use_GPU)
783 except CalledProcessError as ex:
784 raise RuntimeError(('Project compilation failed (Command {cmd} '
~\Anaconda3\lib\site-packages\brian2genn\device.py in compile_source(self, debug, directory, use_GPU)
992 cmd += ' -c'
993 cmd += ' && nmake /f WINmakefile clean && nmake /f WINmakefile'
--> 994 check_call(cmd.format(genn_path=genn_path), cwd=directory, env=env)
995 else:
996 buildmodel_cmd = os.path.join(genn_path, 'lib', 'bin', 'genn-buildmodel.sh')
~\Anaconda3\lib\subprocess.py in check_call(*popenargs, **kwargs)
284 check_call(["ls", "-l"])
285 """
--> 286 retcode = call(*popenargs, **kwargs)
287 if retcode:
288 cmd = kwargs.get("args")
~\Anaconda3\lib\subprocess.py in call(timeout, *popenargs, **kwargs)
265 retcode = call(["ls", "-l"])
266 """
--> 267 with Popen(*popenargs, **kwargs) as p:
268 try:
269 return p.wait(timeout=timeout)
~\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors)
707 c2pread, c2pwrite,
708 errread, errwrite,
--> 709 restore_signals, start_new_session)
710 except:
711 # Cleanup if the child failed starting.
~\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
995 env,
996 os.fspath(cwd) if cwd is not None else None,
--> 997 startupinfo)
998 finally:
999 # Child is launched. Close the parent's copy of those pipe
FileNotFoundError: [WinError 2] The system cannot find the file specified
... and what can you find in the stderr and stdout dumps?
Sorry about that . . . debug file attached. brian_debug_situc4rw.log
PS: I re-ran the test and attached the debug file for that new run. The corresponding screen trace is as follows:
INFO The following preferences have been changed for Brian2GeNN, reset them manually if you use a different device later in the same script: codegen.loop_invariant_optimisations, core.network.default_schedule [brian2.devices.genn]
running brian code generation ...
building genn executable ...
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-1-fe1476121a2d> in <module>
15 spikemon = SpikeMonitor(G)
16
---> 17 run(50*ms)
~\Anaconda3\lib\site-packages\brian2\units\fundamentalunits.py in new_f(*args, **kwds)
2373 get_dimensions(newkeyset[k]))
2374
-> 2375 result = f(*args, **kwds)
2376 if 'result' in au:
2377 if au['result'] == bool:
~\Anaconda3\lib\site-packages\brian2\core\magic.py in run(duration, report, report_period, namespace, profile, level)
369 '''
370 return magic_network.run(duration, report=report, report_period=report_period,
--> 371 namespace=namespace, profile=profile, level=2+level)
372 run.__module__ = __name__
373
~\Anaconda3\lib\site-packages\brian2\core\magic.py in run(self, duration, report, report_period, namespace, profile, level)
229 self._update_magic_objects(level=level+1)
230 Network.run(self, duration, report=report, report_period=report_period,
--> 231 namespace=namespace, profile=profile, level=level+1)
232
233 def store(self, name='default', filename=None, level=0):
~\Anaconda3\lib\site-packages\brian2\core\base.py in device_override_decorated_function(*args, **kwds)
272 curdev = get_device()
273 if hasattr(curdev, name):
--> 274 return getattr(curdev, name)(*args, **kwds)
275 else:
276 return func(*args, **kwds)
~\Anaconda3\lib\site-packages\brian2genn\device.py in network_run(self, net, duration, report, report_period, namespace, profile, level, **kwds)
1632 report_period=report_period,
1633 namespace=namespace,
-> 1634 level=level + 1)
1635 self.run_statement_used = True
1636
~\Anaconda3\lib\site-packages\brian2\devices\cpp_standalone\device.py in network_run(self, net, duration, report, report_period, namespace, profile, level, **kwds)
1374 'device.build call to use multiple run '
1375 'statements with this device.')
-> 1376 self.build(direct_call=False, **self.build_options)
1377
1378 def network_store(self, net, *args, **kwds):
~\Anaconda3\lib\site-packages\brian2genn\device.py in build(self, directory, compile, run, use_GPU, debug, with_output, direct_call)
780 if compile:
781 try:
--> 782 self.compile_source(debug, directory, use_GPU)
783 except CalledProcessError as ex:
784 raise RuntimeError(('Project compilation failed (Command {cmd} '
~\Anaconda3\lib\site-packages\brian2genn\device.py in compile_source(self, debug, directory, use_GPU)
992 cmd += ' -c'
993 cmd += ' && nmake /f WINmakefile clean && nmake /f WINmakefile'
--> 994 check_call(cmd.format(genn_path=genn_path), cwd=directory, env=env)
995 else:
996 buildmodel_cmd = os.path.join(genn_path, 'lib', 'bin', 'genn-buildmodel.sh')
~\Anaconda3\lib\subprocess.py in check_call(*popenargs, **kwargs)
284 check_call(["ls", "-l"])
285 """
--> 286 retcode = call(*popenargs, **kwargs)
287 if retcode:
288 cmd = kwargs.get("args")
~\Anaconda3\lib\subprocess.py in call(timeout, *popenargs, **kwargs)
265 retcode = call(["ls", "-l"])
266 """
--> 267 with Popen(*popenargs, **kwargs) as p:
268 try:
269 return p.wait(timeout=timeout)
~\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors)
707 c2pread, c2pwrite,
708 errread, errwrite,
--> 709 restore_signals, start_new_session)
710 except:
711 # Cleanup if the child failed starting.
~\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
995 env,
996 os.fspath(cwd) if cwd is not None else None,
--> 997 startupinfo)
998 finally:
999 # Child is launched. Close the parent's copy of those pipe
FileNotFoundError: [WinError 2] The system cannot find the file specified
Hmm, this is still quite mysterious to me... Given that the last output is "building genn executable ...", I think the process is failing within genn-buildmodel.bat
. Could you change the @echo off
at the top of that file (should be C:\genn\genn-3.3.0\lib\bin\genn-buildmodel.bat
) to @echo on
? This might give us more information on where it fails exactly.
Hi Marcel: I did that. The resulting brian_debug. . . file is attached, and the screen trace is as follows:
INFO The following preferences have been changed for Brian2GeNN, reset them manually if you use a different device later in the same script: codegen.loop_invariant_optimisations, core.network.default_schedule [brian2.devices.genn]
running brian code generation ...
building genn executable ...
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-1-fe1476121a2d> in <module>
15 spikemon = SpikeMonitor(G)
16
---> 17 run(50*ms)
~\Anaconda3\lib\site-packages\brian2\units\fundamentalunits.py in new_f(*args, **kwds)
2373 get_dimensions(newkeyset[k]))
2374
-> 2375 result = f(*args, **kwds)
2376 if 'result' in au:
2377 if au['result'] == bool:
~\Anaconda3\lib\site-packages\brian2\core\magic.py in run(duration, report, report_period, namespace, profile, level)
369 '''
370 return magic_network.run(duration, report=report, report_period=report_period,
--> 371 namespace=namespace, profile=profile, level=2+level)
372 run.__module__ = __name__
373
~\Anaconda3\lib\site-packages\brian2\core\magic.py in run(self, duration, report, report_period, namespace, profile, level)
229 self._update_magic_objects(level=level+1)
230 Network.run(self, duration, report=report, report_period=report_period,
--> 231 namespace=namespace, profile=profile, level=level+1)
232
233 def store(self, name='default', filename=None, level=0):
~\Anaconda3\lib\site-packages\brian2\core\base.py in device_override_decorated_function(*args, **kwds)
272 curdev = get_device()
273 if hasattr(curdev, name):
--> 274 return getattr(curdev, name)(*args, **kwds)
275 else:
276 return func(*args, **kwds)
~\Anaconda3\lib\site-packages\brian2genn\device.py in network_run(self, net, duration, report, report_period, namespace, profile, level, **kwds)
1632 report_period=report_period,
1633 namespace=namespace,
-> 1634 level=level + 1)
1635 self.run_statement_used = True
1636
~\Anaconda3\lib\site-packages\brian2\devices\cpp_standalone\device.py in network_run(self, net, duration, report, report_period, namespace, profile, level, **kwds)
1374 'device.build call to use multiple run '
1375 'statements with this device.')
-> 1376 self.build(direct_call=False, **self.build_options)
1377
1378 def network_store(self, net, *args, **kwds):
~\Anaconda3\lib\site-packages\brian2genn\device.py in build(self, directory, compile, run, use_GPU, debug, with_output, direct_call)
780 if compile:
781 try:
--> 782 self.compile_source(debug, directory, use_GPU)
783 except CalledProcessError as ex:
784 raise RuntimeError(('Project compilation failed (Command {cmd} '
~\Anaconda3\lib\site-packages\brian2genn\device.py in compile_source(self, debug, directory, use_GPU)
992 cmd += ' -c'
993 cmd += ' && nmake /f WINmakefile clean && nmake /f WINmakefile'
--> 994 check_call(cmd.format(genn_path=genn_path), cwd=directory, env=env)
995 else:
996 buildmodel_cmd = os.path.join(genn_path, 'lib', 'bin', 'genn-buildmodel.sh')
~\Anaconda3\lib\subprocess.py in check_call(*popenargs, **kwargs)
284 check_call(["ls", "-l"])
285 """
--> 286 retcode = call(*popenargs, **kwargs)
287 if retcode:
288 cmd = kwargs.get("args")
~\Anaconda3\lib\subprocess.py in call(timeout, *popenargs, **kwargs)
265 retcode = call(["ls", "-l"])
266 """
--> 267 with Popen(*popenargs, **kwargs) as p:
268 try:
269 return p.wait(timeout=timeout)
~\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors)
707 c2pread, c2pwrite,
708 errread, errwrite,
--> 709 restore_signals, start_new_session)
710 except:
711 # Cleanup if the child failed starting.
~\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
995 env,
996 os.fspath(cwd) if cwd is not None else None,
--> 997 startupinfo)
998 finally:
999 # Child is launched. Close the parent's copy of those pipe
FileNotFoundError: [WinError 2] The system cannot find the file specified
Actually I just realized that the "building genn executable" is coming from Brian2GeNN and not from GeNN, you are therefore not getting any output at all, so it could be already the vcvarsall.bat
call that fails.
Uh, is this your actual definition of the preference?
prefs.codegen.cpp.msvc_vars_location = 'C:\\Program Files (x86)\\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat'
The latter backslashes are not correctly escaped:
>>> print('C:\\Program Files (x86)\\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat')
C:\Program Files (x86)\Microsoft Visual Studio�7\Community\VC\Auxiliary\Buildcvarsall.bat
Occam's razor strikes again. In any case, I fixed the preference definition, after which I no longer get the error messages. So I added plotting code and ran the following experiment:
from brian2 import *
import brian2genn
set_device('genn', debug=True)
prefs.codegen.cpp.msvc_vars_location = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat'
start_scope()
tau = 10*ms
eqs = '''
dv/dt = (1-v)/tau : 1 (unless refractory)
'''
G = NeuronGroup(1, eqs, threshold='v>0.8', reset='v = 0', refractory=5*ms, method='exact')
statemon = StateMonitor(G, 'v', record=0)
spikemon = SpikeMonitor(G)
run(50*ms)
plot(statemon.t/ms, statemon.v[0])
for t in spikemon.t:
axvline(t/ms, ls='--', c='C1', lw=3)
xlabel('Time (ms)')
ylabel('v');
Now I see the following output, but (even after 15 minutes) no plot:
INFO The following preferences have been changed for Brian2GeNN, reset them manually if you use a different device later in the same script: codegen.loop_invariant_optimisations, core.network.default_schedule [brian2.devices.genn]
running brian code generation ...
building genn executable ...
executing genn binary on GPU ...
Uhm ... include show()
at the end of your script?
Right then - I am now able to run my trivial examples end-to-end both with (+GeNN) and without (Brian2 only) a GPU engaged. Thank you Thomas and Marcel for your patience with this Brian2 neophyte.
Glad everything works now, and happy that there is no fix for Windows builds needed from our side :smile:
Hi: I installed Brian2, GeNN and Brian2GeNN per the instructions (Windows10-Pro machine, CUDA 10.1, Visual Studio 19, 17, 15 installed), and tried to run the following:
This gives the following error messages - can you help me understand the root cause, and how to fix it?