Commit bf5393ae authored by kalistratovag's avatar kalistratovag

parallel for on pthreads initial commit

removing trailing whitespaces

Compilation error on Mac fix & warning on android

Warnings fixed on iOs
parent 96c3f16a
...@@ -188,6 +188,7 @@ OCV_OPTION(WITH_QUICKTIME "Use QuickTime for Video I/O insted of QTKit" OFF ...@@ -188,6 +188,7 @@ OCV_OPTION(WITH_QUICKTIME "Use QuickTime for Video I/O insted of QTKit" OFF
OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF IF (NOT IOS AND NOT WINRT) ) OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF IF (NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_OPENMP "Include OpenMP support" OFF) OCV_OPTION(WITH_OPENMP "Include OpenMP support" OFF)
OCV_OPTION(WITH_CSTRIPES "Include C= support" OFF IF (WIN32 AND NOT WINRT) ) OCV_OPTION(WITH_CSTRIPES "Include C= support" OFF IF (WIN32 AND NOT WINRT) )
OCV_OPTION(WITH_PTHREADS_PF "Use pthreads-based parallel_for" OFF IF (NOT WIN32) )
OCV_OPTION(WITH_TIFF "Include TIFF support" ON IF (NOT IOS) ) OCV_OPTION(WITH_TIFF "Include TIFF support" ON IF (NOT IOS) )
OCV_OPTION(WITH_UNICAP "Include Unicap support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) ) OCV_OPTION(WITH_UNICAP "Include Unicap support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON IF (UNIX AND NOT ANDROID) ) OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON IF (UNIX AND NOT ANDROID) )
...@@ -1067,6 +1068,7 @@ status(" Use OpenMP:" HAVE_OPENMP THEN YES ELSE NO) ...@@ -1067,6 +1068,7 @@ status(" Use OpenMP:" HAVE_OPENMP THEN YES ELSE NO)
status(" Use GCD" HAVE_GCD THEN YES ELSE NO) status(" Use GCD" HAVE_GCD THEN YES ELSE NO)
status(" Use Concurrency" HAVE_CONCURRENCY THEN YES ELSE NO) status(" Use Concurrency" HAVE_CONCURRENCY THEN YES ELSE NO)
status(" Use C=:" HAVE_CSTRIPES THEN YES ELSE NO) status(" Use C=:" HAVE_CSTRIPES THEN YES ELSE NO)
status(" Use pthreads for parallel for:" HAVE_PTHREADS_PF THEN YES ELSE NO)
status(" Use Cuda:" HAVE_CUDA THEN "YES (ver ${CUDA_VERSION_STRING})" ELSE NO) status(" Use Cuda:" HAVE_CUDA THEN "YES (ver ${CUDA_VERSION_STRING})" ELSE NO)
status(" Use OpenCL:" HAVE_OPENCL THEN YES ELSE NO) status(" Use OpenCL:" HAVE_OPENCL THEN YES ELSE NO)
......
...@@ -119,3 +119,13 @@ if(WITH_OPENMP) ...@@ -119,3 +119,13 @@ if(WITH_OPENMP)
endif() endif()
set(HAVE_OPENMP "${OPENMP_FOUND}") set(HAVE_OPENMP "${OPENMP_FOUND}")
endif() endif()
if(UNIX OR ANDROID)
if(NOT APPLE AND NOT HAVE_TBB AND NOT HAVE_OPENMP)
set(HAVE_PTHREADS_PF 1)
else()
set(HAVE_PTHREADS_PF 0)
endif()
else()
set(HAVE_PTHREADS_PF 0)
endif()
...@@ -125,6 +125,8 @@ ...@@ -125,6 +125,8 @@
# define CV_PARALLEL_FRAMEWORK "winrt-concurrency" # define CV_PARALLEL_FRAMEWORK "winrt-concurrency"
#elif defined HAVE_CONCURRENCY #elif defined HAVE_CONCURRENCY
# define CV_PARALLEL_FRAMEWORK "ms-concurrency" # define CV_PARALLEL_FRAMEWORK "ms-concurrency"
#elif defined HAVE_PTHREADS
# define CV_PARALLEL_FRAMEWORK "pthreads"
#endif #endif
namespace cv namespace cv
...@@ -298,6 +300,10 @@ void cv::parallel_for_(const cv::Range& range, const cv::ParallelLoopBody& body, ...@@ -298,6 +300,10 @@ void cv::parallel_for_(const cv::Range& range, const cv::ParallelLoopBody& body,
Concurrency::CurrentScheduler::Detach(); Concurrency::CurrentScheduler::Detach();
} }
#elif defined HAVE_PTHREADS
void parallel_for_pthreads(const Range& range, const ParallelLoopBody& body, double nstripes);
parallel_for_pthreads(range, body, nstripes);
#else #else
#error You have hacked and compiling with unsupported parallel framework #error You have hacked and compiling with unsupported parallel framework
...@@ -353,6 +359,12 @@ int cv::getNumThreads(void) ...@@ -353,6 +359,12 @@ int cv::getNumThreads(void)
? Concurrency::CurrentScheduler::Get()->GetNumberOfVirtualProcessors() ? Concurrency::CurrentScheduler::Get()->GetNumberOfVirtualProcessors()
: pplScheduler->GetNumberOfVirtualProcessors()); : pplScheduler->GetNumberOfVirtualProcessors());
#elif defined HAVE_PTHREADS
size_t parallel_pthreads_get_threads_num();
return parallel_pthreads_get_threads_num();
#else #else
return 1; return 1;
...@@ -410,6 +422,12 @@ void cv::setNumThreads( int threads ) ...@@ -410,6 +422,12 @@ void cv::setNumThreads( int threads )
Concurrency::MaxConcurrency, threads-1)); Concurrency::MaxConcurrency, threads-1));
} }
#elif defined HAVE_PTHREADS
void parallel_pthreads_set_threads_num(int num);
parallel_pthreads_set_threads_num(threads);
#endif #endif
} }
......
This diff is collapsed.
...@@ -292,6 +292,12 @@ TLSData<CoreTLSData>& getCoreTlsData(); ...@@ -292,6 +292,12 @@ TLSData<CoreTLSData>& getCoreTlsData();
#define CL_RUNTIME_EXPORT #define CL_RUNTIME_EXPORT
#endif #endif
#ifndef HAVE_PTHREADS
#if !(defined WIN32 || defined _WIN32 || defined WINCE || defined HAVE_WINRT)
#define HAVE_PTHREADS 1
#endif
#endif
extern bool __termination; // skip some cleanups, because process is terminating extern bool __termination; // skip some cleanups, because process is terminating
// (for example, if ExitProcess() was already called) // (for example, if ExitProcess() was already called)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment