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

[GitHub] szha closed pull request #11065: [MXNET-477] CI engine test bug fix test

szha closed pull request #11065: [MXNET-477] CI engine test bug fix test
URL: https://github.com/apache/incubator-mxnet/pull/11065
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/engine/threaded_engine_pooled.cc b/src/engine/threaded_engine_pooled.cc
index 574e83244a0..1abb82fd6a6 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);
     }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services