Brian2GeNN specific preferences


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

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.path = None
The path to the GeNN installation (if not set, the GENN_PATH environment variable will be used instead)