Loading...
Searching...
No Matches
configuration.h
Go to the documentation of this file.
190[[nodiscard]] inline bool is_bf16_training() { return Configuration::instance().is_bf16_training(); }
192[[nodiscard]] inline bool is_bf16_inference() { return Configuration::instance().is_bf16_inference(); }
Global singleton holding the OpenNN device and precision configuration.
Definition configuration.h:126
const Resolved & resolve() const
Returns the cached resolved configuration, computing it on first access.
Definition configuration.h:157
Type get_training_type() const
Definition configuration.h:153
bool is_bf16_inference() const
Definition configuration.h:169
Type get_inference_type() const
Definition configuration.h:154
static Configuration & instance()
Returns the process-wide Configuration singleton.
Definition configuration.h:138
void set(Device new_device=Device::Auto, Type new_training_type=Type::Auto, Type new_inference_type=Type::Auto)
Updates device and precision settings; subsequent resolve() calls reflect the change.
Definition adaptive_moment_estimation.h:14
bool is_cpu()
Returns true when the resolved configuration runs on CPU.
Definition configuration.h:188
Device current_device()
Returns the active runtime device (CUDA if available, otherwise CPU).
Definition configuration.h:194
Index type_bytes(Type type) noexcept
Returns the byte size of one element of the given OpenNN Type.
Definition configuration.h:111
bool is_bf16_inference()
Returns true when inference is configured to use BF16 precision.
Definition configuration.h:192
Device
Execution device selection for OpenNN runtime (auto-detected, CPU or CUDA GPU).
Definition configuration.h:17
void throw_if(bool condition, const string &message, const source_location &loc=source_location::current())
Definition pch.h:147
bool is_gpu()
Returns true when the resolved configuration runs on a CUDA GPU.
Definition configuration.h:186
cudnnDataType_t to_cudnn(Type type) noexcept
Returns the cuDNN data type matching the given OpenNN Type (Auto resolves to FP32).
Definition configuration.h:83
Type
Numeric precision used for training or inference tensors.
Definition configuration.h:20
void visit_type(Type t, F &&f)
Dispatches f with the TypeInfo of the runtime Type t (must be in Supported).
Definition configuration.h:59
cudaDataType_t to_cuda(Type type) noexcept
Returns the CUDA data type matching the given OpenNN Type (Auto resolves to FP32).
Definition configuration.h:97
bool is_bf16_training()
Returns true when training is configured to use BF16 precision.
Definition configuration.h:190
void visit_type_pair(Type t_in, Type t_out, F &&f)
Dispatches f with the TypeInfo pair for an input and output runtime Type.
Definition configuration.h:71
Resolved configuration after Auto values are mapped to concrete device and types.
Definition configuration.h:131
static constexpr cudaDataType_t cuda
Definition configuration.h:40
static constexpr cudnnDataType_t cudnn
Definition configuration.h:39
static constexpr cudnnDataType_t cudnn
Definition configuration.h:29
static constexpr cudaDataType_t cuda
Definition configuration.h:30
static constexpr cudaDataType_t cuda
Definition configuration.h:50
static constexpr cudnnDataType_t cudnn
Definition configuration.h:49
Compile-time traits mapping an opennn::Type to its underlying numeric type and library identifiers.
Definition configuration.h:23