Show / Hide Table of Contents

Class OrtThreadingOptions

This class allows to specify global thread pool options when instantiating the ONNX Runtime environment for the first time.

Inheritance
Object
CriticalFinalizerObject
SafeHandle
OrtThreadingOptions
Implements
IDisposable
Inherited Members
SafeHandle.handle
SafeHandle.Close()
SafeHandle.DangerousAddRef(Boolean)
SafeHandle.DangerousGetHandle()
SafeHandle.DangerousRelease()
SafeHandle.Dispose()
SafeHandle.Dispose(Boolean)
SafeHandle.SetHandle(IntPtr)
SafeHandle.SetHandleAsInvalid()
SafeHandle.IsClosed
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Microsoft.ML.OnnxRuntime
Assembly: Microsoft.ML.OnnxRuntime.dll
Syntax
public class OrtThreadingOptions : SafeHandle, IDisposable

Constructors

| Improve this Doc View Source

OrtThreadingOptions()

Create an empty threading options.

Declaration
public OrtThreadingOptions()

Properties

| Improve this Doc View Source

GlobalInterOpNumThreads

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
| Improve this Doc View Source

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
| Improve this Doc View Source

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
| Improve this Doc View Source

IsInvalid

Overrides SafeHandle.IsInvalid

Declaration
public override bool IsInvalid { get; }
Property Value
Type Description
Boolean

returns true if handle is equal to Zero

Overrides
System.Runtime.InteropServices.SafeHandle.IsInvalid

Methods

| Improve this Doc View Source

ReleaseHandle()

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
System.Runtime.InteropServices.SafeHandle.ReleaseHandle()
| Improve this Doc View Source

SetGlobalDenormalAsZero()

When this is set it causes intra-op and inter-op thread pools to flush denormal values to zero.

Declaration
public void SetGlobalDenormalAsZero()

Implements

System.IDisposable
  • Improve this Doc
  • View Source
In This Article
Back to top