OpenCV 4.5.3(日本語機械翻訳)
parallel_backend.hpp
1 // This file is part of OpenCV project.
2 // It is subject to the license terms in the LICENSE file found in the top-level directory
3 // of this distribution and at http://opencv.org/license.html.
4
5 #ifndef OPENCV_CORE_PARALLEL_BACKEND_HPP
6 #define OPENCV_CORE_PARALLEL_BACKEND_HPP
7
8 #include "opencv2/core/cvdef.h"
9 #include <memory>
10
11 namespace cv { namespace parallel {
12 #ifndef CV_API_CALL
13 #define CV_API_CALL
14 #endif
15
56 class CV_EXPORTS ParallelForAPI
57{
58 public:
59 virtual ~ParallelForAPI();
60
61 typedef void (CV_API_CALL *FN_parallel_for_body_cb_t)(int start, int end, void* data);
62
63 virtual void parallel_for(int tasks, FN_parallel_for_body_cb_t body_callback, void* callback_data) = 0;
64
65 virtual int getThreadNum() const = 0;
66
67 virtual int getNumThreads() const = 0;
68
69 virtual int setNumThreads(int nThreads) = 0;
70
71 virtual const char* getName() const = 0;
72};
73
80 CV_EXPORTS void setParallelForBackend(const std::shared_ptr<ParallelForAPI>& api, bool propagateNumThreads = true);
81
86 CV_EXPORTS_W bool setParallelForBackend(const std::string& backendName, bool propagateNumThreads = true);
87
89}} // namespace
90 #endif // OPENCV_CORE_PARALLEL_BACKEND_HPP
Definition: parallel_backend.hpp:57
CV_EXPORTS_W bool setParallelForBackend(const std::string &backendName, bool propagateNumThreads=true)
Change OpenCV parallel_for backend
CV_EXPORTS_W void setNumThreads(int nthreads)
OpenCV will try to set the number of threads for the next parallel region.
CV_EXPORTS_W int getThreadNum()
Returns the index of the currently executed thread within the current parallel region....
CV_EXPORTS_W int getNumThreads()
Returns the number of threads used by OpenCV for parallel regions.
cv
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75