| Literature DB >> 24672470 |
Yury V Zaytsev1, Abigail Morrison2.
Abstract
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.Entities:
Keywords: HPC; Python language; maintainability; neural simulator; technical debt
Year: 2014 PMID: 24672470 PMCID: PMC3953856 DOI: 10.3389/fninf.2014.00023
Source DB: PubMed Journal: Front Neuroinform ISSN: 1662-5196 Impact factor: 4.081
Figure 1Diagram depicting the design of PyNEST, the Python bindings for the NEST simulator. The inner circle represents the NEST simulation kernel and the SLI interpreter. The simulation kernel of NEST uses private SLI data structures (black dot), and many SLI commands are implemented using private NEST simulation kernel APIs (white dot); this non-separation of concerns is discussed in details in the main text. Taken together, however, they effectively constitute a stable high-level public API to the NEST simulator. The first rectangle that encompasses the circle represents PyNEST low-level (private) API, previously implemented in C++ and now re-written in Cython. This API provides three primitives to control the SLI interpreter: a primitive to feed a string as a command for the SLI interpreter to run, and two primitives to push objects on the stack and pop objects off the stack. The outer rectangle illustrates PyNEST high-level (public) API, implemented in pure Python. This high-level API uses the low-level API to provide a “pythonic” interface to the functionality of NEST, such as the creation of neurons, wiring routines, etc.
Comparison of execution timings of low-level API primitives in PyNEST and CyNEST.
| sli_run() | 18 | 24 |
| sli_push() | 0.25 | 0.5 |
| sli_pop() | 0.15 | 0.4 |
For the .
Simplified Hill-Tononi model as a benchmark for PyNEST and CyNEST.
| sli_run() | 38947 | 6 | 0.2 |
| sli_push() | 40484 | 0.25 | 0.01 |
| sli_pop() | 74497 | 0.25 | 0.02 |
The table contains the number of invocations of each of the three low-level API primitives, slowdown per invocation per primitive (see Table .
The runtime and memory consumption measurements performed on the untraced version of the simplified Hill-Tononi model using single-threaded simulation on the hardware/software setup described in the main text.
| PyNEST | 64.8 | 63.8 | 66.9 |
| CyNEST | 66.1 | 65.5 | 71.6 |
| PyNEST | 327 | 327 | 328 |
| CyNEST | 329 | 329 | 329 |
The runtime (which includes the collection of the results and the production of the graphics) was obtained using the shell .