GeNN  3.3.0
GPU enhanced Neuronal Networks (GeNN)
Synaptic matrix types

Synaptic matrix types are made up of two components: SynapseMatrixConnectivity and SynapseMatrixWeight. SynapseMatrixConnectivity defines what data structure is used to store the synaptic matrix:

  • SynapseMatrixConnectivity::DENSE stores synaptic matrices as a dense matrix. Large dense matrices require a large amount of memory and if they contain a lot of zeros it may be inefficient.
  • SynapseMatrixConnectivity::SPARSE stores synaptic matrices in a Yale format. In general, this is less efficient to traverse using a GPU than the dense matrix format but does result in large memory savings for large matrices. Sparse matrices are stored in a struct named SparseProjection which contains the following members:
    1. unsigned int connN: number of connections in the population. This value is needed for allocation of arrays. The indices that correspond to these values are defined in a pre-to-post basis by the subsequent arrays.
    2. unsigned int ind (of size connN): Indices of corresponding postsynaptic neurons concatenated for each presynaptic neuron.
    3. unsigned int *indInG with one more entry than there are presynaptic neurons. This array defines from which index in the synapse variable array the indices in ind would correspond to the presynaptic neuron that corresponds to the index of the indInG array, with the number of connections being the size of ind. More specifically, indIng[i+1]-indIng[i] would give the number of postsynaptic connections for neuron i. 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 SparseProjection should have these members, with indexing from 0:
      ConnN = 4
      ind = [1 2 0 2]
      indIng = [0 2 4]
      Weight update model variables associated with the sparsely connected synaptic population will be kept in an array using the same indexing as ind. For example, a variable caled g will be kept in an array such as: g=[g_Pre0-Post1 g_pre0-post2 g_pre1-post0 X]
  • SynapseMatrixConnectivity::RAGGED stores synaptic matrices in a (padded) 'ragged array' format. This format has simular efficiency to the SynapseMatrixConnectivity::SPARSE format, but saves memory when postsynaptic learning is required and is better suited to parallel construction. Ragged matrices are stored in a struct named RaggedProjection which contains the following members:
    1. unsigned int maxRowLength: maximum number of connections in any given row (this is the width the structure is padded to). This value is set when the model is built using SynapseGroup::setMaxConnections.
    2. unsigned int *rowLength (sized to number of presynaptic neurons): actual length of the row of connections associated with each presynaptic neuron
    3. unsigned int *ind (sized to maxRowLength * number of presynaptic neurons): Indices of corresponding postsynaptic neurons concatenated for each presynaptic neuron. 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 only to the 0th neuron. The struct RaggedProjection should have these members, with indexing from 0 (where X represents a padding value):
      maxRowLength = 2
      ind = [1 2 0 X]
      rowLength = [2 1]
      Weight update model variables associated with the sparsely connected synaptic population will be kept in an array using the same indexing as ind. For example, a variable caled g will be kept in an array such as: g=[g_Pre0-Post1 g_pre0-post2 g_pre1-post0 X]
  • SynapseMatrixConnectivity::BITMASK is an alternative sparse matrix implementation where which synapses within the matrix are present is specified as a binary array (see Insect olfaction model). This structure is somewhat less efficient than the SynapseMatrixConnectivity::SPARSE and SynapseMatrixConnectivity::RAGGED formats and doesn't allow individual weights per synapse. However it does require the smallest amount of GPU memory for large networks.

Furthermore the SynapseMatrixWeight defines how

  • SynapseMatrixWeight::INDIVIDUAL allows each individual synapse to have unique weight update model variables. Their values must be initialised at runtime and, if running on the GPU, copied across from the user side code, using the pushXXXXXStateToDevice function, where XXXX is the name of the synapse population.
  • SynapseMatrixWeight::INDIVIDUAL_PSM allows each postsynapic neuron to have unique post synaptic model variables. Their values must be initialised at runtime and, if running on the GPU, copied across from the user side code, using the pushXXXXXStateToDevice function, where XXXX is the name of the synapse population.
  • SynapseMatrixWeight::GLOBAL saves memory by only maintaining one copy of the weight update model variables. This is automatically initialized to the initial value passed to NNmodel::addSynapsePopulation.

Only certain combinations of SynapseMatrixConnectivity and SynapseMatrixWeight are sensible therefore, to reduce confusion, the SynapseMatrixType enumeration defines the following options which can be passed to NNmodel::addSynapsePopulation:


Previous | Top | Next