Open aiwenxu opened 2 years ago
Hi @aiwenxu . This seems to be the same issue as #133 , which is unfortunately not yet fixed. The current workaround is to use floating point literals instead of integer literals in equations, e.g. instead of exp(-(V+60)/18)
write exp(-(V+60.0)/18.0)
. I updated the simple_example_HH.py
example in the repository to apply this workaround (https://github.com/brian-team/brian2genn/blob/master/examples/simple_example_HH.py ), it should work now hopefully.
It is working, thank you! I will go ahead and change my old code for it to work with the new version.
Actually, downgrading makes my life a lot easier lol :)
Hello! I tried to run simple_example_HH.py in the examples folder, but have encountered an error. Below is the error message.
All the other scripts in the examples folder seem to work fine, so I am quite confused about this error. It seems to imply that something is wrong with NVCC. I am using brian2 version 2.5.0.3 and pip-installed the master branch of brian2genn. Thanks for your help!
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/aiwenxu/genn/bin/genn-buildmodel.sh', '-i', '/home/aiwenxu/brian2genn/examples:/home/aiwenxu/brian2genn/examples/simple_example_HH:/home/aiwenxu/brian2genn/examples/simple_example_HH/brianlib/randomkit', 'magicnetwork_model.cpp'] make: Entering directory '/home/aiwenxu/genn/src/genn/generator' if [ -w /home/aiwenxu/genn/lib ]; then make -C /home/aiwenxu/genn/src/genn/genn; fi; if [ -w /home/aiwenxu/genn/lib ]; then make -C /home/aiwenxu/genn/src/genn/backends/cuda; fi; make[1]: Entering directory '/home/aiwenxu/genn/src/genn/genn' make[1]: Entering directory '/home/aiwenxu/genn/src/genn/backends/cuda' make[1]: Nothing to be done for 'all'. make[1]: Leaving directory '/home/aiwenxu/genn/src/genn/backends/cuda' make[1]: Nothing to be done for 'all'. make[1]: Leaving directory '/home/aiwenxu/genn/src/genn/genn' mkdir -p /tmp/genn.Phm9ytNk g++ -std=c++11 -Wall -Wpedantic -Wextra -MMD -MP -I/home/aiwenxu/genn/include/genn/genn -I/home/aiwenxu/genn/include/genn/third_party -I/home/aiwenxu/brian2genn/examples -I/home/aiwenxu/brian2genn/examples/simple_example_HH -I/home/aiwenxu/brian2genn/examples/simple_example_HH/brianlib/randomkit -I/home/aiwenxu/genn/include/genn/backends/cuda -DMODEL=\"/tmp/genn.6M02VFbv/magicnetwork_model.cpp\" -DBACKEND_NAMESPACE=CUDA -I"/usr/local/cuda/include" generator.cc -o /tmp/genn.Phm9ytNk/generator -L/home/aiwenxu/genn/lib -lgenn_cuda_backend -lgenn -L"/usr/local/cuda/lib64" -lcuda -lcudart -pthread make: Leaving directory '/home/aiwenxu/genn/src/genn/generator' genn-buildmodel.sh:104: error 50: command failure In file included from /tmp/genn.6M02VFbv/magicnetwork_model.cpp:5, from generator.cc:31: /tmp/genn.6M02VFbv/brianlib/randomkit/randomkit.cc:130:5: warning: ISO C++ forbids converting a string constant to ‘char’ [-Wwrite-strings] 130 | "no error", | ^ ::value, double> ::type ::std::exp (T1)") from a global function("updateNeuronsKernel") is not allowed
~~~~~ /tmp/genn.6M02VFbv/brianlib/randomkit/randomkit.cc:131:5: warning: ISO C++ forbids converting a string constant to ‘char’ [-Wwrite-strings] 131 | "random device unvavailable" | ^~~~~~~~ In file included from /tmp/genn.6M02VFbv/objects.h:6, from /tmp/genn.6M02VFbv/magicnetwork_model.cpp:7, from generator.cc:31: /tmp/genn.6M02VFbv/brianlib/clocks.h:12:3: warning: extra ‘;’ [-Wpedantic] 12 | }; | ^ /tmp/genn.6M02VFbv/brianlib/clocks.h:13:2: warning: extra ‘;’ [-Wpedantic] 13 | }; | ^ /tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(87): error: calling a host function("gnu_cxx::__enable_if<std::is_integer/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(87): error: identifier "std::exp " is undefined in device code
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(87): error: calling a host function("gnu_cxx::__enable_if<std::is_integer ::value, double> ::type ::std::exp (T1)") from a global function("updateNeuronsKernel") is not allowed
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(87): error: identifier "std::exp " is undefined in device code
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(87): error: calling a host function("gnu_cxx::__enable_if<std::is_integer ::value, double> ::type ::std::exp (T1)") from a global function("updateNeuronsKernel") is not allowed
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(87): error: identifier "std::exp " is undefined in device code
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(88): error: calling a host function("gnu_cxx::__enable_if<std::is_integer ::value, double> ::type ::std::exp (T1)") from a global function("updateNeuronsKernel") is not allowed
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(88): error: identifier "std::exp " is undefined in device code
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(88): error: calling a host function("gnu_cxx::__enable_if<std::is_integer ::value, double> ::type ::std::exp (T1)") from a global function("updateNeuronsKernel") is not allowed
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(88): error: identifier "std::exp " is undefined in device code
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(91): error: calling a host function("gnu_cxx::__enable_if<std::is_integer ::value, double> ::type ::std::exp (T1)") from a global function("updateNeuronsKernel") is not allowed
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(91): error: identifier "std::exp " is undefined in device code
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(91): error: calling a host function("gnu_cxx::__enable_if<std::is_integer ::value, double> ::type ::std::exp (T1)") from a global function("updateNeuronsKernel") is not allowed
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(91): error: identifier "std::exp " is undefined in device code
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(91): error: calling a host function("gnu_cxx::__enable_if<std::is_integer ::value, double> ::type ::std::exp (T1)") from a global function("updateNeuronsKernel") is not allowed
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(91): error: identifier "std::exp " is undefined in device code
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(91): error: calling a host function("gnu_cxx::__enable_if<std::is_integer ::value, double> ::type ::std::exp (T1)") from a global function("updateNeuronsKernel") is not allowed
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(91): error: identifier "std::exp " is undefined in device code
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(92): error: calling a host function("gnu_cxx::__enable_if<std::is_integer ::value, double> ::type ::std::exp (T1)") from a global function("updateNeuronsKernel") is not allowed
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(92): error: identifier "std::exp " is undefined in device code
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(92): error: calling a host function("gnu_cxx::__enable_if<std::is_integer ::value, double> ::type ::std::exp (T1)") from a global function("updateNeuronsKernel") is not allowed
/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc(92): error: identifier "std::exp " is undefined in device code
22 errors detected in the compilation of "/tmp/genn.Phm9ytNk/magicnetwork_model_CODE/neuronUpdateCUDAOptim.cc". terminate called after throwing an instance of 'std::runtime_error' what(): optimizeBlockSize: NVCC failed /home/aiwenxu/genn/bin/genn-buildmodel.sh: line 105: 102916 Aborted (core dumped) "$GENERATOR" "$BASEDIR/../" "$OUT_PATH" "$FORCE_REBUILD" 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_p900ap6j.log Additionally, you can also include a copy of the script that was run, available at: /tmp/brian_script_8wgcvv6r.py You can also include a copy of the redirected std stream outputs, available at '/tmp/brian_stdout_e_q1meq6.log' and '/tmp/brian_stderr_qg6iv2nl.log'. Thanks! [brian2] Traceback (most recent call last): File "/home/aiwenxu/brian2genn/brian2genn/device.py", line 878, in build self.compile_source(debug, directory, use_GPU) File "/home/aiwenxu/brian2genn/brian2genn/device.py", line 1165, in compile_source check_call(args, cwd=directory, env=env) File "/home/aiwenxu/miniconda3/lib/python3.9/subprocess.py", line 373, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/home/aiwenxu/genn/bin/genn-buildmodel.sh', '-i', '/home/aiwenxu/brian2genn/examples:/home/aiwenxu/brian2genn/examples/simple_example_HH:/home/aiwenxu/brian2genn/examples/simple_example_HH/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/aiwenxu/brian2genn/examples/simple_example_HH.py", line 23, in
run(500ms)
File "/home/aiwenxu/miniconda3/lib/python3.9/site-packages/brian2/units/fundamentalunits.py", line 2428, in new_f
result = f(args, *kwds)
File "/home/aiwenxu/miniconda3/lib/python3.9/site-packages/brian2/core/magic.py", line 373, in run
return magic_network.run(duration, report=report, report_period=report_period,
File "/home/aiwenxu/miniconda3/lib/python3.9/site-packages/brian2/core/magic.py", line 230, in run
Network.run(self, duration, report=report, report_period=report_period,
File "/home/aiwenxu/miniconda3/lib/python3.9/site-packages/brian2/core/base.py", line 291, in device_override_decorated_function
return getattr(curdev, name)(args, kwds)
File "/home/aiwenxu/brian2genn/brian2genn/device.py", line 1888, in network_run
super(GeNNDevice, self).network_run(net=net, duration=duration,
File "/home/aiwenxu/miniconda3/lib/python3.9/site-packages/brian2/devices/cpp_standalone/device.py", line 1502, in network_run
self.build(direct_call=False, self.build_options)
File "/home/aiwenxu/brian2genn/brian2genn/device.py", line 880, in build
raise RuntimeError(('Project compilation failed (Command {cmd} '
RuntimeError: Project compilation failed (Command ['/home/aiwenxu/genn/bin/genn-buildmodel.sh', '-i', '/home/aiwenxu/brian2genn/examples:/home/aiwenxu/brian2genn/examples/simple_example_HH:/home/aiwenxu/brian2genn/examples/simple_example_HH/brianlib/randomkit', 'magicnetwork_model.cpp'] failed with error code 50).
See the output above (if any) for more details.