File: compiledcode.txt

package info (click to toggle)
brian 1.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 18,216 kB
  • sloc: python: 49,547; cpp: 23,781; ansic: 5,182; makefile: 54
file content (43 lines) | stat: -rw-r--r-- 1,805 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
.. currentmodule:: brian

.. _compiled-code:

Compiled code
=============

Compiled C code can be used in several places in Brian to get speed improvements in cases where performance
is the most important factor.

Weave
-----

Weave is a SciPy module that allows the use of inlined C++ code. Brian by default doesn't use any C++
optimisations for maximum compatibility across platforms, but you can enable several optimised
versions of Brian objects and functions by enabling weave compilation. See :ref:`preferences`
for more information.

See also :ref:`efficiency-vectorisation` for some information on writing your own inlined C++ code
using Weave.

Circular arrays
---------------

For maximum compatibility, Brian works with pure Python only. However, as well as the optional
weave optimisations, there is also an object used in the spike propagation code that can run
with a pure C++ version for a considerable speedup (1.5-3x). You need a copy of the ``gcc`` compiler
installed (either on linux or through cygwin on Windows) to build it.

Installation:

In a command prompt or shell window, go to the directory where Brian is installed. On Windows this
will probably be ``C:\Python25\lib\site-packages\brian``. Now
go to the ``Brian/brian/utils/ccircular`` folder. If you're on Linux (and this may also work for Mac) run
the command ``python setup.py build_ext --inplace``. If you're on windows you'll need to have cygwin with gcc
installed, and then you run ``setup.py build_ext --inplace -c mingw32`` instead. You should see some
compilation, possibly with some warnings but no errors.

Automatically generated C code
------------------------------

There is an experimental module for automatic generation of C code, see
:ref:`experimental-codegen`.