This code can be used to compare the performance of Neurodriver and Brian2GeNN when both are used to simulate a network of randomly connected Leaky IAF neurons connected by alpha function synapses, where all neurons and synapses are configured identically and a subset of the neurons are provided with a constant current input for the duration of the simulation.
To make the comparison as fair as possible, the following methodology is employed:
- The execution time of the Brian2GeNN simulation measures the duration of
both the call to the
brian2.core.magic.run()
method and the call tobrian2.devices.device.CurrentDeviceProxy.build()
because Brian2GeNN cannot currently reuse generated code in a new simulation run. Output generated by the generated GeNN binary is saved to disk and loaded into Brian data structures after it finishes running. - Since the constant input to the Neurodriver simulation is copied into
the requisite variables at every step of the simulation, the constant input
to the Brian2GeNN simulation is set at every execution step via
brian2.NeuronGroup.run_regularly()
(Brian2 timed arrays are currently not supported by Brian2GeNN). - Spike states generated during each run step of the Neurodriver simulation are copied to host memory after each step. States are saved to pagelocked memory to accelerate this copy operation.
- The execution time of the Neurodriver simulation measures the duration of the simulation's entire run loop; this excludes initialization of variables used during the simulation and saving of the output to disk at the end of the run loop, but includes copying of the generated spike states to host memory described above.
- Simulation duration: 3 s
- Time resolution: 1e-4 s
- Brian2: 71f1274
- Brian2GeNN: a00d759
- GeNN: 0cb5825
- Matplotlib
- Neurodriver: 3a00ff0
- Neurokernel: e8fec4b
- Neurokernel dependencies
- Python 2.7
- sarge
- Run
python run_brian2genn.py > brian2genn.log
to generate benchmarks for the Brian2GeNN simulation. Repeat several times using different output files that matchbrian2genn*.log
. - Run
python run_neurodriver.py > neurodriver.log
to generate benchmarks for the Neurodriver simulation. Repeat several times using different output files that matchneurodriver*.log
. - Run
python plot_benchmark.py
to generate a plot comparing the benchmarks.
It may be necessary to patch GeNN to run the benchmarks on certain GPUs.
See the included AUTHORS file for more information.
All files that make use of Brain2GeNN are licensed under the GPLv2 license. All files that make use of Neurodriver and Neurokernel are licensed under the BSD License. See the included LICENSE file for more information.