mirror of
https://github.com/opencv/opencv.git
synced 2024-11-28 21:20:18 +08:00
core: call omp_set_dynamic() for better CPU usage
Similar to 'OMP_DYNAMIC=TRUE'.
This commit is contained in:
parent
ad93ed720d
commit
4e62900009
@ -420,7 +420,16 @@ static int numThreads = -1;
|
||||
#elif defined HAVE_CSTRIPES
|
||||
// nothing for C=
|
||||
#elif defined HAVE_OPENMP
|
||||
static int numThreadsMax = omp_get_max_threads();
|
||||
static inline int _initMaxThreads()
|
||||
{
|
||||
int maxThreads = omp_get_max_threads();
|
||||
if (!utils::getConfigurationParameterBool("OPENCV_FOR_OPENMP_DYNAMIC_DISABLE", false))
|
||||
{
|
||||
omp_set_dynamic(maxThreads);
|
||||
}
|
||||
return numThreads;
|
||||
}
|
||||
static int numThreadsMax = _initMaxThreads();
|
||||
#elif defined HAVE_GCD
|
||||
// nothing for GCD
|
||||
#elif defined WINRT
|
||||
|
Loading…
Reference in New Issue
Block a user