brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
code-generationChoose Brian2 runtime and C++ standalone code-generation targets, manage builds and reusable runs, and recover compiler, cache, result-directory, and optional GSL failures.
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this route when the task names prefs.codegen.target, Cython, NumPy code
objects, set_device, cpp_standalone, a compiler/build directory, repeated
standalone runs, run_args, or GSL integration. This sub-skill is written for
Brian2 2.9.0 and Python >=3.12.
runtime device. Start
with prefs.codegen.target = "auto"; it prefers Cython when its test
compilation succeeds and otherwise falls back to NumPy with a warning.
Choose "numpy" explicitly when compiler setup is unavailable or a
reproducible no-compiler fallback is more important than speed.prefs.codegen.target = "cython" only after
Cython and a working C++ compiler are available. The first use compiles and
caches extensions; later compatible code can reuse the cache.set_device("cpp_standalone") before model
construction. Use the default build_on_run=True for one final run; use
build_on_run=False for multiple run statements or a build/reuse loop.
device.build controls generation, compilation, and optional first
execution: compile=False writes a project but cannot run it, while
run_args is forwarded to that first execution. Read
standalone-workflows.md before
changing a runtime script.device.build(run=False) and call
device.run(run_args=..., results_directory=...) for subsequent full
executions. run_args accepts VariableView/TimedArray mappings or
command-line assignment lists; result directories are relative to the
project and must be unique when outputs are retained or concurrent. The
model and externally defined constants are not generally mutable after
compilation; use equation variables with suitable flags and run_args
instead.method="gsl" and the gsl_* methods as an
optional native-library path. Runtime GSL needs Cython plus GSL; standalone
also needs GSL headers and libraries. If unavailable, use a supported
non-GSL state updater and record the numerical/feature limitation.get_device() returns the active device and device is a proxy to it. A
set_device call is global to the current process; restore the runtime
device when a larger application continues after a standalone section.device.delete(data=True, ...)
targets the active result directory; use a disposable project or explicitly
remove older result directories as well.run_args, result directories, and standalone limitations.For a safe native smoke after the integrated skill has been prepared, run the
bundled script with --help first and then, only with an intentionally prepared
compiler, run the default tiny check:
python scripts/standalone_smoke.py --help
python scripts/standalone_smoke.py
The script uses a temporary output directory, a tiny deterministic model, and cleanup. It is not a substitute for a real project build of a user's model.