Brian2GeNN specific preferences

Connectivity

The preference devices.genn.connectivity determines what connectivity scheme is used within GeNN to represent the connections between neurons. GeNN supports the use of full connectivity matrices (‘DENSE’) or a representation where connections are represented with sparse matrix methods (‘SPARSE’). You can set the preference like this:

from brian2 import *
import brian2genn
set_device('genn')

prefs.devices.genn.connectivity = 'DENSE'

Compiler preferences

Brian2GeNN will use the compiler preferences specified for Brian2 for the C++ compiler call. This means you should set the codegen.cpp.extra_compile_args preference, or set codegen.cpp.extra_compile_args_gcc and codegen.cpp.extra_compile_args_msvc to set preferences specifically for compilation under Linux/OS-X and Windows, respectively.

Brian2GeNN also offers a preference to specify additional compiler flags for the CUDA compilation with the nvcc compiler: devices.genn.extra_compile_args_nvcc.

Note that all of the above preferences expect a Python list of individual compiler arguments, i.e. to for example add an argument for the nvcc compiler, use:

prefs.devices.genn.extra_compile_args_nvcc += ['--verbose']

On Windows, Brian2GeNN will try to find the file vcvarsall.bat to enable compilation with the MSVC compiler automatically. If this fails, or if you have multiple versions of MSVC installed and want to select a specific one, you can set the codegen.cpp.msvc_vars_location preference.

List of preferences

Preferences that relate to the brian2genn interface

devices.genn.auto_choose_device = True
The GeNN preference autoChooseDevice that determines whether or not a GPU should be chosen automatically when multiple CUDA enabled devices are present.

devices.genn.connectivity = 'SPARSE'

This preference determines which connectivity scheme is to be employed within GeNN. The valid alternatives are ‘DENSE’ and ‘SPARSE’. For ‘DENSE’ the GeNN dense matrix methods are used for all connectivity matrices. When ‘SPARSE’ is chosen, the GeNN sparse matrix representations are used.
devices.genn.cuda_path = None
The path to the CUDA installation (if not set, the CUDA_PATH environment variable will be used instead)
devices.genn.default_device = 0
The GeNN preference defaultDevice that determines CUDA enabled device should be used if it is not automatically chosen.
devices.genn.extra_compile_args_nvcc = ['-O3']
Extra compile arguments (a list of strings) to pass to the nvcc compiler.
devices.genn.init_blocksize = 32
The GeNN preference initBlockSize that determines the CUDA block size for the neuron kernel if not set automatically by GeNN’s block size optimisation.
devices.genn.init_sparse_blocksize = 32
The GeNN preference initSparseBlockSize that determines the CUDA block size for the neuron kernel if not set automatically by GeNN’s block size optimisation.
devices.genn.learning_blocksize = 32
The GeNN preference learningBlockSize that determines the CUDA block size for the neuron kernel if not set automatically by GeNN’s block size optimisation.
devices.genn.neuron_blocksize = 32
The GeNN preference neuronBlockSize that determines the CUDA block size for the neuron kernel if not set automatically by GeNN’s block size optimisation.
devices.genn.optimise_blocksize = True
The GeNN preference optimiseBlockSize that determines whether GeNN should use its internal algorithms to optimise the different block sizes.
devices.genn.path = None
The path to the GeNN installation (if not set, the GENN_PATH environment variable will be used instead)
devices.genn.pre_synapse_reset_blocksize = 32
The GeNN preference preSynapseResetBlockSize that determines the CUDA block size for the pre-synapse reset kernel if not set automatically by GeNN’s block size optimisation.
devices.genn.synapse_blocksize = 32
The GeNN preference synapseBlockSize that determines the CUDA block size for the neuron kernel if not set automatically by GeNN’s block size optimisation.
devices.genn.synapse_dynamics_blocksize = 32
The GeNN preference synapseDynamicsBlockSize that determines the CUDA block size for the neuron kernel if not set automatically by GeNN’s block size optimisation.