Defining a network model

A network model is defined by the user by providing the function

void modelDefinition(ModelSpec &model)

in a separate file, such as MyModel.cc. In this function, the following tasks must be completed:

  1. The name of the model must be defined:

    model.setName("MyModel");
    
  2. Neuron populations (at least one) must be added (see Defining neuron populations). The user may add as many neuron populations as they wish. If resources run out, there will not be a warning but GeNN will fail. However, before this breaking point is reached, GeNN will make all necessary efforts in terms of block size optimisation to accommodate the defined models. All populations must have a unique name.

  3. Synapse populations (zero or more) can be added (see Defining synapse populations). Again, the number of synaptic connection populations is unlimited other than by resources.

Defining neuron populations

Neuron populations are added using the function

model.addNeuronPopulation<NeuronModel>(name, num, paramValues, varInitialisers);

where the arguments are:

  • NeuronModel : Template argument specifying the type of neuron model These should be derived off NeuronModels::Base and can either be one of the standard models or user-defined (see Neuron models).
  • const string &name : Unique name of the neuron population
  • unsigned int size : number of neurons in the population
  • NeuronModel::ParamValues paramValues : Parameters of this neuron type
  • NeuronModel::VarValues varInitialisers : Initial values or initialisation snippets for variables of this neuron type

The user may add as many neuron populations as the model necessitates. They must all have unique names. The possible values for the arguments, predefined models and their parameters and initial values are detailed Neuron models below.

Defining synapse populations

Synapse populations are added with the function

model.addSynapsePopulation<WeightUpdateModel, PostsynapticModel>(name, mType, delay, preName, postName,
                                                                 weightParamValues, weightVarValues, weightPreVarInitialisers, weightPostVarInitialisers,
                                                                 postsynapticParamValues, postsynapticVarValues, connectivityInitialiser);

where the arguments are

  • WeightUpdateModel : Template parameter specifying the type of weight update model. These should be derived off WeightUpdateModels::Base and can either be one of the standard models or user-defined (see Weight update models).
  • PostsynapticModel : Template parameter specifying the type of postsynaptic integration model. These should be derived off PostsynapticModels::Base and can either be one of the standard models or user-defined (see Postsynaptic integration methods).
  • const string &name : The name of the synapse population
  • unsigned int mType : How the synaptic matrix is stored. See Synaptic matrix types for available options.
  • unsigned int delay : Homogeneous (axonal) delay for synapse population (in terms of the simulation time step DT).
  • const string preName : Name of the (existing!) pre-synaptic neuron population.
  • const string postName : Name of the (existing!) post-synaptic neuron population.
  • WeightUpdateModel::ParamValues weightParamValues : The parameter values (common to all synapses of the population) for the weight update model.
  • WeightUpdateModel::VarValues weightVarInitialisers : Initial values or initialisation snippets for the weight update model’s state variables
  • WeightUpdateModel::PreVarValues weightPreVarInitialisers : Initial values or initialisation snippets for the weight update model’s presynaptic state variables
  • WeightUpdateModel::PostVarValues weightPostVarInitialisers : Initial values or initialisation snippets for the weight update model’s postsynaptic state variables
  • PostsynapticModel::ParamValues postsynapticParamValues : The parameter values (common to all postsynaptic neurons) for the postsynaptic model.
  • PostsynapticModel::VarValues postsynapticVarInitialisers : Initial values or initialisation snippets for variables for the postsynaptic model’s state variables
  • InitSparseConnectivitySnippet::Init connectivityInitialiser : Optional argument, specifying the initialisation snippet for synapse population’s sparse connectivity (see Sparse connectivity initialisation).

The ModelSpec::addSynapsePopulation() function returns a pointer to the newly created SynapseGroup object which can be further configured, namely with:

  • SynapseGroup::setMaxConnections() and SynapseGroup::setMaxSourceConnections() to configure the maximum number of rows and columns respectively allowed in the synaptic matrix - this can improve performance and reduce memory usage when using SynapseMatrixConnectivity::SPARSE connectivity (see Synaptic matrix types). When using a sparse connectivity initialisation snippet, these values are set automatically.
  • SynapseGroup::setMaxDendriticDelayTimesteps() sets the maximum dendritic delay (in terms of the simulation time step DT) allowed for synapses in this population. No values larger than this should be passed to the delay parameter of the addToDenDelay function in user code (see Defining a new weight update model).
  • SynapseGroup::setSpanType() sets how incoming spike processing is parallelised for this synapse group. The default SynapseGroup::SpanType::POSTSYNAPTIC is nearly always the best option, but SynapseGroup::SpanType::PRESYNAPTIC may perform better when there are large numbers of spikes every timestep or very few postsynaptic neurons.

If the synapse matrix uses one of the “GLOBALG” types then the global value of the synapse parameters are taken from the initial value provided in weightVarInitialisers therefore these must be constant rather than sampled from a distribution etc.

Previous | Top | Next