runtime_parameters.h#
Tunable, model-independent knobs controlling how a graph is evaluated through :cpp:func:RunNode / :cpp:class:RuntimeSession.
-
namespace onnx_light
Alias that makes onnx-light headers compatible with code that references
ONNX_LIGHT_NAMESPACE(the macro used in the standard onnx package).Set to
ONNX_LIGHT_NAMESPACEso both names resolve to the same namespace.Symbol-visibility attribute for the public onnx-light C++ API.
Maps the upstream compatibility macro to onnx-light’s explicit proto ABI annotation. This keeps declarations from vendored ONNX headers visible when
lib_onnx_protouses hidden visibility by default.Namespace alias so that ONNX C++ code (and consumers such as onnxruntime) that refers to the literal
onnxnamespace — rather than theONNX_NAMESPACEmacro — resolves to the onnx-light namespace. The standard onnx package lives innamespace onnx; onnx-light usesonnx_light(via ONNX_LIGHT_NAMESPACE), so this alias keeps onnx-light a true drop-in. It is only introduced when the onnx-light namespace differs fromonnx.-
namespace core
-
namespace runtime
-
struct RuntimeParameters#
- #include <runtime_parameters.h>
Bundles the model-independent execution settings shared across the nodes of a graph evaluated through :cpp:func:
RunNode/ :cpp:class:RuntimeSession.Today the only knob is :cpp:var:
num_threads, the requested degree of parallelism. Grouping it in a dedicated struct keeps the :cpp:class:RuntimeContextinterface stable as more tuning knobs (for example a thread-pool handle or a device descriptor) are added later without forcing every call site to take an extra argument.Public Functions
-
RuntimeParameters() = default#
-
inline explicit RuntimeParameters(int32_t num_threads_)#
-
int32_t EffectiveNumThreads() const noexcept#
Returns the concrete number of threads to use, resolving the special
num_threadsvalues to an actual count.0and any negative value resolve to the detected physical-core count, falling back to the logical-core count, thenstd::thread::hardware_concurrency(), and finally1. Every other value is returned unchanged. The result is always>= 1.Returns: The effective number of threads, always at least
1.
-
inline bool is_parallel() const noexcept#
Returns
truewhen the graph should be executed with more than one thread, i.e. when :cpp:func:EffectiveNumThreadsis greater than1.Returns:
truewhen parallel execution is enabled,falseotherwise.
Public Members
-
int32_t num_threads = 0#
Number of threads used to parallelize the execution of a graph.
0(default): use one thread per detected physical CPU core.1: no parallelization, everything runs on the calling thread.> 1: use exactly this many worker threads.< 0: treated the same as0(use the number of CPU cores).
-
RuntimeParameters() = default#
-
struct RuntimeParameters#
-
namespace runtime
-
namespace core