Simulation Laboratory Neuroscience - Bernstein Facility for Simulation and Database Technology, Institute for Advanced Simulation, Jülich Aachen Research Alliance, Jülich Research Center Jülich, Germany ; Faculty of Biology, Albert-Ludwig University of Freiburg Freiburg im Breisgau, Germany.
Simulation Laboratory Neuroscience - Bernstein Facility for Simulation and Database Technology, Institute for Advanced Simulation, Jülich Aachen Research Alliance, Jülich Research Center Jülich, Germany ; Institute for Advanced Simulation (IAS-6), Theoretical Neuroscience and Institute of Neuroscience and Medicine (INM-6), Computational and Systems Neuroscience, Jülich Research Center and JARA Jülich, Germany ; Institute of Cognitive Neuroscience, Faculty of Psychology, Ruhr-University Bochum Bochum, Germany.
Front Neuroinform. 2014 Mar 14;8:23. doi: 10.3389/fninf.2014.00023. eCollection 2014.
NEST is a simulator for large-scale networks of spiking point neuron models (Gewaltig and Diesmann, 2007). Originally, simulations were controlled via the Simulation Language Interpreter (SLI), a built-in scripting facility implementing a language derived from PostScript (Adobe Systems, Inc., 1999). The introduction of PyNEST (Eppler et al., 2008), the Python interface for NEST, enabled users to control simulations using Python. As the majority of NEST users found PyNEST easier to use and to combine with other applications, it immediately displaced SLI as the default NEST interface. However, developing and maintaining PyNEST has become increasingly difficult over time. This is partly because adding new features requires writing low-level C++ code intermixed with calls to the Python/C API, which is unrewarding. Moreover, the Python/C API evolves with each new version of Python, which results in a proliferation of version-dependent code branches. In this contribution we present the re-implementation of PyNEST in the Cython language, a superset of Python that additionally supports the declaration of C/C++ types for variables and class attributes, and provides a convenient foreign function interface (FFI) for invoking C/C++ routines (Behnel et al., 2011). Code generation via Cython allows the production of smaller and more maintainable bindings, including increased compatibility with all supported Python releases without additional burden for NEST developers. Furthermore, this novel approach opens up the possibility to support alternative implementations of the Python language at no cost given a functional Cython back-end for the corresponding implementation, and also enables cross-compilation of Python bindings for embedded systems and supercomputers alike.
NEST 是一个用于大规模尖峰神经元模型网络的模拟器(Gewaltig 和 Diesmann,2007)。最初,通过 Simulation Language Interpreter(SLI)来控制模拟,这是一种内置的脚本设施,实现了一种源自 PostScript(Adobe Systems,Inc.,1999)的语言。PyNEST(Eppler 等人,2008)的引入,即 NEST 的 Python 接口,使用户能够使用 Python 来控制模拟。由于大多数 NEST 用户发现 PyNEST 更易于使用并且可以与其他应用程序结合使用,因此它立即取代了 SLI 成为默认的 NEST 接口。然而,随着时间的推移,开发和维护 PyNEST 变得越来越困难。这部分是因为添加新功能需要编写低级 C++代码,并与 Python/C API 进行混合调用,这是没有回报的。此外,Python/C API 随着每个新的 Python 版本而不断发展,这导致了版本相关的代码分支的大量增加。在本贡献中,我们展示了 PyNEST 在 Cython 语言中的重新实现,Cython 是 Python 的超集,它还支持为变量和类属性声明 C/C++类型,并提供了一个方便的外部函数接口(FFI)来调用 C/C++例程(Behnel 等人,2011)。通过 Cython 生成代码允许生成更小、更易于维护的绑定,包括增加对所有受支持的 Python 版本的兼容性,而无需对 NEST 开发人员造成额外负担。此外,这种新方法提供了在有相应的 Cython 后端的情况下支持替代 Python 实现而无需任何成本的可能性,并且还支持用于嵌入式系统和超级计算机的 Python 绑定的交叉编译。