brian-team / brian2cuda

A brian2 extension to simulate spiking neural networks on GPUs
https://brian2cuda.readthedocs.io/
GNU General Public License v3.0
60 stars 12 forks source link

Failure on Compile with 'compiler_flags' is undefined #191

Open smestern opened 3 years ago

smestern commented 3 years ago

Hello, When running the examples (or custom code) I seem to run into an issue on compile. The specific error message is ['compiler_flags' is undefined] The long form output is

```python cuba.py WARNING: can't recognize hostname. Compiling with ['-w', '-use_fast_math', '-arch=sm_61'] runing example cuba_cuda_atomics_profiling_no-single-precision_bundle-mode_monitors_N-4000_DESKTOP-E26JBI6 compiling model in code\cuba_cuda_atomics_profiling_no-single-precision_bundle-mode_monitors_N-4000_DESKTOP-E26JBI6 ('debug syn effect mode ', 'target') ('debug syn effect mode ', 'target') 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 , or to the issue tracker at . Please include this file with debug information in your report: c:\users\smest\appdata\local\temp\brian_debug_d57wna.log Additionally, you can also include a copy of the script that was run, available at: c:\users\smest\appdata\local\temp\brian_script_abx5qn.py Thanks! [brian2] Traceback (most recent call last): File "cuba.py", line 128, in run(1 * second, report='text', profile=params['profiling']) File "C:\Users\SMest\Anaconda3\envs\python2\lib\site-packages\brian2\units\fundamentalunits.py", line 2375, in new_f result = f(*args, **kwds) File "C:\Users\SMest\Anaconda3\envs\python2\lib\site-packages\brian2\core\magic.py", line 371, in run namespace=namespace, profile=profile, level=2+level) File "C:\Users\SMest\Anaconda3\envs\python2\lib\site-packages\brian2\core\magic.py", line 231, in run namespace=namespace, profile=profile, level=level+1) File "C:\Users\SMest\Anaconda3\envs\python2\lib\site-packages\brian2\core\base.py", line 274, in device_override_decorated_function return getattr(curdev, name)(*args, **kwds) File "C:\Users\SMest\Anaconda3\envs\python2\lib\site-packages\brian2cuda\device.py", line 1232, in network_run self.build(direct_call=False, **self.build_options) File "C:\Users\SMest\Anaconda3\envs\python2\lib\site-packages\brian2cuda\device.py", line 1028, in build self.generate_makefile(writer, cpp_compiler, cpp_compiler_flags, nb_threads=0, disable_asserts=disable_asserts) File "C:\Users\SMest\Anaconda3\envs\python2\lib\site-packages\brian2cuda\device.py", line 846, in generate_makefile openmp_flag=openmp_flag, File "C:\Users\SMest\Anaconda3\envs\python2\lib\site-packages\brian2\codegen\templates.py", line 203, in __call__ module = self.template.make_module(kwds) File "C:\Users\SMest\Anaconda3\envs\python2\lib\site-packages\jinja2\environment.py", line 1033, in make_module return TemplateModule(self, self.new_context(vars, shared, locals)) File "C:\Users\SMest\Anaconda3\envs\python2\lib\site-packages\jinja2\environment.py", line 1090, in __init__ self._body_stream = list(template.root_render_func(context)) File "C:\Users\SMest\Anaconda3\envs\python2\lib\site-packages\brian2cuda\templates\win_makefile", line 17, in root File "C:\Users\SMest\Anaconda3\envs\python2\lib\site-packages\jinja2\runtime.py", line 489, in _fail_with_undefined_error raise self._undefined_exception(hint) UndefinedError: 'compiler_flags' is undefined ```

I was wondering if you have any insight into this error. I am running on python 2.7 with the frozen brian2 repo (Brian2==2.1.3.1+git) and cuda 11.1

mstimberg commented 3 years ago

Hi. @denisalevi is the mastermind behind Brian2CUDA, so he might correct me on this. As far as I know there hasn't been much testing on Windows (if any), all the development happened on Linux. I think the makefile for Windows is not actually working, see #43. As a quick fix for your specific problem, it will probably go away if you replace compiler_flags by cpp_compiler_flags in this line in the win_makefile template: https://github.com/brian-team/brian2cuda/blob/8a2885d3b404f0c849101d19696fbf7daad74b9f/brian2cuda/templates/win_makefile#L9

But no guarantees that this will make it work...

denisalevi commented 3 years ago

Uhh. Looks like I'm not being notified of new issues 🙈. Changed the notification settings, sorry for the late response.

As @mstimberg mentioned, I haven't worked on Windows support yet at all. I don't know right now if a fix of the makefile is all that's necessary. Could need some more CUDA-related setup (never ran CUDA applications on Windows). This will happen when we are ready for a release. Shouldn't be too long (I have been saying this for too long...).