Installation

Requirements

We recommend installing Brian2CUDA in a separate Python environment, either using a “virtual environment” or a “conda environment”. If you are unfamiliar with that, check out the Brian2 installation instructions.

Standard install

To install Brian2CUDA with a compatible Brian2 version, use pip:

python -m pip install brian2cuda

Updating an existing installation

Use the install command together with the --upgrade option:

python -m pip install --upgrade brian2cuda

This will also update the installed Brian2 version if required.

Development install

When you encounter a problem in BrianCUDA, we will sometimes ask you to install Brian2CUDA’s latest development version, which includes changes that were included after its last release.

We regularly upload the latest development version of Brian2CUDA to PyPI’s test server. You can install it via:

python -m pip install --upgrade --pre -i https://test.pypi.org/simple/ brian2cuda

Note that this requires that you already have a compatible Brian2 version and all of its dependencies installed.

If you have git installed, you can also install directly from github:

python -m pip install git+https://github.com/brian-team/brian2cuda.git

If you want to either contribute to Brian’s development or regularly test its latest development version, you can directly clone the git repository at github (https://github.com/brian-team/brian2cuda) and then run pip install -e /path/to/brian2cuda, to install Brian2CUDA in “development mode”. As long as the compatible Brian2 version doesn’t change, updating the git repository is in general enough to keep up with changes in the code, i.e. it is not necessary to install it again. If the compatible Brian2 versions changes though, you need to manually update Brian2.

Testing your installation

Brian2CUDA tries to automatically detect your CUDA toolkit installation and choose the newest GPU on your system to run simulations. To test if this detection and your installation were successful, you can run this test simulation:

import brian2cuda
brian2cuda.example_run()

If the automatic CUDA and GPU detection fails or you want to manually change it, read Configuring the CUDA backend.

Running the Brian2CUDA test suit

If you have the pytest testing utility installed, you can run Brian2CUDA’s test suite:

import brian2cuda
brian2cuda.test()

This runs all standalone-comatible tests from the Brian2 test suite and additional Brian2CUDA tests (see the Brian2 developer documentation on testing for more details) and can take 1-2 hours, depending on your hardware. The test suite should end with “OK”, showing a number of skipped tests but no errors or failures. If you want to run individual tests instead of the entire test suite (e.g. during development), check out the Brian2CUDA tools directory.