From 495e73d766014189a2d544094e37ddb09189f84c Mon Sep 17 00:00:00 2001 From: Yancey1989 Date: Wed, 26 Dec 2018 17:18:44 +0800 Subject: [PATCH] enable gc --- paddle/fluid/framework/parallel_executor.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/framework/parallel_executor.cc b/paddle/fluid/framework/parallel_executor.cc index 6ad86e900d..45e34cab4c 100644 --- a/paddle/fluid/framework/parallel_executor.cc +++ b/paddle/fluid/framework/parallel_executor.cc @@ -292,10 +292,11 @@ ParallelExecutor::ParallelExecutor( graphs.push_back(std::move(graph)); #endif auto max_memory_size = GetEagerDeletionThreshold(); - // TODO(Yancey1989): fix gc failed on ParallelGraph strategy. - if (max_memory_size >= 0 && !build_strategy.enable_parallel_graph_) { - graphs[0] = member_->PrepareGCAndRefCnts( - std::move(graphs[0]), static_cast(max_memory_size)); + if (max_memory_size >= 0) { + for (size_t i = 0; i < graphs.size(); ++i) { + graphs[i] = member_->PrepareGCAndRefCnts( + std::move(graphs[i]), static_cast(max_memory_size)); + } } // Step 3. Create vars in each scope. Passes may also create new vars. -- GitLab