Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
6aec0e08
Commit
6aec0e08
authored
Jan 27, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added missing asserts
parent
364fd496
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
0 deletions
+72
-0
parallel_for_extension.h
dlib/threads/parallel_for_extension.h
+72
-0
No files found.
dlib/threads/parallel_for_extension.h
View file @
6aec0e08
...
...
@@ -82,6 +82,15 @@ namespace dlib
long
chunks_per_thread
=
4
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
begin
<=
end
&&
chunks_per_thread
>
0
,
"
\t
void parallel_for_blocked()"
<<
"
\n\t
Invalid inputs were given to this function"
<<
"
\n\t
begin: "
<<
begin
<<
"
\n\t
end: "
<<
end
<<
"
\n\t
chunks_per_thread: "
<<
chunks_per_thread
);
if
(
tp
.
num_threads_in_pool
()
!=
0
)
{
const
long
num
=
end
-
begin
;
...
...
@@ -115,6 +124,15 @@ namespace dlib
long
chunks_per_thread
=
4
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
begin
<=
end
&&
chunks_per_thread
>
0
,
"
\t
void parallel_for_blocked()"
<<
"
\n\t
Invalid inputs were given to this function"
<<
"
\n\t
begin: "
<<
begin
<<
"
\n\t
end: "
<<
end
<<
"
\n\t
chunks_per_thread: "
<<
chunks_per_thread
);
thread_pool
tp
(
num_threads
);
parallel_for_blocked
(
tp
,
begin
,
end
,
obj
,
funct
,
chunks_per_thread
);
}
...
...
@@ -130,6 +148,15 @@ namespace dlib
long
chunks_per_thread
=
4
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
begin
<=
end
&&
chunks_per_thread
>
0
,
"
\t
void parallel_for_blocked()"
<<
"
\n\t
Invalid inputs were given to this function"
<<
"
\n\t
begin: "
<<
begin
<<
"
\n\t
end: "
<<
end
<<
"
\n\t
chunks_per_thread: "
<<
chunks_per_thread
);
impl
::
helper_parallel_for_funct2
<
T
>
helper
(
funct
);
parallel_for_blocked
(
tp
,
begin
,
end
,
helper
,
&
impl
::
helper_parallel_for_funct2
<
T
>::
run
,
chunks_per_thread
);
}
...
...
@@ -145,6 +172,15 @@ namespace dlib
long
chunks_per_thread
=
4
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
begin
<=
end
&&
chunks_per_thread
>
0
,
"
\t
void parallel_for_blocked()"
<<
"
\n\t
Invalid inputs were given to this function"
<<
"
\n\t
begin: "
<<
begin
<<
"
\n\t
end: "
<<
end
<<
"
\n\t
chunks_per_thread: "
<<
chunks_per_thread
);
thread_pool
tp
(
num_threads
);
parallel_for_blocked
(
tp
,
begin
,
end
,
funct
,
chunks_per_thread
);
}
...
...
@@ -162,6 +198,15 @@ namespace dlib
long
chunks_per_thread
=
4
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
begin
<=
end
&&
chunks_per_thread
>
0
,
"
\t
void parallel_for()"
<<
"
\n\t
Invalid inputs were given to this function"
<<
"
\n\t
begin: "
<<
begin
<<
"
\n\t
end: "
<<
end
<<
"
\n\t
chunks_per_thread: "
<<
chunks_per_thread
);
impl
::
helper_parallel_for
<
T
>
helper
(
obj
,
funct
);
parallel_for_blocked
(
tp
,
begin
,
end
,
helper
,
&
impl
::
helper_parallel_for
<
T
>::
process_block
,
chunks_per_thread
);
}
...
...
@@ -178,6 +223,15 @@ namespace dlib
long
chunks_per_thread
=
4
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
begin
<=
end
&&
chunks_per_thread
>
0
,
"
\t
void parallel_for()"
<<
"
\n\t
Invalid inputs were given to this function"
<<
"
\n\t
begin: "
<<
begin
<<
"
\n\t
end: "
<<
end
<<
"
\n\t
chunks_per_thread: "
<<
chunks_per_thread
);
thread_pool
tp
(
num_threads
);
parallel_for
(
tp
,
begin
,
end
,
obj
,
funct
,
chunks_per_thread
);
}
...
...
@@ -193,6 +247,15 @@ namespace dlib
long
chunks_per_thread
=
4
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
begin
<=
end
&&
chunks_per_thread
>
0
,
"
\t
void parallel_for()"
<<
"
\n\t
Invalid inputs were given to this function"
<<
"
\n\t
begin: "
<<
begin
<<
"
\n\t
end: "
<<
end
<<
"
\n\t
chunks_per_thread: "
<<
chunks_per_thread
);
impl
::
helper_parallel_for_funct
<
T
>
helper
(
funct
);
parallel_for
(
tp
,
begin
,
end
,
helper
,
&
impl
::
helper_parallel_for_funct
<
T
>::
run
,
chunks_per_thread
);
}
...
...
@@ -208,6 +271,15 @@ namespace dlib
long
chunks_per_thread
=
4
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
begin
<=
end
&&
chunks_per_thread
>
0
,
"
\t
void parallel_for()"
<<
"
\n\t
Invalid inputs were given to this function"
<<
"
\n\t
begin: "
<<
begin
<<
"
\n\t
end: "
<<
end
<<
"
\n\t
chunks_per_thread: "
<<
chunks_per_thread
);
thread_pool
tp
(
num_threads
);
parallel_for
(
tp
,
begin
,
end
,
funct
,
chunks_per_thread
);
}
...
...
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