Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
349f0cf5
Commit
349f0cf5
authored
Sep 09, 2019
by
Maksim Shabunin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15443 from anton-potapov:fluid_internal_parallellism_fix_review_comments
parents
57b16a4b
758156a9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
4 deletions
+27
-4
gfluidkernel.hpp
modules/gapi/include/opencv2/gapi/fluid/gfluidkernel.hpp
+4
-1
gfluidbackend.cpp
modules/gapi/src/backends/fluid/gfluidbackend.cpp
+23
-3
No files found.
modules/gapi/include/opencv2/gapi/fluid/gfluidkernel.hpp
View file @
349f0cf5
...
...
@@ -106,7 +106,10 @@ struct GFluidParallelOutputRois
struct
GFluidParallelFor
{
std
::
function
<
void
(
std
::
size_t
,
std
::
function
<
void
(
std
::
size_t
)
>
)
>
parallel_for
;
//this function accepts:
// - size of the "parallel" range as the first argument
// - and a function to be called on the range items, designated by item index
std
::
function
<
void
(
std
::
size_t
size
,
std
::
function
<
void
(
std
::
size_t
index
)
>
)
>
parallel_for
;
};
namespace
detail
...
...
modules/gapi/src/backends/fluid/gfluidbackend.cpp
View file @
349f0cf5
...
...
@@ -16,6 +16,7 @@
#include <ade/util/algorithm.hpp>
#include <ade/util/chain_range.hpp>
#include <ade/util/iota_range.hpp>
#include <ade/util/range.hpp>
#include <ade/util/zip_range.hpp>
...
...
@@ -96,12 +97,31 @@ namespace
const
auto
parallel_out_rois
=
cv
::
gimpl
::
getCompileArg
<
cv
::
GFluidParallelOutputRois
>
(
args
);
const
auto
gpfor
=
cv
::
gimpl
::
getCompileArg
<
cv
::
GFluidParallelFor
>
(
args
);
auto
serial_for
=
[](
std
::
size_t
count
,
std
::
function
<
void
(
std
::
size_t
)
>
f
){
for
(
std
::
size_t
i
=
0
;
i
<
count
;
++
i
){
#if !defined(GAPI_STANDALONE)
auto
default_pfor
=
[](
std
::
size_t
count
,
std
::
function
<
void
(
std
::
size_t
)
>
f
){
struct
Body
:
cv
::
ParallelLoopBody
{
decltype
(
f
)
func
;
Body
(
decltype
(
f
)
&&
_f
)
:
func
(
_f
){}
virtual
void
operator
()
(
const
cv
::
Range
&
r
)
const
CV_OVERRIDE
{
for
(
std
::
size_t
i
:
ade
::
util
::
iota
(
r
.
start
,
r
.
end
))
{
func
(
i
);
}
}
};
cv
::
parallel_for_
(
cv
::
Range
{
0
,
static_cast
<
int
>
(
count
)},
Body
{
std
::
move
(
f
)});
};
#else
auto
default_pfor
=
[](
std
::
size_t
count
,
std
::
function
<
void
(
std
::
size_t
)
>
f
){
for
(
auto
i
:
ade
::
util
::
iota
(
count
)){
f
(
i
);
}
};
auto
pfor
=
gpfor
.
has_value
()
?
gpfor
.
value
().
parallel_for
:
serial_for
;
#endif
auto
pfor
=
gpfor
.
has_value
()
?
gpfor
.
value
().
parallel_for
:
default_pfor
;
return
parallel_out_rois
.
has_value
()
?
EPtr
{
new
cv
::
gimpl
::
GParallelFluidExecutable
(
graph
,
graph_data
,
std
::
move
(
parallel_out_rois
.
value
().
parallel_rois
),
pfor
)}
:
EPtr
{
new
cv
::
gimpl
::
GFluidExecutable
(
graph
,
graph_data
,
std
::
move
(
rois
.
rois
))}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment