Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
fix naive engine for multi-threaded inference (#15574)
Browse files Browse the repository at this point in the history
* fix naive engine

* remove thread local

* trigger CI
  • Loading branch information
arcadiaphy authored and anirudh2290 committed Aug 21, 2019
1 parent 308e4ac commit d225074
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/engine/naive_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ class NaiveEngine final : public Engine {
int priority = 0,
const char* opr_name = nullptr,
bool wait = false) override {
bool req_completed = false;
CallbackOnComplete callback = CreateCallback(
NaiveEngine::OnComplete, nullptr);
this->req_completed_ = false;
NaiveEngine::OnComplete, &req_completed);
profiler::Profiler *profiler = profiler::Profiler::Get();
auto opr_deleter = [this](NaiveOpr* p) {
this->DeleteOperator(p);
Expand Down Expand Up @@ -202,7 +202,7 @@ class NaiveEngine final : public Engine {
for (auto var : mutable_vars) {
++var->version_;
}
CHECK(this->req_completed_)
CHECK(req_completed)
<< "NaiveEngine only support synchronize Push so far";
if (profiling) {
opr->opr_profile->stop();
Expand Down Expand Up @@ -235,10 +235,9 @@ class NaiveEngine final : public Engine {
// callback to oncomplete
static void OnComplete(Engine *engine, void *param,
const dmlc::Error* error) {
static_cast<NaiveEngine*>(engine)->req_completed_ = true;
bool *req_completed = static_cast<bool*>(param);
*req_completed = true;
}
// whether action is completed
bool req_completed_;
/*! \brief whether it is during shutdown phase*/
std::atomic<bool> shutdown_phase_{false};
// CPU stream
Expand All @@ -261,5 +260,6 @@ class NaiveEngine final : public Engine {
Engine *CreateNaiveEngine() {
return new NaiveEngine();
}

} // namespace engine
} // namespace mxnet

0 comments on commit d225074

Please sign in to comment.