#-------------------------------------------------------------------------------
# Cython runtime codegen preferences
#-------------------------------------------------------------------------------

[codegen.runtime.cython]

# Whether to use a lock file to prevent simultaneous write access
# to cython .pyx and .so files.

multiprocess_safe = True

#-------------------------------------------------------------------------------
# Core Brian preferences
#-------------------------------------------------------------------------------

[core]

# Default dtype for all arrays of scalars (state variables, weights, etc.).

default_float_dtype = float64

# Default dtype for all arrays of integer scalars.

default_integer_dtype = int32

# Whether to raise an error for outdated dependencies (``True``) or just
# a warning (``False``).

outdated_dependency_error = True

#-------------------------------------------------------------------------------
# Logging system preferences
#-------------------------------------------------------------------------------

[logging]

# What log level to use for the log written to the console.
# 
# Has to be one of CRITICAL, ERROR, WARNING, INFO or DEBUG.

console_log_level = 'WARNING'

# Whether to delete the log and script file on exit.
# 
# If set to ``True`` (the default), log files (and the copy of the main
# script) will be deleted after the brian process has exited, unless an
# uncaught exception occured. If set to ``False``, all log files will be kept.

delete_log_on_exit = True

# Whether to log to a file or not.
# 
# If set to ``True`` (the default), logging information will be written
# to a file. The log level can be set via the `logging.file_log_level`
# preference.

file_log = True

# What log level to use for the log written to the log file.
# 
# In case file logging is activated (see `logging.file_log`), which log
# level should be used for logging. Has to be one of CRITICAL, ERROR,
# WARNING, INFO or DEBUG.

file_log_level = 'DEBUG'

# Whether to save a copy of the script that is run.
# 
# If set to ``True`` (the default), a copy of the currently run script
# is saved to a temporary location. It is deleted after a successful
# run (unless `logging.delete_log_on_exit` is ``False``) but is kept after
# an uncaught exception occured. This can be helpful for debugging,
# in particular when several simulations are running in parallel.

save_script = True

# Whether or not to redirect stdout/stderr to null at certain places.
# 
# This silences a lot of annoying compiler output, but will also hide
# error messages making it harder to debug problems. You can always
# temporarily switch it off when debugging. In any case, the output
# is saved to a file and if an error occurs the name of this file
# will be printed.

std_redirection = True

#-------------------------------------------------------------------------------
# Network preferences
#-------------------------------------------------------------------------------

[core.network]

# Default schedule used for networks that
# don't specify a schedule.

default_schedule = ['start', 'groups', 'thresholds', 'synapses', 'resets', 'end']

#-------------------------------------------------------------------------------
# Numpy runtime codegen preferences
#-------------------------------------------------------------------------------

[codegen.runtime.numpy]

# Whether to change the namespace of user-specifed functions to remove
# units.

discard_units = False

#-------------------------------------------------------------------------------
# C++ standalone preferences
#-------------------------------------------------------------------------------

[devices.cpp_standalone]

# The number of threads to use if OpenMP is turned on. By default, this value is set to 0 and the C++ code
# is generated without any reference to OpenMP. If greater than 0, then the corresponding number of threads
# are used to launch the simulation.

openmp_threads = 0

#-------------------------------------------------------------------------------
# Device preferences
#-------------------------------------------------------------------------------

[devices]

#-------------------------------------------------------------------------------
# Code generation preferences
#-------------------------------------------------------------------------------

[codegen]

# Whether to pull out scalar expressions out of the statements, so that
# they are only evaluated once instead of once for every neuron/synapse/...
# Can be switched off, e.g. because it complicates the code (and the same
# optimisation is already performed by the compiler) or because the
# code generation target does not deal well with it. Defaults to ``True``.

loop_invariant_optimisations = True

# Default target for the evaluation of string expressions (e.g. when
# indexing state variables). Should normally not be changed from the
# default numpy target, because the overhead of compiling code is not
# worth the speed gain for simple expressions.
# 
# Accepts the same arguments as `codegen.target`, except for ``'auto'``

string_expression_target = 'numpy'

# Default target for code generation.
# 
# Can be a string, in which case it should be one of:
# 
# * ``'auto'`` the default, automatically chose the best code generation
#   target available.
# * ``'weave'`` uses ``scipy.weave`` to generate and compile C++ code,
#   should work anywhere where ``gcc`` is installed and available at the
#   command line.
# * ``'cython'``, uses the Cython package to generate C++ code. Needs a
#   working installation of Cython and a C++ compiler.
# * ``'numpy'`` works on all platforms and doesn't need a C compiler but
#   is often less efficient.
# 
# Or it can be a ``CodeObject`` class.

target = 'auto'

#-------------------------------------------------------------------------------
# Runtime codegen preferences (see subcategories for individual targets)
#-------------------------------------------------------------------------------

[codegen.runtime]

#-------------------------------------------------------------------------------
# C++ codegen preferences
#-------------------------------------------------------------------------------

[codegen.generators.cpp]

# Adds code to flush denormals to zero.
# 
# The code is gcc and architecture specific, so may not compile on all
# platforms. The code, for reference is::
# 
#     #define CSR_FLUSH_TO_ZERO         (1 << 15)
#     unsigned csr = __builtin_ia32_stmxcsr();
#     csr |= CSR_FLUSH_TO_ZERO;
#     __builtin_ia32_ldmxcsr(csr);
#     
# Found at `<http://stackoverflow.com/questions/2487653/avoiding-denormal-values-in-c>`_.

flush_denormals = False

# The keyword used for the given compiler to declare pointers as restricted.
# 
# This keyword is different on different compilers, the default works for
# gcc and MSVS.

restrict_keyword = '__restrict'

#-------------------------------------------------------------------------------
# Codegen generator preferences (see subcategories for individual languages)
#-------------------------------------------------------------------------------

[codegen.generators]

#-------------------------------------------------------------------------------
# C++ compilation preferences
#-------------------------------------------------------------------------------

[codegen.cpp]

# Compiler to use (uses default if empty)
# 
# Should be gcc or msvc.

compiler = ''

# List of macros to define; each macro is defined using a 2-tuple,
# where 'value' is either the string to define it to or None to
# define it without a particular value (equivalent of "#define
# FOO" in source or -DFOO on Unix C compiler command line).

define_macros = []

# Extra arguments to pass to compiler (if None, use either
# ``extra_compile_args_gcc`` or ``extra_compile_args_msvs``).

extra_compile_args = None

# Extra compile arguments to pass to GCC compiler

extra_compile_args_gcc = ['-w', '-O3']

# Extra compile arguments to pass to MSVC compiler

extra_compile_args_msvc = ['/Ox', '/EHsc', '/w']

# Any extra platform- and compiler-specific information to use when
# linking object files together.

extra_link_args = []

# A list of strings specifying header files to use when compiling the
# code. The list might look like ["<vector>","'my_header'"]. Note that
# the header strings need to be in a form than can be pasted at the end
# of a #include statement in the C++ code.

headers = []

# Include directories to use. Note that ``$prefix/include`` will be
# appended to the end automatically, where ``$prefix`` is Python's
# site-specific directory prefix as returned by `sys.prefix`.

include_dirs = []

# List of library names (not filenames or paths) to link against.

libraries = []

# List of directories to search for C/C++ libraries at link time.

library_dirs = []

# MSVC architecture name (or use system architectue by default).
# 
# Could take values such as x86, amd64, etc.

msvc_architecture = ''

# Location of the MSVC command line tool (or search for best by default).

msvc_vars_location = ''

# List of directories to search for C/C++ libraries at run time.

runtime_library_dirs = []

