CARLsim  5.0.0
CARLsim: a GPU-accelerated SNN simulator
Chapter 14: pyCARL

14.1 Pre-Installation

Author
Adarsha Balaji

pyCARL is an interface between a pyNN front-end and a CARLsim back-end.

pyCARL requires the installation of pyNN and CARLsim and runs on generic x86 CPUs.

pyCARL works with Python2.x and Python3.x.

The rest of the chapter discusses the steps required to install pyCARL and its dependencies, and the funcitonalities and APIs supported by pyCARL.

14.1.1 Supported Operating Systems

pyCARL has been tested on the following platforms:

  • Ubuntu 16.04

14.2 Installation

Author
Adarsha Balaji

pyCARL is available as a part of the CARLsim repository in Github.

14.2.1 Installing PyNN

You may install pyNN using the following command:

$ pip install pyNN

or, you may follow the installation instructions at pyNN.

14.2.2 Installation pyCARL

PyCARL is a PyNN-based common Python programming interface that integrates a pyNN front-end to a CARLsim back-end.

Clone and install the latest development version of CARLsim5.

$ git clone --recursive https://github.com/UCI-CARL/CARLsim5.git
$ cd CARLsim5

Alternatively, you may download the latest stable release from the GitHub Release page (.zip or .tar.gz).

For installation instructions on Linux and Mac OS X platforms, please refer to 1.2.1 Linux / Mac OS X.

Navigate to the pyCARL source code and copy its contents to the pyNN installation root.

$ cd CARLsim5/pyCARL
$ cp -r CARLsim5/pyCARL/carlsim <pyNN_installation_ root>

14.3 Features supported by pyCARL

14.3.1 Running PyNN with CARLsim:

Command: python <application>.py <pyNN_backend> <application_name> <log_mode> <ithGPUs> <randSeed>
$ python test.py carlsim "test" USER 1 42

14.3.2 Neuron Models:

pyCARL currently supports Izhikevich spiking neurons with either current-based or conductance-based synapses. Support for LIF neurons is planned for the future. Different groups of neurons can be created from a one-dimensional array to a three-dimensional grid.

Neuron Type:

To create a group (Population) of Izhikevich neurons, first create a Izhikevich cellType and define its properties, as shown below:

izhikevichCellType = sim.Izhikevich(neuronType="EXCITATORY_NEURON", a=0.02, b=0.2, c=-65, d=6)

Here, neuronType="EXCITATORY" denotes that the neurons in the group are glutamatergic. Neurons with GABAergic synapses are supported with the INHIBITORY_NEURON keyword. The Izhikevich neuron parameters (a,b,c and d) are also specified in this function.

Create Group:

Next, create a Group/Population of the above defined neuron type as follows:

neuron_group1 = sim.Population(numNeurons, izhikevichCellType)

Here, numNeurons represents the number of neurons in the group.

14.3.3 Synapse:

Once the neuron groups have been defined, the synaptic connections between them can be defined using Projections in pyNN (shown below). To connect two neuron groups (eg. neuron_group1 and neuron_group2) using an all-to-all connector:

connection = sim.Projection(neuron_group1, neuron_group2, sim.AllToAllConnector(), sim.StaticSynapse(weight=3.0, delay=4.0))

Connector Types:

In PyNN, each different algorithm that can be used to determine which pre-synaptic neurons are connected to which post-synaptic neurons

The pyCARL interface currently supports the following connectors:

  1. AllToAllConnector - Each neuron in the pre-synaptic population is connected to every neuron in the post-synaptic population.
  2. OneToOneConnector - The neuron with index i in the pre-synaptic population is then connected to the neuron with index i in the post-synaptic population.
  3. FixedProbabilityConnector - Each possible connection between all pre-synaptic neurons and all post-synaptic neurons is created with probability p.

14.3.4 Synapse Models:

Static Synapse - A fixed weight and delay synapse.

synapse = sim.StaticSynapse(weight=3.0, delay=4.0)

Spike-timing-dependent plasticity - STDP mechanisms can be constructed using weight-dependence and timing-dependent models.

stdp = STDPMechanism(
weight=0.02,
delay=1,
timing_dependence=SpikePairRule(tau_plus=20.0, tau_minus=20.0, A_plus=0.01, A_minus=0.012),
weight_dependence=AdditiveWeightDependence(w_min=0, w_max=0.04))

Here, weight is the initialized weights, delay represents the synaptic delay and timing_dependence and weight_dependence are the supported STDP mechanisms.

14.3.5 Input:

Generating Poisson Spikes:

The following function allows a user to create spike trains whose inter-spike interval follows a Poisson process.

inputCellType = sim.SpikeSourcePoisson(neuronType="EXCITATORY_NEURON", rate=50)

neuronType="EXCITATORY" denotes that the neurons in the group are glutamatergic. Neurons with GABAergic synapses are supported with the INHIBITORY_NEURON keyword. The spike rate is set using the rate variable.

Generating Spikes From Arrays:

The following function allows the user to schedule exact spike times (ms)

inputCellType = sim.SpikeSourceArray(neuronType="EXCITATORY_NEURON", spike_times=[5, 10, 15, 20])

14.3.6 Monitoring:

Currently, pyCARL support spike and connection monitoring. CARLsim SpikeMonitors and ConnectionMonitors are internally defined for every group (Population) and connection (projection) in an application.

The control the recording of these parameters use the record() function as indicated below:

neuron_group1 = sim.Population(nExc, izhikevichCellType1, label='exc')
...
...
neuron_group1.record('spikes') # spike monitoring

14.3.7 Homeostasis:

Homeostatic synaptic scaling has been observed experimentally and may serve to stabilize plasticity mechanisms that can otherwise undergo run-away behaviors. CARLsim implements a version of homeostatic synaptic scaling that helps stabilize STDP.

sim.state.setHomeostasis(neuron_group1.carlsim_group, True, 1.0, 10.0) // groupID, true/false, alpha, T

14.3.8 Conductance mode:

CARLsim supports two synapse model descriptions. The current-based (CUBA) description uses a single synaptic current term while the conductance-based (COBA) description calculates the synaptic current using more complex conductance equations for each synaptic receptor-type.

sim.state.network.setConductances(False)
CARLsim::setConductances
void setConductances(bool isSet)
Sets default values for conduction decay and rise times or disables COBA alltogether.
Definition: carlsim.cpp:1789
USER
@ USER
User mode, for experiment-oriented simulations.
Definition: carlsim_datastructures.h:92
CARLsim::setHomeostasis
void setHomeostasis(int grpId, bool isSet, float homeoScale, float avgTimeScale)
Sets custom values for implementation of homeostatic synaptic scaling.
Definition: carlsim.cpp:1800