From 146ec8f71ba30cdc89d2476d727ff0d0fba2aec3 Mon Sep 17 00:00:00 2001 From: chuxing Date: Thu, 19 Nov 2020 11:09:45 +0800 Subject: [PATCH] fix async --- ge/hybrid/executor/hybrid_model_async_executor.cc | 2 +- ge/hybrid/executor/rt_callback_manager.cc | 2 +- ge/hybrid/executor/subgraph_executor.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ge/hybrid/executor/hybrid_model_async_executor.cc b/ge/hybrid/executor/hybrid_model_async_executor.cc index d4652a91..c36b11da 100644 --- a/ge/hybrid/executor/hybrid_model_async_executor.cc +++ b/ge/hybrid/executor/hybrid_model_async_executor.cc @@ -58,7 +58,7 @@ Status HybridModelAsyncExecutor::Start(const std::shared_ptr &lis run_flag_ = true; listener_ = listener; - future_ = std::async([&]() -> Status { + future_ = std::async(std::launch::async, [&]() -> Status { GetContext().SetSessionId(executor_->GetContext()->session_id); return RunInternal(); }); diff --git a/ge/hybrid/executor/rt_callback_manager.cc b/ge/hybrid/executor/rt_callback_manager.cc index 63eb46d5..0523a6a5 100644 --- a/ge/hybrid/executor/rt_callback_manager.cc +++ b/ge/hybrid/executor/rt_callback_manager.cc @@ -49,7 +49,7 @@ Status CallbackManager::RegisterCallback(rtCallback_t callback, void *user_data) Status CallbackManager::Init() { rtContext_t ctx = nullptr; GE_CHK_RT_RET(rtCtxGetCurrent(&ctx)); - ret_future_ = std::async([&](rtContext_t context) ->Status { + ret_future_ = std::async(std::launch::async, [&](rtContext_t context) ->Status { return CallbackProcess(context); }, ctx); if (!ret_future_.valid()) { diff --git a/ge/hybrid/executor/subgraph_executor.cc b/ge/hybrid/executor/subgraph_executor.cc index 573e405e..76a6cc37 100644 --- a/ge/hybrid/executor/subgraph_executor.cc +++ b/ge/hybrid/executor/subgraph_executor.cc @@ -307,7 +307,7 @@ Status SubgraphExecutor::LaunchTasks() { Status SubgraphExecutor::ScheduleTasks() { GELOGD("[%s] Start to schedule prepare workers.", graph_item_->GetName().c_str()); - auto prepare_future = std::async([&]() -> Status { + auto prepare_future = std::async(std::launch::async, [&]() -> Status { GetContext().SetSessionId(context_->session_id); auto ret = PrepareNodes(); ready_queue_.Push(nullptr);