[][src]Function opencv::core::set_num_threads

pub fn set_num_threads(nthreads: i32) -> Result<()>

OpenCV will try to set the number of threads for the next parallel region.

If threads == 0, OpenCV will disable threading optimizations and run all it's functions sequentially. Passing threads < 0 will reset threads number to system default. This function must be called outside of parallel region.

OpenCV will try to run its functions with specified threads number, but some behaviour differs from framework:

  • TBB - User-defined parallel constructions will run with the same threads number, if another is not specified. If later on user creates his own scheduler, OpenCV will use it.
  • OpenMP - No special defined behaviour.
  • Concurrency - If threads == 1, OpenCV will disable threading optimizations and run its functions sequentially.
  • GCD - Supports only values <= 0.
  • C= - No special defined behaviour.

Parameters

  • nthreads: Number of threads used by OpenCV.

See also

getNumThreads, getThreadNum