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 2017/10/27 20:21:03 UTC

[GitHub] cjolivier01 commented on a change in pull request #8413: [WIP] Proof of concept multi processing

cjolivier01 commented on a change in pull request #8413: [WIP] Proof of concept multi processing
URL: https://github.com/apache/incubator-mxnet/pull/8413#discussion_r147507934
 
 

 ##########
 File path: src/engine/threaded_engine_perdevice.cc
 ##########
 @@ -50,6 +50,37 @@ class ThreadedEnginePerDevice : public ThreadedEngine {
   static auto constexpr kWorkerQueue = kFIFO;
 
   ThreadedEnginePerDevice() noexcept(false) {
+    this->Start();
+#ifndef _WIN32
+    pthread_atfork(
+      []() {
+        Engine::Get()->WaitForAll();
+        Engine::Get()->Stop();
+      },
+      []() {
+        Engine::Get()->Start();
+      },
+      []() {
+        Engine::Get()->Start();
+      });
+#endif
+  }
+  ~ThreadedEnginePerDevice() noexcept(false) {
+    gpu_normal_workers_.SignalForKill();
+    gpu_copy_workers_.SignalForKill();
+    cpu_normal_workers_.SignalForKill();
+    this->Stop();
+  }
+
+  void Stop() override {
+    SignalQueuesForKill();
+    gpu_normal_workers_.Clear();
+    gpu_copy_workers_.Clear();
 
 Review comment:
   In LazyAllocArray, I suggest changing exit_now_ name to is_clearing_ or something like that, and then setting it back to false when the Clear() completes.
   Before doing that, you probably can clear head_ and more_ , or at least set them to think they're empty and to start from the beginning again when filling.

----------------------------------------------------------------
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