-
Notifications
You must be signed in to change notification settings - Fork 17
Description
I was using Brian2GeNN on the example code on GeNN:
from brian2 import *
import brian2genn
set_device('genn', use_GPU=True, debug=False)
prefs.devices.genn.cuda_backend.cuda_path = '/usr/local/cuda'
prefs.devices.genn.path = '/home/rw/SNN/GENN/genn'
n = 1000
duration = 1*second
tau = 10*ms
eqs = '''
dv/dt = (v0 - v) / tau : volt (unless refractory)
v0 : volt
'''
group = NeuronGroup(n, eqs, threshold='v > 10*mV', reset='v = 0*mV',
refractory=5*ms, method='exact')
group.v = 0*mV
group.v0 = '20*mV * i / (n-1)'
monitor = SpikeMonitor(group)
run(duration)
If I set use_GPU=False, then the code would run since it's using CPU. But when I set use_GPU=True, it returned a runtime error.
I noticed one line saying that /home/rw/anaconda3/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -lcuda. It seems that lcuda was missing. Is this the cause?
(base) rw@rw-ubt:~/SNN/T2$ python t2.py
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 ...
['/home/rw/SNN/GENN/genn/bin/genn-buildmodel.sh', '-i', '/home/rw/SNN/T2:/home/rw/SNN/T2/GeNNworkspace:/home/rw/SNN/T2/GeNNworkspace/brianlib/randomkit', 'magicnetwork_model.cpp']
make: Entering directory '/home/rw/SNN/GENN/genn/src/genn/generator'
if [ -w /home/rw/SNN/GENN/genn/lib ]; then make -C /home/rw/SNN/GENN/genn/src/genn/genn; fi;
if [ -w /home/rw/SNN/GENN/genn/lib ]; then make -C /home/rw/SNN/GENN/genn/src/genn/backends/cuda; fi;
make[1]: Entering directory '/home/rw/SNN/GENN/genn/src/genn/genn'
make[1]: Entering directory '/home/rw/SNN/GENN/genn/src/genn/backends/cuda'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/rw/SNN/GENN/genn/src/genn/backends/cuda'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/rw/SNN/GENN/genn/src/genn/genn'
mkdir -p /tmp/genn.UPKaur4P
/home/rw/anaconda3/bin/x86_64-conda_cos6-linux-gnu-c++ -std=c++11 -fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/rw/anaconda3/include -Wall -Wpedantic -Wextra -MMD -MP -I/home/rw/SNN/GENN/genn/include/genn/genn -I/home/rw/SNN/GENN/genn/include/genn/third_party -I/home/rw/SNN/T2 -I/home/rw/SNN/T2/GeNNworkspace -I/home/rw/SNN/T2/GeNNworkspace/brianlib/randomkit -I/home/rw/SNN/GENN/genn/include/genn/backends/cuda -DMODEL="/tmp/genn.cZ5nE9Gx/magicnetwork_model.cpp" -DBACKEND_NAMESPACE=CUDA -I"/usr/local/cuda/include" generator.cc -o /tmp/genn.UPKaur4P/generator -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/home/rw/anaconda3/lib -Wl,-rpath-link,/home/rw/anaconda3/lib -L/home/rw/anaconda3/lib -L/home/rw/SNN/GENN/genn/lib -lgenn_cuda_backend -lgenn -L"/usr/local/cuda/lib64" -lcuda -lcudart -pthread
make: Leaving directory '/home/rw/SNN/GENN/genn/src/genn/generator'
genn-buildmodel.sh:93: error 50: command failure
In file included from /tmp/genn.cZ5nE9Gx/magicnetwork_model.cpp:5:0,
from generator.cc:31:
/tmp/genn.cZ5nE9Gx/brianlib/randomkit/randomkit.cc:132:1: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
};
^
/tmp/genn.cZ5nE9Gx/brianlib/randomkit/randomkit.cc:132:1: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
In file included from /tmp/genn.cZ5nE9Gx/objects.h:6:0,
from /tmp/genn.cZ5nE9Gx/magicnetwork_model.cpp:7,
from generator.cc:31:
/tmp/genn.cZ5nE9Gx/brianlib/clocks.h:12:3: warning: extra ';' [-Wpedantic]
};
^
/tmp/genn.cZ5nE9Gx/brianlib/clocks.h:13:2: warning: extra ';' [-Wpedantic]
};
^
In file included from /tmp/genn.cZ5nE9Gx/magicnetwork_model.cpp:13:0,
from generator.cc:31:
/tmp/genn.cZ5nE9Gx/code_objects/neurongroup_group_variable_set_conditional_codeobject.cpp: In function 'void _run_neurongroup_group_variable_set_conditional_codeobject()':
/tmp/genn.cZ5nE9Gx/code_objects/neurongroup_group_variable_set_conditional_codeobject.cpp:105:18: warning: unused variable '_vectorisation_idx' [-Wunused-variable]
const size_t _vectorisation_idx = _idx;
^~~~~~~~~~~~~~~~~~
/tmp/genn.cZ5nE9Gx/code_objects/neurongroup_group_variable_set_conditional_codeobject.cpp:83:15: warning: unused variable '_numv0' [-Wunused-variable]
const int _numv0 = 1000;
^~~~~~
/tmp/genn.cZ5nE9Gx/code_objects/neurongroup_group_variable_set_conditional_codeobject.cpp:84:11: warning: unused variable '_numi' [-Wunused-variable]
const int _numi = 1000;
^~~~~
/tmp/genn.cZ5nE9Gx/code_objects/neurongroup_group_variable_set_conditional_codeobject.cpp:93:14: warning: unused variable '_vectorisation_idx' [-Wunused-variable]
const size_t _vectorisation_idx = -1;
^~~~~~~~~~~~~~~~~~
/home/rw/anaconda3/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -lcuda
collect2: error: ld returned 1 exit status
make: *** [MakefileCommon:41: /tmp/genn.UPKaur4P/generator] Error 1
ERROR Brian 2 encountered an unexpected error. If you think this is a bug in Brian 2, please report this issue either to the discourse forum at http://brian.discourse.group/, or to the issue tracker at https://github.com/brian-team/brian2/issues. Please include this file with debug information in your report: /tmp/brian_debug_k_dg6o42.log Additionally, you can also include a copy of the script that was run, available at: /tmp/brian_script_5qtmy7cw.py You can also include a copy of the redirected std stream outputs, available at /tmp/brian_stdout_vv3yvqed.log and /tmp/brian_stderr_ki4egz78.log Thanks! [brian2]
Traceback (most recent call last):
File "/home/rw/anaconda3/lib/python3.8/site-packages/brian2genn/device.py", line 882, in build
self.compile_source(debug, directory, use_GPU)
File "/home/rw/anaconda3/lib/python3.8/site-packages/brian2genn/device.py", line 1169, in compile_source
check_call(args, cwd=directory, env=env)
File "/home/rw/anaconda3/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/rw/SNN/GENN/genn/bin/genn-buildmodel.sh', '-i', '/home/rw/SNN/T2:/home/rw/SNN/T2/GeNNworkspace:/home/rw/SNN/T2/GeNNworkspace/brianlib/randomkit', 'magicnetwork_model.cpp']' returned non-zero exit status 50.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "t2.py", line 20, in
run(duration)
File "/home/rw/anaconda3/lib/python3.8/site-packages/brian2/units/fundamentalunits.py", line 2434, in new_f
result = f(*args, **kwds)
File "/home/rw/anaconda3/lib/python3.8/site-packages/brian2/core/magic.py", line 373, in run
return magic_network.run(duration, report=report, report_period=report_period,
File "/home/rw/anaconda3/lib/python3.8/site-packages/brian2/core/magic.py", line 231, in run
Network.run(self, duration, report=report, report_period=report_period,
File "/home/rw/anaconda3/lib/python3.8/site-packages/brian2/core/base.py", line 276, in device_override_decorated_function
return getattr(curdev, name)(*args, **kwds)
File "/home/rw/anaconda3/lib/python3.8/site-packages/brian2genn/device.py", line 1821, in network_run
super(GeNNDevice, self).network_run(net=net, duration=duration,
File "/home/rw/anaconda3/lib/python3.8/site-packages/brian2/devices/cpp_standalone/device.py", line 1511, in network_run
self.build(direct_call=False, **self.build_options)
File "/home/rw/anaconda3/lib/python3.8/site-packages/brian2genn/device.py", line 884, in build
raise RuntimeError(('Project compilation failed (Command {cmd} '
RuntimeError: Project compilation failed (Command ['/home/rw/SNN/GENN/genn/bin/genn-buildmodel.sh', '-i', '/home/rw/SNN/T2:/home/rw/SNN/T2/GeNNworkspace:/home/rw/SNN/T2/GeNNworkspace/brianlib/randomkit', 'magicnetwork_model.cpp'] failed with error code 50).
See the output above (if any) for more details.