From 7cd6de37f57d05c967d829844bc819dd69ce278b Mon Sep 17 00:00:00 2001 From: Yancey1989 Date: Thu, 14 Feb 2019 18:29:12 +0800 Subject: [PATCH] fix cpu test=develop --- .../fluid/framework/details/parallel_ssa_graph_executor.cc | 4 ---- paddle/fluid/framework/parallel_executor.cc | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/framework/details/parallel_ssa_graph_executor.cc b/paddle/fluid/framework/details/parallel_ssa_graph_executor.cc index 77a3318ff..3433c3424 100644 --- a/paddle/fluid/framework/details/parallel_ssa_graph_executor.cc +++ b/paddle/fluid/framework/details/parallel_ssa_graph_executor.cc @@ -36,7 +36,6 @@ std::vector> SeparateMultiDevicesGraph( for (auto &op : graph->Get(kGraphOps)) { auto &dev_ctx = op->DeviceContext(); auto &p = dev_ctx.begin()->first; -#ifdef PADDLE_WITH_CUDA int dev_id = boost::get(p).device; auto &dev_ops = graphs[dev_id]->Get(kGraphOps); auto &dev_dummys = graphs[dev_id]->Get(kGraphDepVars); @@ -59,9 +58,6 @@ std::vector> SeparateMultiDevicesGraph( graphs[dev_id]->AddNode(graph->RemoveNode(var->Node()).release()); } } -#else - PADDLE_THROW("Parallel Graph Execution only support CUDAPlace."); -#endif } for (size_t dev_id = 0; dev_id < places.size(); ++dev_id) { diff --git a/paddle/fluid/framework/parallel_executor.cc b/paddle/fluid/framework/parallel_executor.cc index 21f2e1ee3..dbe1bf9b2 100644 --- a/paddle/fluid/framework/parallel_executor.cc +++ b/paddle/fluid/framework/parallel_executor.cc @@ -304,6 +304,7 @@ ParallelExecutor::ParallelExecutor( } if (build_strategy.enable_parallel_graph_) { +#ifdef PADDLE_WITH_CUDA auto parallel_graph = details::SeparateMultiDevicesGraph(member_->places_, std::move(graph)); auto seq_allreduce_pass = @@ -319,6 +320,10 @@ ParallelExecutor::ParallelExecutor( member_->executor_.reset(new details::ParallelSSAGraphExecutor( exec_strategy, member_->local_scopes_, member_->places_, std::move(parallel_graph))); +#else + PADDLE_THROW( + "Paddle should be compiled with CUDA for ParallelGraph Execution."); +#endif } else { if (exec_strategy.type_ == ExecutionStrategy::kDefault) { member_->executor_.reset(new details::ThreadedSSAGraphExecutor( -- GitLab