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
364fd496
Commit
364fd496
authored
Jan 27, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplified the code a little by replacing some stuff with calls to
parallel_for_blocked()
parent
aeaf6e87
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
20 deletions
+2
-20
structural_svm_distributed.h
dlib/svm/structural_svm_distributed.h
+1
-9
structural_svm_problem_threaded.h
dlib/svm/structural_svm_problem_threaded.h
+1
-11
No files found.
dlib/svm/structural_svm_distributed.h
View file @
364fd496
...
...
@@ -216,10 +216,6 @@ namespace dlib
data
.
num
=
problem
.
get_num_samples
();
// how many samples to process in a single task (aim for 4 jobs per worker)
const
long
num_workers
=
std
::
max
(
1UL
,
tp
.
num_threads_in_pool
());
const
long
block_size
=
std
::
max
(
1L
,
data
.
num
/
(
num_workers
*
4
));
const
uint64
start_time
=
ts
.
get_timestamp
();
// pick fastest buffering strategy
...
...
@@ -233,11 +229,7 @@ namespace dlib
}
binder
b
(
*
this
,
req
,
data
,
buffer_subgradients_locally
);
for
(
long
i
=
0
;
i
<
data
.
num
;
i
+=
block_size
)
{
tp
.
add_task
(
b
,
&
binder
::
call_oracle
,
i
,
std
::
min
(
i
+
block_size
,
data
.
num
));
}
tp
.
wait_for_all_tasks
();
parallel_for_blocked
(
tp
,
0
,
data
.
num
,
b
,
&
binder
::
call_oracle
);
const
uint64
stop_time
=
ts
.
get_timestamp
();
if
(
buffer_subgradients_locally
)
...
...
dlib/svm/structural_svm_problem_threaded.h
View file @
364fd496
...
...
@@ -116,11 +116,6 @@ namespace dlib
)
const
{
++
num_iterations_executed
;
const
long
num
=
this
->
get_num_samples
();
// how many samples to process in a single task (aim for 4 jobs per worker)
const
long
num_workers
=
std
::
max
(
1UL
,
tp
.
num_threads_in_pool
());
const
long
block_size
=
std
::
max
(
1L
,
num
/
(
num_workers
*
4
));
const
uint64
start_time
=
ts
.
get_timestamp
();
...
...
@@ -133,13 +128,8 @@ namespace dlib
buffer_subgradients_locally
=
!
buffer_subgradients_locally
;
}
binder
b
(
*
this
,
w
,
subgradient
,
total_loss
,
buffer_subgradients_locally
);
for
(
long
i
=
0
;
i
<
num
;
i
+=
block_size
)
{
tp
.
add_task
(
b
,
&
binder
::
call_oracle
,
i
,
std
::
min
(
i
+
block_size
,
num
));
}
tp
.
wait_for_all_tasks
();
parallel_for_blocked
(
tp
,
0
,
this
->
get_num_samples
(),
b
,
&
binder
::
call_oracle
);
const
uint64
stop_time
=
ts
.
get_timestamp
();
...
...
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