diff --git a/paddle/fluid/framework/details/parallel_ssa_graph_executor.cc b/paddle/fluid/framework/details/parallel_ssa_graph_executor.cc index 77a3318ff9e7bb2024dd081ede3bde63fc8ac8eb..3433c3424e43e6cf714fca995e6ccd5a9589a9c2 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 21f2e1ee3e618a28ee12604a5fcb8c4adcae1ff9..dbe1bf9b2929726ea28b91dad7dd59616dfdbd21 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(