Modeling with Perl and PDL: Dead End

During the last several weeks I've been working on implementing a simulation of a simple network based on the simple model of spiking neurons. As I am very familiar with Perl I decided to try to use Perl and the Perl Data Language (PDL) module, which provides capabilities similar to those of MATLAB and IDL. The PDL module supports efficient and compact storage of multidimensional arrays and provides the fundamental operation of numerical linear algebra.

Much to my disappointment, the code that I wrote runs too slow. I'm sure that there are many ways to improve my PDL code (it's my first PDL script), which may significantly increase its performance, but still, it took more than 4 minutes (265 seconds) to simulate 400ms of model time for the network of randomly connected 1000 neurons with 28 spikes per neuron per second. It took 18 seconds to simulate 100ms of model time for 1000 neurons and 189 seconds to simulate 1s of model time for 100 neurons, which means that the implementation doesn't scale well when the number of neurons or the simulation time increases.

To compare these numbers with the performance of the simulation written in C or C++ I downloaded the source code of the program written by Eugene Izhikevich for his model and available on his website. His program compiled under CygWin calculated 1s of model time in less than a second of real time for a network with 1000 neurons with ~10 spikes per neuron per second. Even though two programs implement slightly different models (the C++ code implements the model with 4 parameters covered here and my code implements the model with 7 parameters covered here) and have different number of connections per neuron (100 for Eugene's implementation and 1000 in my implementation), the C code also implements axonal conduction delays and spike-timing-dependent plasticity (STDP), which are not included in my implementation.

This difference of two orders of magnitude means that I'll stay with C++ for now. And, BTW, here is the perl script I was running.

Leave a comment

what will you say?
(required)
(required)
Close