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
0babe27a
Commit
0babe27a
authored
Dec 12, 2015
by
Davis King
Browse files
Fixed race condition that could happen if set_size() was called while a cuda
kernel was still running.
parent
0f840db3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
dlib/dnn/gpu_data.cpp
dlib/dnn/gpu_data.cpp
+14
-0
No files found.
dlib/dnn/gpu_data.cpp
View file @
0babe27a
...
@@ -81,6 +81,13 @@ namespace dlib
...
@@ -81,6 +81,13 @@ namespace dlib
{
{
if
(
new_size
==
0
)
if
(
new_size
==
0
)
{
{
if
(
device_in_use
)
{
// Wait for any possible CUDA kernels that might be using our memory block to
// complete before we free the memory.
CHECK_CUDA
(
cudaStreamSynchronize
(
0
));
device_in_use
=
false
;
}
wait_for_transfer_to_finish
();
wait_for_transfer_to_finish
();
data_size
=
0
;
data_size
=
0
;
host_current
=
true
;
host_current
=
true
;
...
@@ -91,6 +98,13 @@ namespace dlib
...
@@ -91,6 +98,13 @@ namespace dlib
}
}
else
if
(
new_size
!=
data_size
)
else
if
(
new_size
!=
data_size
)
{
{
if
(
device_in_use
)
{
// Wait for any possible CUDA kernels that might be using our memory block to
// complete before we free the memory.
CHECK_CUDA
(
cudaStreamSynchronize
(
0
));
device_in_use
=
false
;
}
wait_for_transfer_to_finish
();
wait_for_transfer_to_finish
();
data_size
=
new_size
;
data_size
=
new_size
;
host_current
=
true
;
host_current
=
true
;
...
...
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