Code Generation: A Strategy for Neural Network Simulators
We demonstrate a technique for the design of neural network simulation software, runtime code generation. This technique can be used to give the user complete flexibility in specifying the mathematical model for their simulation in a high level way, along with the speed of code written in a low level language such as C+ +. It can also be used to write code only once but target different hardware platforms, including inexpensive high performance graphics processing units (GPUs). Code generation can be naturally combined with computer algebra systems to provide further simplification and optimisation of the generated code. The technique is quite general and could be applied to any simulation package. We demonstrate it with the ‘Brian’ simulator (http://www.briansimulator.org).
KeywordsCode generation Spiking neural networks Simulation Graphics processing units Computer algebra systems Numerical integration Python C+ +
The author would like to thank Romain Brette, Cyrille Rossant and Bertrand Fontaine for their work on Brian, testing of code generation, and helpful comments on the manuscript. This work was partially supported by the European Research Council (ERC StG 240132).
- Bower, J. M., & Beeman, D. (1998). The Book of GENESIS: Exploring Realistic Neural Models with the GEneral NEural SImulation System (2nd ed.). New York: Springer-Verlag.Google Scholar
- Carnevale, N. T., & Hines, M. L. (2006). The NEURON Book. Cambridge University Press.Google Scholar
- Garny, A., Nickerson, D. P., Cooper, J., dos Santos, R. W., Miller, A. K., McKeever, S., et al. (2008). CellML and associated tools and techniques. Philosophical Transactions. Series A, Mathematical, Physical, and Engineering Sciences, 366(1878), 3017–3043. PMID: 18579471.CrossRefPubMedGoogle Scholar
- Jones, E., Oliphant, T., Peterson, P., et al. (2001–2005). SciPy: Open source scientific tools for Python. http://www.scipy.org/.
- Klöckner, A., Pinto, N., Lee, Y., Catanzaro, B., Ivanov, P., & Fasih, A. (2009). PyCUDA: GPU Run-Time code generation for High-Performance computing. 0911.3456.Google Scholar
- MacGregor, R. J. (1987). Neural and Brain Modeling. Academic Press.Google Scholar
- Nageswaran, J. M., Dutt, N., Krichmar, J. L., Nicolau, A., & Veidenbaum, A. (2009). Efficient simulation of large-scale spiking neural networks using CUDA graphics processors. In Proceedings of the 2009 international joint conference on neural networks (pp. 3201–3208). Atlanta, USA: IEEE.Google Scholar
- NVIDIA (2009). CUDA programming guide 2.3.Google Scholar
- Oliphant, T. (2006). Guide to NumPy. USA: Trelgol Publishing.Google Scholar
- Rossant, C., Goodman, D. F. M., Platkiewicz, J., & Brette, R. (2010). Automatic fitting of spiking neuron models to electrophysiological recordings. Frontiers in Neuroinformatics. doi: 10.3389/neuro.11.002.2010.
- SymPy Development Team (2009). SymPy: Python library for symbolic mathematics.Google Scholar