Unfortunately, after a day of trying, I still didn’t get it to work. There is a big chance this is just because I messed something up with the paths and the files or the way cuda is installed or something like that (I’m new to Linux). However, I cannot figure out what exactly goes wrong so I thought maybe there is a chance you can see right away what goes wrong. I realise this support group is not exactly meant for these types of problems so if you don’t see the problem right away please don’t waste your time on this.
I have the very simple script:
from brian2 import *
import brian2genn
import os
os.environ[‘CUDA_PATH’] = ‘usr/local/cuda’
set_device(‘genn’)
tau = 10*ms
eqs = '''
dv/dt = (1-v)/tau : 1
'''
G = NeuronGroup(1, eqs)
run(100*ms)
and I get this output, error and traceback (sorry it is very long):
runfile('/home/Nina/PycharmProjects/pythonProject/main.py', wdir='/home/Nina/PycharmProjects/pythonProject')
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 ...
INFO No numerical integration method specified for group 'neurongroup', using method 'exact' (took 0.03s). [brian2.stateupdaters.base.method_choice]
building genn executable ...
In file included from /home/Nina/Downloads/genn-4.3.3/include/genn/backends/cuda/optimiser.h:7:0,
['/home/Nina/Downloads/genn-4.3.3/bin/genn-buildmodel.sh', '-i', '/home/Nina/PycharmProjects/pythonProject:/home/Nina/PycharmProjects/pythonProject/GeNNworkspace:/home/Nina/PycharmProjects/pythonProject/GeNNworkspace/brianlib/randomkit', 'magicnetwork_model.cpp']
from optimiser.cc:1:
make: Entering directory `/home/Nina/Downloads/genn-4.3.3/src/genn/generator'
/home/Nina/Downloads/genn-4.3.3/include/genn/backends/cuda/backend.h:13:10: fatal error: cuda.h: No such file or directory
if [ -w /home/Nina/Downloads/genn-4.3.3/lib ]; then make -C /home/Nina/Downloads/genn-4.3.3/src/genn/genn; fi;
#include <cuda.h>
if [ -w /home/Nina/Downloads/genn-4.3.3/lib ]; then make -C /home/Nina/Downloads/genn-4.3.3/src/genn/backends/cuda; fi;
^~~~~~~~
make[1]: Entering directory `/home/Nina/Downloads/genn-4.3.3/src/genn/backends/cuda'
compilation terminated.
mkdir -p /home/Nina/Downloads/genn-4.3.3/obj/genn/backends/cuda
In file included from backend.cc:1:0:
mkdir -p /home/Nina/Downloads/genn-4.3.3/obj/genn/backends/cuda
/home/Nina/Downloads/genn-4.3.3/include/genn/backends/cuda/backend.h:13:10: fatal error: cuda.h: No such file or directory
mkdir -p /home/Nina/Downloads/genn-4.3.3/obj/genn/backends/cuda
#include <cuda.h>
^~~~~~~~
/home/Nina/.conda/envs/brianenv/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/Nina/.conda/envs/brianenv/include -Wall -Wpedantic -Wextra -MMD -MP -I/home/Nina/Downloads/genn-4.3.3/include/genn/genn -I/home/Nina/Downloads/genn-4.3.3/include/genn/third_party -I/home/Nina/PycharmProjects/pythonProject -I/home/Nina/PycharmProjects/pythonProject/GeNNworkspace -I/home/Nina/PycharmProjects/pythonProject/GeNNworkspace/brianlib/randomkit -I/home/Nina/Downloads/genn-4.3.3/include/genn/backends/cuda -DMODEL=\"/home/Nina/PycharmProjects/pythonProject/GeNNworkspace/magicnetwork_model.cpp\" -DBACKEND_NAMESPACE=CUDA -I"usr/local/cuda/include" -Wall -Wpedantic -Wextra -MMD -MP -I/home/Nina/Downloads/genn-4.3.3/include/genn/genn -I/home/Nina/Downloads/genn-4.3.3/include/genn/third_party -I/home/Nina/Downloads/genn-4.3.3/include/genn/backends/cuda -I"usr/local/cuda/include" -c -o /home/Nina/Downloads/genn-4.3.3/obj/genn/backends/cuda/backend.o backend.cc
compilation terminated.
make[1]: *** [/home/Nina/Downloads/genn-4.3.3/obj/genn/backends/cuda/optimiser.o] Error 1
/home/Nina/.conda/envs/brianenv/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/Nina/.conda/envs/brianenv/include -Wall -Wpedantic -Wextra -MMD -MP -I/home/Nina/Downloads/genn-4.3.3/include/genn/genn -I/home/Nina/Downloads/genn-4.3.3/include/genn/third_party -I/home/Nina/PycharmProjects/pythonProject -I/home/Nina/PycharmProjects/pythonProject/GeNNworkspace -I/home/Nina/PycharmProjects/pythonProject/GeNNworkspace/brianlib/randomkit -I/home/Nina/Downloads/genn-4.3.3/include/genn/backends/cuda -DMODEL=\"/home/Nina/PycharmProjects/pythonProject/GeNNworkspace/magicnetwork_model.cpp\" -DBACKEND_NAMESPACE=CUDA -I"usr/local/cuda/include" -Wall -Wpedantic -Wextra -MMD -MP -I/home/Nina/Downloads/genn-4.3.3/include/genn/genn -I/home/Nina/Downloads/genn-4.3.3/include/genn/third_party -I/home/Nina/Downloads/genn-4.3.3/include/genn/backends/cuda -I"usr/local/cuda/include" -c -o /home/Nina/Downloads/genn-4.3.3/obj/genn/backends/cuda/presynapticUpdateStrategy.o presynapticUpdateStrategy.cc
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [/home/Nina/Downloads/genn-4.3.3/obj/genn/backends/cuda/backend.o] Error 1
/home/Nina/.conda/envs/brianenv/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/Nina/.conda/envs/brianenv/include -Wall -Wpedantic -Wextra -MMD -MP -I/home/Nina/Downloads/genn-4.3.3/include/genn/genn -I/home/Nina/Downloads/genn-4.3.3/include/genn/third_party -I/home/Nina/PycharmProjects/pythonProject -I/home/Nina/PycharmProjects/pythonProject/GeNNworkspace -I/home/Nina/PycharmProjects/pythonProject/GeNNworkspace/brianlib/randomkit -I/home/Nina/Downloads/genn-4.3.3/include/genn/backends/cuda -DMODEL=\"/home/Nina/PycharmProjects/pythonProject/GeNNworkspace/magicnetwork_model.cpp\" -DBACKEND_NAMESPACE=CUDA -I"usr/local/cuda/include" -Wall -Wpedantic -Wextra -MMD -MP -I/home/Nina/Downloads/genn-4.3.3/include/genn/genn -I/home/Nina/Downloads/genn-4.3.3/include/genn/third_party -I/home/Nina/Downloads/genn-4.3.3/include/genn/backends/cuda -I"usr/local/cuda/include" -c -o /home/Nina/Downloads/genn-4.3.3/obj/genn/backends/cuda/optimiser.o optimiser.cc
presynapticUpdateStrategy.cc:7:10: fatal error: cuda_runtime.h: No such file or directory
make[1]: Entering directory `/home/Nina/Downloads/genn-4.3.3/src/genn/genn'
#include <cuda_runtime.h>
make[1]: Nothing to be done for `all'.
^~~~~~~~~~~~~~~~
make[1]: Leaving directory `/home/Nina/Downloads/genn-4.3.3/src/genn/genn'
compilation terminated.
make[1]: Leaving directory `/home/Nina/Downloads/genn-4.3.3/src/genn/backends/cuda'
make[1]: *** [/home/Nina/Downloads/genn-4.3.3/obj/genn/backends/cuda/presynapticUpdateStrategy.o] Error 1
make: Leaving directory `/home/Nina/Downloads/genn-4.3.3/src/genn/generator'
make: *** [backend] Error 2
genn-buildmodel.sh:86: error 50: command failure
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_x7lc40qk.log Additionally, you can also include a copy of the script that was run, available at: /tmp/brian_script__0ltb__3.py You can also include a copy of the redirected std stream outputs, available at /tmp/brian_stdout_c1lcmvbt.log and /tmp/brian_stderr_j6mjpq_d.log Thanks! [brian2]
Traceback (most recent call last):
File "/home/Nina/.conda/envs/brianenv/lib/python3.6/site-packages/brian2genn/device.py", line 882, in build
self.compile_source(debug, directory, use_GPU)
File "/home/Nina/.conda/envs/brianenv/lib/python3.6/site-packages/brian2genn/device.py", line 1169, in compile_source
check_call(args, cwd=directory, env=env)
File "/home/Nina/.conda/envs/brianenv/lib/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/Nina/Downloads/genn-4.3.3/bin/genn-buildmodel.sh', '-i', '/home/Nina/PycharmProjects/pythonProject:/home/Nina/PycharmProjects/pythonProject/GeNNworkspace:/home/Nina/PycharmProjects/pythonProject/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 "/home/Nina/.conda/envs/brianenv/lib/python3.6/code.py", line 91, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
File "/home/Nina/Downloads/pycharm-2020.2.3/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/home/Nina/Downloads/pycharm-2020.2.3/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/Nina/PycharmProjects/pythonProject/main.py", line 13, in <module>
run(100*ms)
File "/home/Nina/.conda/envs/brianenv/lib/python3.6/site-packages/brian2/units/fundamentalunits.py", line 2434, in new_f
result = f(*args, **kwds)
File "/home/Nina/.conda/envs/brianenv/lib/python3.6/site-packages/brian2/core/magic.py", line 374, in run
namespace=namespace, profile=profile, level=2+level)
File "/home/Nina/.conda/envs/brianenv/lib/python3.6/site-packages/brian2/core/magic.py", line 232, in run
namespace=namespace, profile=profile, level=level+1)
File "/home/Nina/.conda/envs/brianenv/lib/python3.6/site-packages/brian2/core/base.py", line 276, in device_override_decorated_function
return getattr(curdev, name)(*args, **kwds)
File "/home/Nina/.conda/envs/brianenv/lib/python3.6/site-packages/brian2genn/device.py", line 1825, in network_run
level=level + 1)
File "/home/Nina/.conda/envs/brianenv/lib/python3.6/site-packages/brian2/devices/cpp_standalone/device.py", line 1511, in network_run
self.build(direct_call=False, **self.build_options)
File "/home/Nina/.conda/envs/brianenv/lib/python3.6/site-packages/brian2genn/device.py", line 888, in build
returncode=ex.returncode)
RuntimeError: Project compilation failed (Command ['/home/Nina/Downloads/genn-4.3.3/bin/genn-buildmodel.sh', '-i', '/home/Nina/PycharmProjects/pythonProject:/home/Nina/PycharmProjects/pythonProject/GeNNworkspace:/home/Nina/PycharmProjects/pythonProject/GeNNworkspace/brianlib/randomkit', 'magicnetwork_model.cpp'] failed with error code 50).
See the output above (if any) for more details.
The cuda and genn bin are in the PATH like specified in the brian2genn installation instructions. cuda and genn are installed properly (although I didn’t install cuda myself and it was done some time ago).
It this doesn’t work I’ll probably take your word for it that Brian2Genn will not speed up my script much and just leave it be.