![]() |
GeNN
1.1
GPU enhanced Neuronal Networks (GeNN)
|
GeNN is a software library for facilitating the simulation of neuronal network models on NVIDIA CUDA enabled GPU hardware. It was designed with computational neuroscience models in mind rather than artificial neural networks. The main philosophy of GeNN is two-fold:
This User guide gives an overview of how to use GeNN for a novice user and tries to lead the user to more expert use later on. With this we jump right in.
A network model is defined by the user by providing the function
In this function, the following tasks must be completed:
Neuron populations are added using the function
where the arguments are:
const
char*
name: Name of the neuron population int
n: number of neurons in the population int
TYPE: Type of the neurons, refers to either a standard type (see Neuron models) or user-defined type float
*para: Parameters of this neuron type float
*ini: Initial values for variables of this neuron typeThe user may add as many neuron populations as the model necessitates. They should all have unique names.
Synapse populations are added with the command
where the arguments are
const
char*
name: The name of the synapse population int
sType:
The type of synapse to be added (i.e. learning mode). See Models below for the available predefined synapse types. int
sConn:
The type of synaptic connectivity. the options currently are "ALLTOALL", "DENSE", "SPARSE" (see Connectivity types ) int
gType:
The way how the synaptic conductivity g will be defined. Options are "INDIVIDUALG", "GLOBALG", "INDIVIDUALID". For their meaning, see Conductance definition methods below. int
delaySteps:
Number of delay slots. int
postSyn:
Postsynaptic integration method. See Post-synaptic integration methods for predefined types. char*
preName:
Name of the (existing!) per-synaptic neuron population. char*
postName:
Name of the (existing!) post-synaptic neuron population. float*
sParam:
A C-type array of floats that contains parameter values (common to all synapses of the population) which will be used for the defined synapses. The array must contain the right number of parameters in the right order for the chosen synapse type. If too few, segmentation faults will occur, if too many, excess will be ignored.Warnings: 1. If the synapse conductance definition type is "GLOBALG" the global value of the synapse conductances must be set with setSynapseG().
Synaptic update can be done by using true spikes (one point per spike after the threshold) or by using spike events (all points above the threshold).
There is a number of predefined models which can be chosen in the addNeuronGroup
function by their unique cardinal number, starting from 0. For convenience, C constants with readable names are predefined:
The MAPNEURON type is a map based neuron model as defined in [3] .
It has 2 variables:
V
- the membrane potentialpreV
- the membrane potential at the previous time stepand it has 4 parameters:
Vspike
- the membrane potential at the top of the spikealpha
- determines the shape of the iteration functiony
- "shift / excitation" parameter, also determines the iteration functionbeta
- roughly regulates the scale of the input into the neuronPoisson neurons have constant membrane potential (Vrest
) unless they are activated randomly to the Vspike
value if (t- SpikeTime
) > trefract
.
It has 3 variables:
V
- Membrane potentialSeed
- Seed for random number generationSpikeTime
- Time at which the neuron spiked for the last timeand 4 parameters:
therate
- Firing ratetrefract
- Refractory periodVspike
- Membrane potential at spike (mV)Vrest
- Membrane potential at rest (mV)It has 4 variables:
V
- membrane potential Em
- probability for Na channel activation mh
- probability for not Na channel blocking hn
- probability for K channel activation nand 7 parameters:
gNa
- Na conductance in 1/(mOhms * cm^2)ENa
- Na equi potential in mVgK
- K conductance in 1/(mOhms * cm^2)EK
- K equi potential in mVgl
- Leak conductance in 1/(mOhms * cm^2)El
- Leak equi potential in mVCmem
- Membrane capacity density in muF/cm^2This is the Izhikevich model with fixed parameters [1].
Variables are:
V
- Membrane potentialU
- Membrane recovery variableParameters are:
a
- time scale of Ub
- sensitivity of Uc
- after-spike reset value of Vd
- after-spike reset value of UThis is the same model as IZHIKEVICH (Izhikevich neurons with fixed parameters) IZHIKEVICH but parameters defined as variables in order to provide a parameter range instead of fixed values for every neuron in the population.
In order to define a new neuron model for use in a GeNN application, it is necessary to populate an object of class neuronModel
and append it to the global vector nModels
. The neuronModel
class has several data members that make up the full description of the neuron model:
simCode
of type string:
This needs to be assigned a C++ string that contains the code for executing the integration of the model for one time step. Within this code string, variables need to be referred to by , where NAME is the name of the variable as defined in the vector varNames. The code may refer to the predefined primitives "DT" for the time step size and "Isyn" for the total incoming synaptic current.varNames
of type vector<string>
: This vector needs to be filled with the names of variables that make up the neuron state. The variables defined here as "NAME" can then be used in the syntax in the code string.varTypes
of type vector<string>
: This vector needs to be filled with the variable type (e.g. "float", "double", etc) for the variables defined in varNames
. Types and variables are matched to each other by position in the respective vectors.pNames
of type vector<string>
: This vector will contain the names of parameters relevant to the model. If defined as "NAME" here, they can then be referenced as "$(NAME)" in the code string. The length of this vector determines the expected number of parameters in the initialisation of the neuron model. Parameters are currently assumed to be always of type float.dpNames
of type vector<string>
: Names of dependant parameters. This is a mechanism for enhanced efficiency for running neuron models. If parameters with model-side meaning, such as time constants or conductances always appear in a certain combination in the model, then it is more efficient to pre-compute the combination and define it as a dependent parameter. This vector contains the names of such dependent parameters.tmpVarNames
of type vector<string>
: This vector can be used to request additional variables that are not part of the state of the neuron but used only as temporary storage during evaluation of the integration time step.tmpVarTypes
of type vector<string>
: This vector will contain the variable types of the temporary variables.Once the completed neuronModel
object is appended to the nModels
vector it can be used in network descriptions by referring to its cardinal number in the nModels vector. I.e., if the model is added as the 4th entry, it would be model "3" (counting starts at 0 in usual C convention). The information of the cardinal number of a new model can be obtained by referring to nModels.size()
right before appending the new model.
For dependent parameters in a user-defined model, it is the user's responsibility to intitialize the derived parameters from the relevant entries of the global neuronPara
vector entries, to store them in a vector and append this vector to the global vector dnp
. This needs to be done right after the call to addNeuronPopulation that involves the neuron model in questions. For an example of what needs to be done, refer to the member function initDerivedNeuronPara()
of class NNmodel
which does this for Rulkov map neurons.
The user can decide whether a neuron group receives external input current or not in addition to the synaptic input that it receives from the network. External input to a neuron group is activated by calling activateDirectInput
function. It receives two arguments: The first argument is the name of the neuron group to receive input current. The second parameter defines the type of input. Current options are:
Currently 3 predefined synapse models are available:
If this model is selected, no learning rule is applied to the synapse. The model has 3 parameters:
tau_S*
- decay time constant for S [ms]Epre:
Presynaptic threshold potentialErev*
- Reversal potential(* DEPRECATED: Decay time constant and reversal potential in synapse parameters are not used anymore and they will be removed in the next release. They should be defined in the postsynaptic mechanisms.)
In a graded synapse, the conductance is updated gradually with the rule:
The parameters are:
Erev*
: Reversal potentialEpre:
Presynaptic threshold potentialtau_S*
: Decay time constant for S [ms]Vslope:
Activation slope of graded release(* DEPRECATED: Decay time constant and reversal potential in synapse parameters are not used anymore and they will be removed in the next release. They should be defined in the postsynaptic mechanisms.)
This is a simple STDP rule including a time delay for the finite transmission speed of the synapse, defined as a piecewise function.
This model has 13 parameters:
Erev:
Reversal potentialEpre:
Presynaptic threshold potentialtau_S:
Decay time constant for S [ms]TLRN:
Time scale of learning changesTCHNG:
Width of learning windowTDECAY:
Time scale of synaptic strength decayTPUNISH10:
Time window of suppression in response to 1/0TPUNISH01:
Time window of suppression in response to 0/1GMAX:
Maximal conductance achievableGMID:
Midpoint of sigmoid g filter curveGSLOPE:
Slope of sigmoid g filter curveTAUSHiFT:
Shift of learning curveGSYN0:
Value of syn conductance g decays toFor more details, see [2].
There is a way to define a synapse model the same way a neuronModel can be defined. This feature is still experimental and supported only with the SpineML and development branches.
A synapse model is a weightUpdateModel object which consists of variables, parameters, and three string objects which will be substituted in the code. These three strings are:
simCode:
Simulation code that is used when a true spike is detected (only one point after Vthresh)simCodeEvnt:
Simulation code that is used for spike events (all the instances where Vm > Vthres)simLearnPost:
Simulation code which is used in the learnSynapsesPost kernel/function, where postsynaptic neuron spikes before the presynaptic neuron in the STDP window. Usually this is simply the conductance update rule defined by the other simCode elements above, with negative timing. This code is needed as simCode and simCodeEnvt are used after spanning the presynaptic spikes, where it is not possible to detect where a postsynaptic neuron fired before the presynaptic neuron.These codes would include update functions for adding up conductances for that neuron model and for changes in conductances for the next time step (learning). Condutance in this code should be referred to as $("G")
If INDIVIDUALG is used with ALLTOALL connectivity, the conductance values are stored in an array called "ftype * gp<synapseName>", defined and initialised in runner.cc in the generated code.
If INDIVIDUALID is used with ALLTOALL connectivity, the connectivity matrix is stored in an array called "unsigned int * gp<synapseName>"
If connectivity is of SPARSE type, connectivity and conductance values are stored in a struct in order to occupy minimum memory needed. The struct Conductance contains 3 array members and one integer member: 1: unsigned int connN: number of connections in the population. This value is needed for allocaton of arrays. 2: floattype * gp: Values of conductances. The indices that correspond to these values are defined in a pre-to-post basis by the following arrays: 4: unsigned int gInd, of size connN: Indices of corresponding postsynaptic neurons concatenated for each presynaptic neuron. 3: unsigned int *gIndInG, of size model.neuronN[model.synapseSource[synInd]]+1: This array defines from which index in the gp array the indices in gInd would correspond to the presynaptic neuron that corresponds to the index of the gIndInG array, with the number of connections being the size of gInd. More specifically, gIndIng[n+1]-gIndIng[n] would give the number of postsynaptic connections for neuron n, and the conductance values are stored in gp[gIndIng[n]] to gp[gIndIng[n]+1]. if there are no connections for a presynaptic neuron, then gp[gIndIng[n]]=gp[gIndIng[n]+1].
For example, consider a network of two presynaptic neurons connected to three postsynaptic neurons: 0th presynaptic neuron connected to 1st and 2nd postsynaptic neurons, the 1st presynaptic neuron connected to 0th and 2nd neurons. The struct Conductance should have these members, with indexing from 0: ConnN = 4 gp= gPre0-Post1 gpre0-post2 gpre1-post0 gpre1-post2 gInd= 1 2 0 2 gIndIng= 0 2 4
See tools/gen_syns_sparse_IzhModel used in Izh_sparse project to see a working example.
The available options work as follows:
addSynapsePopulation
command, GeNN reserves an array of size n_pre x n_post float for individual conductance values for each combination of pre and postsynaptic neuron. The actual values of teh conductances are passed at runtime from the user side code, using the copyGToDevice
function.addSynapsePopulation
command must be followed within the modelDefinition
function by a call to setSynapseG
for this synapse population. This option can only be sensibly combined with connectivity type ALLTOALL.The shape of the postsynaptic current can be defined by either using a predefined method or by adding a new postSynModel object.