|
|
|
@ -78,13 +78,12 @@ |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
/* IMPORTANT: always use the same order of defines
|
|
|
|
|
1. HAVE_TBB - 3rdparty library, should be explicitly enabled |
|
|
|
|
2. HAVE_CSTRIPES - 3rdparty library, should be explicitly enabled |
|
|
|
|
3. HAVE_OPENMP - integrated to compiler, should be explicitly enabled |
|
|
|
|
4. HAVE_GCD - system wide, used automatically (APPLE only) |
|
|
|
|
5. WINRT - system wide, used automatically (Windows RT only) |
|
|
|
|
6. HAVE_CONCURRENCY - part of runtime, used automatically (Windows only - MSVS 10, MSVS 11) |
|
|
|
|
7. HAVE_PTHREADS_PF - pthreads if available |
|
|
|
|
- HAVE_TBB - 3rdparty library, should be explicitly enabled |
|
|
|
|
- HAVE_OPENMP - integrated to compiler, should be explicitly enabled |
|
|
|
|
- HAVE_GCD - system wide, used automatically (APPLE only) |
|
|
|
|
- WINRT - system wide, used automatically (Windows RT only) |
|
|
|
|
- HAVE_CONCURRENCY - part of runtime, used automatically (Windows only - MSVS 10, MSVS 11) |
|
|
|
|
- HAVE_PTHREADS_PF - pthreads if available |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
#if defined HAVE_TBB |
|
|
|
@ -96,9 +95,6 @@ |
|
|
|
|
#endif |
|
|
|
|
#undef min |
|
|
|
|
#undef max |
|
|
|
|
#elif defined HAVE_CSTRIPES |
|
|
|
|
#include "C=.h" |
|
|
|
|
#undef shared |
|
|
|
|
#elif defined HAVE_OPENMP |
|
|
|
|
#include <omp.h> |
|
|
|
|
#elif defined HAVE_GCD |
|
|
|
@ -113,8 +109,6 @@ |
|
|
|
|
|
|
|
|
|
#if defined HAVE_TBB |
|
|
|
|
# define CV_PARALLEL_FRAMEWORK "tbb" |
|
|
|
|
#elif defined HAVE_CSTRIPES |
|
|
|
|
# define CV_PARALLEL_FRAMEWORK "cstripes" |
|
|
|
|
#elif defined HAVE_OPENMP |
|
|
|
|
# define CV_PARALLEL_FRAMEWORK "openmp" |
|
|
|
|
#elif defined HAVE_GCD |
|
|
|
@ -385,8 +379,6 @@ namespace |
|
|
|
|
tbb::parallel_for(tbb::blocked_range<int>(range.start, range.end), *this); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
#elif defined HAVE_CSTRIPES || defined HAVE_OPENMP |
|
|
|
|
typedef ParallelLoopBodyWrapper ProxyLoopBody; |
|
|
|
|
#elif defined HAVE_GCD |
|
|
|
|
typedef ParallelLoopBodyWrapper ProxyLoopBody; |
|
|
|
|
static void block_function(void* context, size_t index) |
|
|
|
@ -419,8 +411,6 @@ static int numThreads = -1; |
|
|
|
|
#else |
|
|
|
|
static tbb::task_scheduler_init tbbScheduler(tbb::task_scheduler_init::deferred); |
|
|
|
|
#endif |
|
|
|
|
#elif defined HAVE_CSTRIPES |
|
|
|
|
// nothing for C=
|
|
|
|
|
#elif defined HAVE_OPENMP |
|
|
|
|
static int numThreadsMax = omp_get_max_threads(); |
|
|
|
|
#elif defined HAVE_GCD |
|
|
|
@ -520,17 +510,6 @@ static void parallel_for_impl(const cv::Range& range, const cv::ParallelLoopBody |
|
|
|
|
pbody(); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#elif defined HAVE_CSTRIPES |
|
|
|
|
|
|
|
|
|
parallel(MAX(0, numThreads)) |
|
|
|
|
{ |
|
|
|
|
int offset = stripeRange.start; |
|
|
|
|
int len = stripeRange.end - offset; |
|
|
|
|
Range r(offset + CPX_RANGE_START(len), offset + CPX_RANGE_END(len)); |
|
|
|
|
pbody(r); |
|
|
|
|
barrier(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#elif defined HAVE_OPENMP |
|
|
|
|
|
|
|
|
|
#pragma omp parallel for schedule(dynamic) num_threads(numThreads > 0 ? numThreads : numThreadsMax) |
|
|
|
@ -602,12 +581,6 @@ int cv::getNumThreads(void) |
|
|
|
|
: tbb::task_scheduler_init::default_num_threads(); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#elif defined HAVE_CSTRIPES |
|
|
|
|
|
|
|
|
|
return numThreads > 0 |
|
|
|
|
? numThreads |
|
|
|
|
: cv::getNumberOfCPUs(); |
|
|
|
|
|
|
|
|
|
#elif defined HAVE_OPENMP |
|
|
|
|
|
|
|
|
|
return numThreads > 0 |
|
|
|
@ -682,10 +655,6 @@ void cv::setNumThreads( int threads_ ) |
|
|
|
|
if(threads > 0) tbbScheduler.initialize(threads); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#elif defined HAVE_CSTRIPES |
|
|
|
|
|
|
|
|
|
return; // nothing needed
|
|
|
|
|
|
|
|
|
|
#elif defined HAVE_OPENMP |
|
|
|
|
|
|
|
|
|
return; // nothing needed as num_threads clause is used in #pragma omp parallel for
|
|
|
|
@ -735,8 +704,6 @@ int cv::getThreadNum(void) |
|
|
|
|
#else |
|
|
|
|
return 0; |
|
|
|
|
#endif |
|
|
|
|
#elif defined HAVE_CSTRIPES |
|
|
|
|
return pix(); |
|
|
|
|
#elif defined HAVE_OPENMP |
|
|
|
|
return omp_get_thread_num(); |
|
|
|
|
#elif defined HAVE_GCD |
|
|
|
|