Class anira::Context#

class Context#

An anira_context with its lifetime: a refcounted handle over this copy’s core, created from a ContextConfig (section 4). Two contexts in one copy are two views of one core with two log sinks.

A plugin destroys its handlers, then its contexts, before its host unloads it (its instance teardown or module-exit entry point), and never from its own static destructors, which run inside the unload under the loader lock. On ELF and Mach-O a library unloaded with an inference still running aborts with a message on stderr after a bounded wait (see anira_shutdown and the usage guide’s section on teardown).

Public Functions

inline explicit Context(const ContextConfig &config)#
Throws:

Error – when the C entry refuses the config (a device block, an unconsumed context extension).

inline ~Context()#
Context(const Context&) = delete#
Context &operator=(const Context&) = delete#
inline Context(Context &&other) noexcept#
inline Context &operator=(Context &&other) noexcept#
inline Capabilities capabilities() const#
inline void probe()#

Re-runs the probe in full: the runtimes are asked anew and the memory kinds the context kept are forgotten (anira_context_probe).

inline uint64_t byte_image_bytes(uint64_t num_elements, DType dtype) const#

The size of a tensor’s byte image under the edges this context probed.

inline const anira_context *native() const noexcept#
inline anira_context *native() noexcept#