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 2021/10/27 02:33:54 UTC

[GitHub] [incubator-mxnet] szha commented on a change in pull request #20331: Add async GPU dependency Engine

szha commented on a change in pull request #20331:
URL: https://github.com/apache/incubator-mxnet/pull/20331#discussion_r737056772



##########
File path: src/engine/threaded_engine.cc
##########
@@ -533,5 +546,206 @@ void ThreadedEngine::OnCompleteStatic(Engine* engine, void* opr_block_, const dm
   OprBlock::Delete(opr_block);
 }
 
+void ThreadedEngine::OnStartStatic(Engine* engine, void* opr_block, const dmlc::Error* error) {
+  // no-op
+}
+
+#if MXNET_USE_CUDA
+static inline void AddEventHelper(std::unordered_map<cudaStream_t, EventInfo>* events_per_stream,
+                                  const EventInfo& cuda_event) {
+  auto event_stream = cuda_event.stream;
+  if (events_per_stream->count(event_stream) > 0) {
+    if ((*events_per_stream)[event_stream].pool_index < cuda_event.pool_index) {
+      (*events_per_stream)[event_stream] = cuda_event;
+    }
+  } else {
+    (*events_per_stream).emplace(event_stream, cuda_event);
+  }
+}
+
+static inline bool IsEngineAsync() {
+  std::string type = dmlc::GetEnv("MXNET_ENGINE_TYPE", std::string(""));
+  std::string async_engine_tag("Async");
+  auto tag_pos = type.find(async_engine_tag);
+  return tag_pos != std::string::npos;
+}
+
+void ThreadedEngine::OnStartCPU(Engine* engine, void* opr_block, const dmlc::Error* error) {
+  static bool use_new_dep_engine = IsEngineAsync();
+  if (!use_new_dep_engine) {
+    return;
+  }

Review comment:
       Why not test it in the CI now? @Kh4L 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org