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

Commit

Permalink
Some update
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen committed Sep 26, 2015
1 parent 71edc49 commit a801b3e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions scripts/travis_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ if [ ${TASK} == "cpp_unittest" ]; then
echo "GTEST_PATH="${CACHE_PREFIX} >> config.mk
make test || exit -1
export MXNET_ENGINE_TYPE=ThreadedEngine
export MXNET_ENGINE_INFO=true
for test in tests/cpp/*_test; do
./$test || exit -1
done
Expand Down
6 changes: 6 additions & 0 deletions src/engine/threaded_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,17 @@ void ThreadedEngine::WaitForVar(VarHandle var) {
if (threaded_var->ready_to_read()) return;
std::atomic<bool> done{false};
this->PushSync([this, &done](RunContext) {
if (engine_info_) {
LOG(INFO) << "Sync is executed";
}
{
std::unique_lock<std::mutex> lock{finished_m_};
done.store(true);
}
finished_cv_.notify_all();
if (engine_info_) {
LOG(INFO) << "Sync is notified";
}
}, Context::CPU(), {var}, {}, FnProperty::kNormal);
{
std::unique_lock<std::mutex> lock{finished_m_};
Expand Down
6 changes: 5 additions & 1 deletion src/engine/threaded_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ class ThreadedEngine : public Engine {
shutdown_phase_.store(true);
}

ThreadedEngine() {}
ThreadedEngine() {
engine_info_ = dmlc::GetEnv("MXNET_ENGINE_INFO", false);
}
~ThreadedEngine() {
{
std::unique_lock<std::mutex> lock{finished_m_};
Expand Down Expand Up @@ -319,6 +321,8 @@ class ThreadedEngine : public Engine {
std::atomic<bool> kill_{false};
/*! \brief whether it is during shutdown phase*/
std::atomic<bool> shutdown_phase_{false};
/*!\brief show more information from engine actions */
bool engine_info_{false};
/*!
* \brief Mutex and condition_variable,
* used to Notify waits for single or all variables.
Expand Down

0 comments on commit a801b3e

Please sign in to comment.