Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
681abe78
Commit
681abe78
authored
Oct 17, 2015
by
Davis King
Browse files
optimized code a little
parent
3ba21975
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
dlib/dnn/gpu_data.cpp
dlib/dnn/gpu_data.cpp
+3
-2
dlib/dnn/gpu_data.h
dlib/dnn/gpu_data.h
+1
-1
No files found.
dlib/dnn/gpu_data.cpp
View file @
681abe78
...
...
@@ -49,9 +49,9 @@ namespace dlib
void
gpu_data
::
copy_to_host
()
const
{
wait_for_transfer_to_finish
();
if
(
!
host_current
)
{
wait_for_transfer_to_finish
();
std
::
cout
<<
"cudaMemcpy to host"
<<
std
::
endl
;
CHECK_CUDA
(
cudaMemcpy
(
data_host
.
get
(),
data_device
.
get
(),
data_size
*
sizeof
(
float
),
cudaMemcpyDeviceToHost
));
host_current
=
true
;
...
...
@@ -78,9 +78,9 @@ namespace dlib
size_t
new_size
)
{
wait_for_transfer_to_finish
();
if
(
new_size
==
0
)
{
wait_for_transfer_to_finish
();
data_size
=
0
;
host_current
=
true
;
device_current
=
true
;
...
...
@@ -89,6 +89,7 @@ namespace dlib
}
else
if
(
new_size
!=
data_size
)
{
wait_for_transfer_to_finish
();
data_size
=
new_size
;
host_current
=
true
;
device_current
=
true
;
...
...
dlib/dnn/gpu_data.h
View file @
681abe78
...
...
@@ -21,7 +21,7 @@ namespace dlib
- if (data_device) then
- data_device == a pointer to size() floats in device memory.
- if (there might be an active transfer
between
host
and
device) then
- if (there might be an active
async
transfer
from
host
to
device) then
- have_active_transfer == true
- We use the host_current and device_current bools to keep track of which
...
...
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