Skip to content

Commit

Permalink
Revert "Remove cleanup on side threads (apache#19378)"
Browse files Browse the repository at this point in the history
This reverts commit 43750c8.
  • Loading branch information
barry-jin committed Oct 27, 2020
1 parent c6c5e4b commit e0ee6c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/engine/naive_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,14 @@ class NaiveEngine final : public Engine {
LOG(INFO) << "Engine shutdown";
for (size_t i = 0; i < streams_.size(); ++i) {
if (streams_[i] != nullptr) {
// Catch exception for CUDA driver shutdown
MSHADOW_CATCH_ERROR(mshadow::DeleteStream(streams_[i]));
streams_[i] = nullptr;
}
}
for (size_t i = 0; i < aux_streams_.size(); ++i) {
if (aux_streams_[i] != nullptr) {
delete aux_streams_[i];
aux_streams_[i] = nullptr;
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/engine/threaded_engine_perdevice.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ class ThreadedEnginePerDevice : public ThreadedEngine {
while (task_queue->Pop(&opr_block)) {
this->ExecuteOprBlock(run_ctx, opr_block);
}
// Catch exception for CUDA driver shutdown
MSHADOW_CATCH_ERROR(mshadow::DeleteStream<gpu>(stream));
if (aux_stream != nullptr)
delete aux_stream;
#else
ready_event->signal();
#endif
Expand Down

0 comments on commit e0ee6c2

Please sign in to comment.