diff --git a/documentation/5/.buildinfo b/documentation/5/.buildinfo
index edf215e16..1b6340771 100644
--- a/documentation/5/.buildinfo
+++ b/documentation/5/.buildinfo
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: 8fcd4cc66e68152844a59c6365600984
+config: e7f4ce9044f550b7edaf1bcaedd3edcc
tags: 645f666f9bcd5a90fca523b33c5a78b7
diff --git a/documentation/5/_sources/building_networks.rst.txt b/documentation/5/_sources/building_networks.rst.txt
index cdcd022d2..be1710964 100644
--- a/documentation/5/_sources/building_networks.rst.txt
+++ b/documentation/5/_sources/building_networks.rst.txt
@@ -7,7 +7,7 @@ Building networks
The model
---------
A network model is defined as follows:
-A :class:`.GeNNModel` must be created with a name and a default precision (see \ref floatPrecision)}:
+A :class:`.GeNNModel` must be created with a default precision (see \ref floatPrecision) and a name:
.. code-block:: python
@@ -22,7 +22,7 @@ For example, the single-threaded CPU backend could be manually selected with:
model = GeNNModel("float", "YourModelName",
backend="single_threaded_cpu")
-When running models on a GPU, smaller models may not fully occupy the device. In some scenerios such as gradient-based training and parameter sweeping,
+When running models on a GPU, smaller models may not fully occupy the device. In some scenarios such as gradient-based training and parameter sweeping,
this can be overcome by runing multiple copies of the same model at the same time (batching in Machine Learning speak).
Batching can be enabled on a GeNN model with:
@@ -35,12 +35,19 @@ Whether state variables are duplicated or shared is controlled by the :class:`.V
associated with each variable. Please see TODO for more details.
Additionally, any preferences exposed by the backend can be configured here.
-For example, the CUDA backend allows you to select which CUDA device to use via the manual_device_id
+For example, the CUDA backend allows you to select which CUDA device to use via the manual_device_id:
+
+.. code-block:: python
+
+ model = GeNNModel("float", "YourModelName",
+ backend="cuda", manual_device_id=0)
-----------
Populations
-----------
+Populations formalise the concept of groups of neurons or synapses that are functionally related or a practical grouping, e.g. a brain region in a neuroscience model or a layer in a machine learning context.
+
Parameters
----------
Parameters are initialised to constant numeric values which are homogeneous across an entire population:
@@ -49,9 +56,10 @@ Parameters are initialised to constant numeric values which are homogeneous acro
ini = {"m": 0.0529324, ...}
-They are very efficient to access from models as their values are either hard-coded into the kernels
+They are very efficient to access from models as their values are either hard-coded into the backend code
or, on the GPU, delivered via high-performance constant cache.
-However
+However, they can only be used if literally no changes are needed for the entire simulation and all members of
+the population have the exact same parameter value.
Extra global parameters
-----------------------
@@ -63,25 +71,26 @@ TODO
Variables
----------
-Variables can be initialised in many ways.
-By using the GPU to fill them with a constant value:
+Variables contain values that are individual to the members of a population and can change over time. They can be initialised in many ways. The initialisation is configured through a Python dictionary that is then passed to :meth:`.GeNNModel.add_neuron_population` or :meth:`.GeNNModel.add_synapse_population` which create the populations.
+
+To initialise variables one can use the backend, e.g. GPU, to fill them with a constant value:
.. code-block:: python
ini = {"m": 0.0529324, ...}
-by copying in a sequence of values from Python:
+or copy a sequence of values from Python:
.. code-block:: python
ini = {"m": np.arange(400.0), ...}
-or by using a variable initialisation snippet configured using the following function:
+or use a variable initialisation snippet returned by the following function:
.. autofunction:: pygenn.init_var
:noindex:
-and then used in the dictionary the same way:
+The resulting initialisation snippet can then be used in the dictionary in the usual way:
.. code-block:: python
@@ -89,7 +98,7 @@ and then used in the dictionary the same way:
Variables references
--------------------
-As well as variables and parameters, various types of model have variable references which are used to reference variables belonging to other populations.
+As well as variables and parameters, various types of models have variable references which are used to reference variables belonging to other populations.
For example, postsynaptic update models can reference variables in the postsynaptic neuron model and custom updates are 'attached' to other populations based on their variable references.
A variable reference called R could be assigned to various types of variable using the following syntax:
@@ -213,4 +222,4 @@ updating model *variables*, they update model *connectivity* (current only with
Custom connectivity updates are added to a model using:
.. automethod:: .GeNNModel.add_custom_connectivity_update
- :noindex:
\ No newline at end of file
+ :noindex:
diff --git a/documentation/5/_sources/index.rst.txt b/documentation/5/_sources/index.rst.txt
index cfa5f74c7..ff9e0f103 100644
--- a/documentation/5/_sources/index.rst.txt
+++ b/documentation/5/_sources/index.rst.txt
@@ -12,13 +12,14 @@ Note, this documentation is under construction. If you cannot find what you are
.. toctree::
:maxdepth: 4
:titlesonly:
-
+
+ installation
upgrading
building_networks
simulating_networks
custom_models
bibliography
-
+
userproject/index
Reference documentation
Additionally, any preferences exposed by the backend can be configured here.
-For example, the CUDA backend allows you to select which CUDA device to use via the manual_device_id
+For example, the CUDA backend allows you to select which CUDA device to use via the manual_device_id:
+
Populations formalise the concept of groups of neurons or synapses that are functionally related or a practical grouping, e.g. a brain region in a neuroscience model or a layer in a machine learning context.
Parameters are initialised to constant numeric values which are homogeneous across an entire population:
ini={"m":0.0529324,...}
-
They are very efficient to access from models as their values are either hard-coded into the kernels
+
They are very efficient to access from models as their values are either hard-coded into the backend code
or, on the GPU, delivered via high-performance constant cache.
-However
+However, they can only be used if literally no changes are needed for the entire simulation and all members of
+the population have the exact same parameter value.
Variables can be initialised in many ways.
-By using the GPU to fill them with a constant value:
+
Variables contain values that are individual to the members of a population and can change over time. They can be initialised in many ways. The initialisation is configured through a Python dictionary that is then passed to GeNNModel.add_neuron_population() or GeNNModel.add_synapse_population() which create the populations.
+
To initialise variables one can use the backend, e.g. GPU, to fill them with a constant value:
ini={"m":0.0529324,...}
-
by copying in a sequence of values from Python:
+
or copy a sequence of values from Python:
ini={"m":np.arange(400.0),...}
-
or by using a variable initialisation snippet configured using the following function:
+
or use a variable initialisation snippet returned by the following function:
params (Dict[str, Union[int, float]]) – parameter values for the variable init snippet (see Parameters)
-
For example, the built in model could be initialised to initialise a variable
+
For example, the built-in model “Normal” could be used to initialise a variable
by sampling from the normal distribution with a mean of 0 and a standard deviation of 1:
init=init_var("Normal",{"mean":0.0,"sd":1.0})
-
and then used in the dictionary the same way:
+
The resulting initialisation snippet can then be used in the dictionary in the usual way:
As well as variables and parameters, various types of model have variable references which are used to reference variables belonging to other populations.
+
As well as variables and parameters, various types of models have variable references which are used to reference variables belonging to other populations.
For example, postsynaptic update models can reference variables in the postsynaptic neuron model and custom updates are ‘attached’ to other populations based on their variable references.
A variable reference called R could be assigned to various types of variable using the following syntax:
For example, a population of 10 neurons using the built in Izhikevich model and
+
For example, a population of 10 neurons using the built-in Izhikevich model and
the standard set of ‘tonic spiking’ parameters could be added to a model as follows:
params (Dict[str, Union[int, float]]) – parameter values for the sparse connectivity init snippet (see Parameters)
-
For example, the built in model could be initialised to generate connectivity
+
For example, the built-in model could be initialised to generate connectivity
where each pair of pre and postsynaptic neurons is connected with a probability of 0.1:
params – parameter values for the toeplitz connectivity init snippet (see Parameters)
-
For example, the built in model could be initialised to generate 2D convolutional
+
For example, the built-in model could be initialised to generate 2D convolutional
connectivity with a \(3 \times 3\) kernel, a \(64 \times 64 \times 1\) input
and a \(62 \times 62 \times 1\) input:
custom_conn_update_model (Union[CustomConnectivityUpdateModelBase, str]) – custom connectivity update model either as a string referencing a built in model
+
custom_conn_update_model (Union[CustomConnectivityUpdateModelBase, str]) – custom connectivity update model either as a string referencing a built-in model
(see custom_connectivity_update_models) or an instance of
CustomConnectivityUpdateModelBaseUpdateModelBase
(for example returned by create_custom_connectivity_update_model())
egp_refs (Dict[str, EGPReference]) – references to extra global parameters in other populations
+to access from this update, typically created using
+create_egp_ref() (see Extra global parameter references).
Install the C++ compiler on the machine, if not already present.
+For Windows, Visual Studio 2019 or above is required. The Microsoft Visual Studio
+Community Edition can be downloaded from
+https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx.
+When installing Visual Studio, one should select the ‘Desktop
+development with C++’ configuration. On Linux, the GNU Compiler
+Collection (GCC) 7.5 or above is required. This can be obtained from your
+Linux distribution repository, for example on Ubuntu by running sudoapt-getinstallg++,
+or alternatively from https://gcc.gnu.org/index.html.
+
If your machine has an NVIDIA GPU and you haven’t installed CUDA already,
+obtain a fresh installation of the NVIDIA CUDA toolkit from
+https://developer.nvidia.com/cuda-downloads
+Again, be sure to pick CUDA and C++ compiler versions which are compatible
+with each other. The latest C++ compiler need not necessarily be
+compatible with the latest CUDA toolkit.
+
GeNN uses the CUDA_PATH environment variable to determine which
+version of CUDA to build against. On Windows, this is set automatically when
+installing CUDA. However, if you choose, you can verify which version is
+selected by running echo%CUDA_PATH in a command prompt.
+However, on Linux and Mac you need to set CUDA_PATH manually with:
+`bash
+exportCUDA_PATH=/usr/local/cuda
+`
+assuming CUDA is installed in /usr/local/cuda (the standard location
+on Ubuntu Linux). Again, to make this change persistent, this can
+be added to your login script (e.g. .profile or .bashrc)
+
Either download the latest release of GeNN and extract into your
+home directory or clone using git from https://github.com/genn-team/genn
+
On Linux, install the development version of libffi. For example, on Ubuntu you can do this
+by running sudoapt-getinstalllibffi-dev.
+
Install the pybind11, psutil and numpy packages with pip i.e. pipinstallpybind11psutilnumpy.
From the GeNN directory, the GeNN libraries and python package can be built
+with pythonsetup.pyinstall. If you wish to create an editable install
+(most useful if you are intending to modify GeNN yourself) you can also used
+pythonsetup.pydevelop. On Linux (or Windows if you have a debug version
+of the python libraries installed) you can build a debug version of GeNN with
+pythonsetup.pybuild_ext--debugdevelop.
From the GeNN directory, the GeNN libraries and python package can be built
+with pipinstall.. If you wish to create an editable install
+(most useful if you are intending to modify GeNN yourself) you can also used
+pipinstall--editable..
precision (Union[str, ResolvedType]) – Data type to use for scalar variables
+
model_name (str) – Name of the model
+
backend (Optional[str]) – Name of backend module to use. Defaults to one to pick ‘best’ backend for your system
+
time_precision (Optional[Union[str, ResolvedType]]) – data type to use for representing time
+
genn_log_level (PlogSeverity) – Log level for GeNN
+
code_gen_log_level (PlogSeverity) – Log level for GeNN code-generator
+
transpiler_log_level (PlogSeverity) – Log level for GeNN transpiler
+
runtime_log_level (PlogSeverity) – Log level for GeNN runtime
+
backend_log_level (PlogSeverity) – Log level for backend
+
preference_kwargs – Additional keyword arguments to set in backend preferences structure
@@ -334,7 +335,7 @@
Navigation
Parameters:
cs_name (str) – unique name
-
current_source_model (Union[CurrentSourceModelBase, str]) – current source model either as a string referencing a built in model
+
current_source_model (Union[CurrentSourceModelBase, str]) – current source model either as a string referencing a built-in model
(see current_source_models) or an instance of CurrentSourceModelBase
(for example returned by create_current_source_model())
pop (NeuronGroup) – neuron population to inject current into
Add a custom connectivity update to the GeNN model
Parameters:
@@ -370,7 +371,7 @@
Navigation
group_name (str) – name of the ‘custom update group’ to include this update in.
All custom updates in the same group are executed simultaneously.
syn_group (SynapseGroup) – Synapse group to attach custom connectivity update to
-
custom_conn_update_model (Union[CustomConnectivityUpdateModelBase, str]) – custom connectivity update model either as a string referencing a built in model
+
custom_conn_update_model (Union[CustomConnectivityUpdateModelBase, str]) – custom connectivity update model either as a string referencing a built-in model
(see custom_connectivity_update_models) or an instance of
CustomConnectivityUpdateModelBaseUpdateModelBase
(for example returned by create_custom_connectivity_update_model())
egp_refs (Dict[str, EGPReference]) – references to extra global parameters in other populations
+to access from this update, typically created using
+create_egp_ref() (see `Extra global parameter references`_).
@@ -405,20 +409,20 @@
Navigation
cu_name (str) – unique name
group_name (str) – name of the ‘custom update group’ to include this update in.
All custom updates in the same group are executed simultaneously.
-
custom_update_model (Union[CustomUpdateModelBase, str]) – custom update model either as a string referencing a built in model
+
custom_update_model (Union[CustomUpdateModelBase, str]) – custom update model either as a string referencing a built-in model
(see custom_update_models) or an instance of
CustomUpdateModelBase
(for example returned by create_custom_update_model())
-
params (Dict[str, Union[int, float]]) – parameter values for the custom update model (see `Parameters`_)
+
params (Dict[str, Union[int, float]]) – parameter values for the custom update model (see `Parameters`_)
vars (Dict[str, Union[VarInit, int, float, ndarray, Sequence]]) – initial variable values or initialisers
-for the custom update model (see `Variables`_)
var_refs (Union[Dict[str, VarReference], Dict[str, WUVarReference]]) – references to variables in other populations to
access from this update, typically created using either
create_var_ref() or create_wu_var_ref()
-(see `Variables references`_).
egp_refs (Dict[str, EGPReference]) – references to extra global parameters in other populations
to access from this update, typically created using
-create_egp_ref() (see `Extra global parameter references`_).
neuron (Union[NeuronModelBase, str]) – neuron model either as a string referencing a built in model
+
neuron (Union[NeuronModelBase, str]) – neuron model either as a string referencing a built-in model
(see neuron_models) or an instance of NeuronModelBase
(for example returned by create_neuron_model())
-
params (Dict[str, Union[int, float]]) – parameter values for the neuron model (see `Parameters`_)
+
params (Dict[str, Union[int, float]]) – parameter values for the neuron model (see `Parameters`_)
vars (Dict[str, Union[VarInit, int, float, ndarray, Sequence]]) – initial variable values or initialisers
-for the neuron model (see `Variables`_)
For example, a population of 10 neurons using the built in Izhikevich model and
+
For example, a population of 10 neurons using the built-in Izhikevich model and
the standard set of ‘tonic spiking’ parameters could be added to a model as follows:
Within the injection_code code string, the variables, parameters,
derived parameters, neuron variable references and extra global
parameters defined in this model can all be referred to be name.
-Additionally, the code may refer to the following built in read-only variables
+Additionally, the code may refer to the following built-in read-only variables
dt which represents the simulation time step (as specified via GeNNModel.dt())
id which represents a neurons index within a population (starting from zero)
Within host update code, you have full access to parameters, derived parameters,
extra global parameters and pre and postsynaptic variables. By design you do
@@ -1482,6 +1486,8 @@
Navigation
on CPU when custom connectivity update is launched
extra_global_params – names and types of model
extra global parameters
+
extra_global_param_refs – names and types of extra global
+parameter references
Within the update_code code string, the variables, parameters,
derived parameters, variable references, extra global parameters
and extra global parameter references defined in this model can all be referred to be name.
-Additionally, the code may refer to the following built in read-only variables
+Additionally, the code may refer to the following built-in read-only variables
dt which represents the simulation time step (as specified via GeNNModel.dt())
Within all of the code strings, the variables, parameters,
derived parameters, additional input variables and extra global
parameters defined in this model can all be referred to be name.
-Additionally, the code may refer to the following built in read-only variables
+Additionally, the code may refer to the following built-in read-only variables
dt which represents the simulation time step (as specified via GeNNModel.dt())
Isyn which represents the total incoming synaptic input.
Within all of the code strings, the variables, parameters,
derived parameters and extra global parameters defined in this model
can all be referred to be name. Additionally, the code may refer to the
-following built in read-only variables:
+following built-in read-only variables:
dt which represents the simulation time step (as specified via GeNNModel.dt())
id which represents a neurons index within a population (starting from zero)
Creates a new sparse connectivity initialisation snippet
Within the code strings, the parameters, derived parameters and
extra global parameters defined in this snippet can all be referred to be name.
-Additionally, the code may refer to the following built in read-only variables
+Additionally, the code may refer to the following built-in read-only variables
dt which represents the simulation time step (as specified via GeNNModel.dt())
num_pre which represents the number of presynaptic neurons
@@ -1781,14 +1798,16 @@
Navigation
thread when some procedural connectivity is used with multiple
threads per presynaptic neuron, represents the index of thread
-
and, in row_build_code:
-- id_pre represents the index of the presynaptic neuron (starting from zero)
-- id_post_begin when some procedural connectivity is used with multiple
-
-
threads per presynaptic neuron, represents the index of the first postsynaptic neuron to connect.
-
-
and, in col_build_code:
-- id_post which represents the index of the postsynaptic neuron (starting from zero)
+
and, in row_build_code:
+
+
id_pre represents the index of the presynaptic neuron (starting from zero)
+
id_post_begin when some procedural connectivity is used with multiple
+threads per presynaptic neuron, represents the index of the first postsynaptic neuron to connect.
+
+
and, in col_build_code:
+
+
id_post which represents the index of the postsynaptic neuron (starting from zero)
+
Finally, the function addSynapse(x) can be used to add a new synapse to the connectivity
where, in row_build_code, x is the index of the postsynaptic neuron to connect id_pre` to
and, in col_build_code, x is the index of the presynaptic neuron to connect to id_post
@@ -1846,7 +1865,7 @@
Navigation
snippet of code specified using the diagonal_build_code`.
Within the code strings, the parameters, derived parameters and
extra global parameters defined in this snippet can all be referred to be name.
-Additionally, the code may refer to the following built in read-only variables
+Additionally, the code may refer to the following built-in read-only variables
dt which represents the simulation time step (as specified via GeNNModel.dt())
num_pre which represents the number of presynaptic neurons
@@ -1910,7 +1929,7 @@
Navigation
Creates a new variable initialisation snippet
Within the var_init_code, the parameters, derived parameters and
extra global parameters defined in this snippet can all be referred to be name.
-Additionally, the code may refer to the following built in read-only variables
+Additionally, the code may refer to the following built-in read-only variables
dt which represents the simulation time step (as specified via GeNNModel.dt())
@@ -2187,20 +2206,20 @@
Navigation
Parameters:
-
snippet (Union[PostsynapticModelBase, str]) – postsynaptic model either as a string referencing a built in model
+
snippet (Union[PostsynapticModelBase, str]) – postsynaptic model either as a string referencing a built-in model
(see postsynaptic_models_models) or an instance of
PostsynapticModelBase (for example returned
by create_postsynaptic_model())
-
params (Dict[str, Union[int, float]]) – parameter values for the postsynaptic model (see `Parameters`_)
+
params (Dict[str, Union[int, float]]) – parameter values for the postsynaptic model (see `Parameters`_)
vars (Dict[str, Union[VarInit, int, float, ndarray, Sequence]]) – initial synaptic variable values or initialisers
-for the postsynaptic model (see `Variables`_)
var_refs (Dict[str, Union[VarInit, int, float, ndarray, Sequence]]) – references to postsynaptic neuron variables,
typically created using create_var_ref()
-(see `Variables references`_)
params (Dict[str, Union[int, float]]) – parameter values for the sparse connectivity init snippet (see `Parameters`_)
+
params (Dict[str, Union[int, float]]) – parameter values for the sparse connectivity init snippet (see `Parameters`_)
-
For example, the built in model could be initialised to generate connectivity
+
For example, the built-in model could be initialised to generate connectivity
where each pair of pre and postsynaptic neurons is connected with a probability of 0.1:
params – parameter values for the toeplitz connectivity init snippet (see `Parameters`_)
+
params – parameter values for the toeplitz connectivity init snippet (see `Parameters`_)
-
For example, the built in model could be initialised to generate 2D convolutional
+
For example, the built-in model could be initialised to generate 2D convolutional
connectivity with a \(3 \times 3\) kernel, a \(64 \times 64 \times 1\) input
and a \(62 \times 62 \times 1\) input:
snippet (Union[InitVarSnippetBase, str]) – variable init snippet, either as a string referencing
-a built in snipept (see init_var_snippets)
+a built-in snippet (see init_var_snippets)
or an instance of InitVarSnippetBase
(for example returned by create_var_init_snippet())
-
params (Dict[str, Union[int, float]]) – parameter values for the variable init snippet (see `Parameters`_)
+
params (Dict[str, Union[int, float]]) – parameter values for the variable init snippet (see `Parameters`_)
-
For example, the built in model could be initialised to initialise a variable
+
For example, the built-in model “Normal” could be used to initialise a variable
by sampling from the normal distribution with a mean of 0 and a standard deviation of 1:
init=init_var("Normal",{"mean":0.0,"sd":1.0})
@@ -2294,27 +2313,27 @@
Navigation
Parameters:
-
snippet – weight update model either as a string referencing a built in model
+
snippet – weight update model either as a string referencing a built-in model
(see weight_update_models) or an instance of
WeightUpdateModelBase (for example returned
by create_weight_update_model())
-
params (Dict[str, Union[int, float]]) – parameter values (see `Parameters`_)
+
params (Dict[str, Union[int, float]]) – parameter values (see `Parameters`_)
vars (Dict[str, Union[VarInit, int, float, ndarray, Sequence]]) – initial synaptic variable values or
-initialisers (see `Variables`_)
-
pre_vars (Dict[str, Union[VarInit, int, float, ndarray, Sequence]]) – initial presynaptic variable values or
initialisers (see `Variables`_)
+
pre_vars (Dict[str, Union[VarInit, int, float, ndarray, Sequence]]) – initial presynaptic variable values or
+initialisers (see `Variables`_)
pre_var_refs (Dict[str, VarReference]) – references to presynaptic neuron variables,
typically created using create_var_ref()
-(see `Variables references`_)
post_var_refs (Dict[str, VarReference]) – references to postsynaptic neuron variables,
typically created using create_var_ref()
-(see `Variables references`_)
GeNNModel.add_synapse_population() was becoming rather cumbersome and this was only made worse by postsynaptic models and weight update models now taking variable references.
To improve this:
Extra global parameters only support the ‘pointer’ form, awaiting a PR to implement settable parameters to replace the other sort
-
Removed implicit variable referneces
+
Extra global parameters used to be creatable with pointer types to allow models to access
+arbitrary sized arrays and non-pointer types to create parameters that could be modified at runtime.
+The latter use case is now handled much more efficiently using the `Dynamic parameters`_ system.
+
Weight update and postsynaptic models could previous refer to neuron variables via _implicit_
+references. For example $(V_pre) would refer to a variable called V on the presynaptic
+neuron population. This mechanism has been replaced by adding _explicit_ references to
+weight update, postsynaptic and current source model (see `Variables references`_).
The simulated spontaneous activity is asynchronous irregular and cell-type specific firing rates are in agreement
with in vivo recordings in awake animals, including the low rate of layer 2/3 excitatory cells.
This example can be used as follows:
-
learning rule to learn the transformation between fixed spike trains of
Poisson noise and a target spiking output (by default the Radcliffe Camera at Oxford).