Package ai.onnxruntime
Class OrtEnvironment.ThreadingOptions
- java.lang.Object
- 
- ai.onnxruntime.OrtEnvironment.ThreadingOptions
 
- 
- All Implemented Interfaces:
- java.lang.AutoCloseable
 - Enclosing class:
- OrtEnvironment
 
 public static final class OrtEnvironment.ThreadingOptions extends java.lang.Object implements java.lang.AutoCloseableControls the global thread pools in the environment. Only used if the session is constructed using an options withOrtSession.SessionOptions.disablePerSessionThreads()set.
- 
- 
Constructor SummaryConstructors Constructor Description ThreadingOptions()Create an empty threading options.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the threading options.voidsetGlobalDenormalAsZero()When this is set it causes intra-op and inter-op thread pools to flush denormal values to zero.voidsetGlobalInterOpNumThreads(int numThreads)Sets the number of threads available for inter-op parallelism (i.e.voidsetGlobalIntraOpNumThreads(int numThreads)Sets the number of threads available for intra-op parallelism (i.e.voidsetGlobalSpinControl(boolean allowSpinning)Allows spinning of thread pools when their queues are empty.
 
- 
- 
- 
Method Detail- 
closepublic void close() Closes the threading options.- Specified by:
- closein interface- java.lang.AutoCloseable
 
 - 
setGlobalInterOpNumThreadspublic void setGlobalInterOpNumThreads(int numThreads) throws OrtExceptionSets the number of threads available for inter-op parallelism (i.e. running multiple ops in parallel).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). - Parameters:
- numThreads- The number of threads.
- Throws:
- OrtException- If there was an error in native code.
 
 - 
setGlobalIntraOpNumThreadspublic void setGlobalIntraOpNumThreads(int numThreads) throws OrtExceptionSets 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). - Parameters:
- numThreads- The number of threads.
- Throws:
- OrtException- If there was an error in native code.
 
 - 
setGlobalSpinControlpublic void setGlobalSpinControl(boolean allowSpinning) throws OrtExceptionAllows spinning of thread pools when their queues are empty. 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. - Parameters:
- allowSpinning- If true allow the thread pools to spin.
- Throws:
- OrtException- If there was an error in native code.
 
 - 
setGlobalDenormalAsZeropublic void setGlobalDenormalAsZero() throws OrtExceptionWhen this is set it causes intra-op and inter-op thread pools to flush denormal values to zero.- Throws:
- OrtException- If there was an error in native code.
 
 
- 
 
-