| 1 |
Preferences (Brian 1 --> 2 conversion) |
| 2 |
======================================== |
| 3 |
.. sidebar:: Brian 2 documentation |
| 4 |
|
| 5 |
For the main documentation about preferences, see the document |
| 6 |
:doc:`../../advanced/preferences`. |
| 7 |
|
| 8 |
In Brian 1, preferences were set either with the function ``set_global_preferences`` or by creating a module |
| 9 |
somewhere on the Python path called ``brian_global_config.py``. |
| 10 |
|
| 11 |
|
| 12 |
Setting preferences |
| 13 |
------------------- |
| 14 |
|
| 15 |
The function ``set_global_preferences`` no longer exists in Brian 2. Instead, importing from ``brian2`` gives you a |
| 16 |
variable `prefs` that can be used to set preferences. For example, in Brian 1 you would write:: |
| 17 |
|
| 18 |
set_global_preferences(weavecompiler='gcc') |
| 19 |
|
| 20 |
In Brian 2 you would write:: |
| 21 |
|
| 22 |
prefs.codegen.cpp.compiler = 'gcc' |
| 23 |
|
| 24 |
Configuration file |
| 25 |
------------------ |
| 26 |
|
| 27 |
The module ``brian_global_config.py`` is not used by Brian 2, instead we search for configuration files in the |
| 28 |
current directory, user directory or installation directory. In Brian you would have a configuration file that looks |
| 29 |
like this:: |
| 30 |
|
| 31 |
from brian.globalprefs import * |
| 32 |
set_global_preferences(weavecompiler='gcc') |
| 33 |
|
| 34 |
In Brian 2 you would have a file like this:: |
| 35 |
|
| 36 |
codegen.cpp.compiler = 'gcc' |
| 37 |
|
| 38 |
Preference name changes |
| 39 |
----------------------- |
| 40 |
|
| 41 |
* ``defaultclock``: removed because it led to unclear behaviour of scripts. |
| 42 |
* ``useweave_linear_diffeq``: removed because it was no longer relevant. |
| 43 |
* ``useweave``: now replaced by `codegen.target` (but note that weave is no longer |
| 44 |
supported in Brian 2, use Cython instead). |
| 45 |
* ``weavecompiler``: now replaced by `codegen.cpp.compiler`. |
| 46 |
* ``gcc_options``: now replaced by `codegen.cpp.extra_compile_args_gcc`. |
| 47 |
* ``openmp``: now replaced by `devices.cpp_standalone.openmp_threads`. |
| 48 |
* ``usecodegen*``: removed because it was no longer relevant. |
| 49 |
* ``usenewpropagate``: removed because it was no longer relevant. |
| 50 |
* ``usecstdp``: removed because it was no longer relevant. |
| 51 |
* ``brianhears_usegpu``: removed because Brian Hears doesn't exist in Brian 2. |
| 52 |
* ``magic_useframes``: removed because it was no longer relevant. |