Illegal instruction error

This is the error message:
slurm_script: line 7: 40572 Illegal instruction ipython example.py

This issue happens at:
synapse.connect(condition=‘i!=j’, p=‘exp(-((x_pre-x_post)**2 + (y_pre-y_post)*2)/(2(sigma)**2))’, skip_if_invalid=True, namespace={‘sigma’:self.sigma_e2e})

What is strange is that this error only show up in some machines but works fine on other machine. It’s not a cross-platform issue because I build the Brian in the problematic machine.

This is unlikely a brian2 issue, but it would be appreciated if could provide some clue on where the source could be.

What compiler are you using? It could be that it is simply an issue with the compiler options, but normally our options (e.g. -march=native) should be safe… But maybe try unsetting prefs.codegen.extra_compile_args_gcc (docs) and see whether it helps.

I’m using gcc. The same code works fine in standalone mode though. It only happen when running in a non-compiled mode.

I tried to add Preference codegen.extra_compile_args_gcc = ’ ', but it has the error:

Preference codegen.extra_compile_args_gcc is unregistered. Spelling error?

Thanks
–Wei

It will use Cython (which generates C++), so it will still compile it. I don’t think you can get an illegal instruction error without compilation (to try you could set prefs.codegen.target = 'numpy').

Sorry about the preference name, I forgot the cpp. Try:

prefs.codegen.cpp.extra_compile_args_gcc = []

(it needs to be a list of options).

Great! The command prefs.codegen.target = ‘numpy’ solved the problem. Could you please explain a little the reason?

Thanks
–Wei

If you use prefs.codegen.target = 'numpy' it means that it does not compile any C++ code, it only uses Python. The advantage is that it is quicker to start the simulation (because it doesn’t have to compile anything), but the disadvantage is that simulations are slower, typically by about a factor of 2.

I see. Thanks for the help!
–Wei