Class OrtThreadingOptions
This class allows to specify global thread pool options when instantiating the ONNX Runtime environment for the first time.
Inheritance
Implements
Inherited Members
Namespace: Microsoft.ML.OnnxRuntime
Assembly: Microsoft.ML.OnnxRuntime.dll
Syntax
public class OrtThreadingOptions : SafeHandle, IDisposable
Constructors
| Improve this Doc View SourceOrtThreadingOptions()
Create an empty threading options.
Declaration
public OrtThreadingOptions()
Properties
| Improve this Doc View SourceGlobalInterOpNumThreads
Set global inter-op thread count. Setting it to 0 will allow ORT to choose the number of threads used for parallelization of multiple kernels. Setting it to 1 will cause the main thread to be used (i.e., no thread pools will be used). This setting is only meaningful when the execution mode is set to Parallel.
Declaration
public int GlobalInterOpNumThreads { set; }
Property Value
Type | Description |
---|---|
Int32 |
GlobalIntraOpNumThreads
Sets the number of threads available for intra-op parallelism (i.e. within a single op). Setting it to 0 will allow ORT to choose the number of threads, setting it to 1 will cause the main thread to be used (i.e., no thread pools will be used).
Declaration
public int GlobalIntraOpNumThreads { set; }
Property Value
Type | Description |
---|---|
Int32 |
GlobalSpinControl
Allows spinning of thread pools when their queues are empty in anticipation of imminent task arrival. This call sets the value for both inter-op and intra-op thread pools. If the CPU usage is very high then do not enable this.
Declaration
public bool GlobalSpinControl { set; }
Property Value
Type | Description |
---|---|
Boolean |
IsInvalid
Overrides SafeHandle.IsInvalid
Declaration
public override bool IsInvalid { get; }
Property Value
Type | Description |
---|---|
Boolean | returns true if handle is equal to Zero |
Overrides
Methods
| Improve this Doc View SourceReleaseHandle()
Overrides SafeHandle.ReleaseHandle() to properly dispose of the native instance of ThreadingOptions
Declaration
protected override bool ReleaseHandle()
Returns
Type | Description |
---|---|
Boolean | always returns true |
Overrides
SetGlobalDenormalAsZero()
When this is set it causes intra-op and inter-op thread pools to flush denormal values to zero.
Declaration
public void SetGlobalDenormalAsZero()