You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by zh...@apache.org on 2018/06/02 05:23:47 UTC

[incubator-mxnet] branch master updated: [MXNET-477] CI engine test bug fix test (#11065)

This is an automated email from the ASF dual-hosted git repository.

zhasheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 4554c76  [MXNET-477] CI engine test bug fix test (#11065)
4554c76 is described below

commit 4554c76bec89b7bd30df59ebf36edf43a41ddd19
Author: Hao Jin <ha...@users.noreply.github.com>
AuthorDate: Fri Jun 1 22:23:15 2018 -0700

    [MXNET-477] CI engine test bug fix test (#11065)
    
    * fix for race condition and try 10000 run on the tests
    
    * getting rid of 10000 repetitive runs after verification
---
 src/engine/threaded_engine_pooled.cc | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/engine/threaded_engine_pooled.cc b/src/engine/threaded_engine_pooled.cc
index 574e832..1abb82f 100644
--- a/src/engine/threaded_engine_pooled.cc
+++ b/src/engine/threaded_engine_pooled.cc
@@ -71,10 +71,14 @@ class ThreadedEnginePooled : public ThreadedEngine {
     streams_.reset(new StreamManager<kMaxNumGpus, kNumStreamsPerGpu>());
     task_queue_.reset(new dmlc::ConcurrentBlockingQueue<OprBlock*>());
     io_task_queue_.reset(new dmlc::ConcurrentBlockingQueue<OprBlock*>());
-    thread_pool_.reset(new ThreadPool(kNumWorkingThreads, [this]() {
-      ThreadWorker(task_queue_); }));
-    io_thread_pool_.reset(new ThreadPool(1, [this]() {
-      ThreadWorker(io_task_queue_); }));
+    thread_pool_.reset(new ThreadPool(kNumWorkingThreads,
+                                      [this](std::shared_ptr<dmlc::ManualEvent> ready_event) {
+                                        ThreadWorker(task_queue_, ready_event); },
+                                      true));
+    io_thread_pool_.reset(new ThreadPool(1,
+                                         [this](std::shared_ptr<dmlc::ManualEvent> ready_event) {
+                                           ThreadWorker(io_task_queue_, ready_event); },
+                                         true));
   }
 
  protected:
@@ -113,8 +117,10 @@ class ThreadedEnginePooled : public ThreadedEngine {
    *
    * The method to pass to thread pool to parallelize.
    */
-  void ThreadWorker(std::shared_ptr<dmlc::ConcurrentBlockingQueue<OprBlock*>> task_queue) {
+  void ThreadWorker(std::shared_ptr<dmlc::ConcurrentBlockingQueue<OprBlock*>> task_queue,
+                    const std::shared_ptr<dmlc::ManualEvent>& ready_event) {
     OprBlock* opr_block;
+    ready_event->signal();
     while (task_queue->Pop(&opr_block)) {
       DoExecute(opr_block);
     }

-- 
To stop receiving notification emails like this one, please contact
zhasheng@apache.org.