brainevent.load_cpp_inline#
- brainevent.load_cpp_inline(name, cpp_sources, functions=None, *, extra_cflags=None, extra_ldflags=None, extra_include_paths=None, build_directory=None, verbose=False, force_rebuild=False, replace=False, auto_register=True, target_prefix=None)[source]#
Compile inline C++ source for CPU (or CUDA) and load the module.
This is the CPU counterpart of
load_cuda_inline(). It uses the system C++ compiler (g++/clang++) instead ofnvcc, so CUDA is not required.- Parameters:
name (
str) – Module name (used for caching and FFI target naming).cpp_sources (
str|list[str]) – C++ source code. Multiple strings are concatenated.functions (
dict[str,list[str]] |list[str] |None) –Dict form (explicit):
{"func": ["arg", "ret", ...]}— same arg_spec tokens asload_cuda_inline().List form (auto-detect):
["func"]— the arg_spec is inferred from the C++ signature.const BE::Tensor→"arg", non-constBE::Tensor→"ret".None (annotation): functions are discovered from
// @BE function_nameannotations in the source code.extra_cflags (
list[str] |None) – Additional compiler / linker flags and include paths.extra_ldflags (
list[str] |None) – Additional compiler / linker flags and include paths.extra_include_paths (
list[str] |None) – Additional compiler / linker flags and include paths.build_directory (
str|None) – Override the build directory.verbose (
bool) – Print the full compiler command.force_rebuild (
bool) – Skip the cache and recompile. Recompiling unchanged source under the same name re-registers as a no-op; recompiling changed source under the same name raises an actionableKernelRegistrationError(register under a distinctname=/target_prefix=) instead of silently dispatching stale native code (audit finding 4). Passesreplacethrough to registration.replace (
bool) – Reserved for forward compatibility. On the installed JAX a live FFI target cannot be re-pointed to new code in a verifiable way, so rebuilding a changed kernel under an existing target name raises deterministically (on all platforms) whether or not this is set — never silently serving stale native code. To run edited kernel source live, register the rebuild under a distinctname=/target_prefix=. Seeregister_ffi_target()Notes for the probe details.auto_register (
bool) – Automatically register FFI targets as"<prefix>.<func>".target_prefix (
str|None) – Prefix for auto-registered FFI targets. Defaults to name.
- Return type: