GeNN  4.9.0
GPU enhanced Neuronal Networks (GeNN)
Sparse connectivity initialisation

Using sparse connectivity initialisation snippets, synaptic connectivity implemented using SynapseMatrixConnectivity::SPARSE and SynapseMatrixConnectivity::BITMASK can be automatically initialised and SynapseMatrixConnectivity::PROCEDURAL connectivity can be generated on the fly.

There are a number of predefined sparse connectivity initialisation snippets:

For example, to initialise synaptic connectivity with a 10% connection probability (allowing connections between neurons with the same id):

Defining a new sparse connectivity snippet

Similarly to variable initialisation snippets, sparse connectivity initialisation snippets can be created by simply defining a class in the model description.

For example, the following sparse connectivity initialisation snippet could be used to initialise a 'ring' of connectivity where each neuron is connected to a number of subsequent neurons specified using the numNeighbours parameter:

Each row of sparse connectivity is initialised independantly by running the snippet of code specified using the within a loop. The $(num_post) variable can be used to access the number of neurons in the postsynaptic population and the $(id_pre) variable can be used to access the index of the presynaptic neuron associated with the row being generated. The can be used to initialise state variables outside of the loop - in this case offset which is used to count the number of synapses created in each row. As well as allowing initialization of variables to a constant value, a code string can be used to initialize these values based on parameters, the index of the current row etc: However, the rows generated by some connection initialisation algorithms such as InitSparseConnectivitySnippet::FixedNumberPreWithReplacement are not independent so cannot be generated in this way. In these cases, code to build connectivity columns can be specified with the and the can be used to initialise per-column state variables. Synapses are added to the row using the $(addSynapse, target) function and iteration is stopped using the $(endRow) function. connectivity snippets should also provide code to calculate the maximum row and column lengths this connectivity will result in using the .

Kernel-based connectivity

Some forms of structured connectivity such as convolutions repeat a 'kernel' of weights across the entire connectivity matrix. Sparse connectivity initialisation snippets which operate in this way need to provide two extra pieces of information. Firstly the dimensions of the kernel required by the connectivity are specified using the :

Secondly, the row build code must use an extended version of the addSynapse function which indicates the kernel indices associated with the synapse. For example, the following could be used with a 4 dimensional kernel: $(addSynapse, idPost, kernRow, kernCol, inChan, outChan); In order to use a kernel to initialise SynapseMatrixWeight::INDIVIDUAL variables, the variables should be initialised using the InitVarSnippet::Kernel variable initialisation snippet and the kernel itself allocated as an extra global parameter and pushed to device (see Extra Global Parameters). Finally, in order to use a kernel to generate SynapseMatrixWeight::PROCEDURAL variables on the fly, the SynapseMatrixType::PROCEDURAL_KERNELG matrix type should be used.

Sparse connectivity locations

Once you have defined how sparse connectivity is going to be initialised, similarly to variables, you can control where it is allocated. This is controlled using the same VarLocations options described in section Variable locations and can either be set using the model default specifiued with ModelSpec::setDefaultSparseConnectivityLocation or on a per-synapse group basis using SynapseGroup::setSparseConnectivityLocation.


Previous | Top | Next