Code generation

Brian has support for automatic generation of C code, detailed in Compiled code. We also have experimental support for C code generation more widely, implementing the algorithms described in Goodman (2010). This support can be activated using the usecodegen*, usenewpropagate and usecstdp global preferences (see Preferences).

Note that not all code will run without problems using code generation yet, but in most cases it will and speed improvements can be very substantial, especially for STDP.


  • Goodman DFM (2010). Code Generation: A Strategy for Neural Network Simulators. Neuroinformatics 8, no. 3 (9). doi:10.1007/s12021-010-9082-x. [pdf]