diff --git a/paddle/fluid/framework/parallel_executor.cc b/paddle/fluid/framework/parallel_executor.cc index 101141284ba4c8ac34c868aae18dc04c924b2aed..7b83f87d5d8e51bbe8a61f6ef08e65369399635b 100644 --- a/paddle/fluid/framework/parallel_executor.cc +++ b/paddle/fluid/framework/parallel_executor.cc @@ -32,6 +32,8 @@ limitations under the License. */ #include "paddle/fluid/framework/ir/memory_optimize_pass/reference_count_pass_helper.h" #include "paddle/fluid/platform/profiler.h" +DECLARE_bool(use_ngraph); + #ifdef WITH_GPERFTOOLS #include "gperftools/profiler.h" #endif @@ -233,6 +235,13 @@ class ParallelExecutorPrivate { }; ir::Graph *ParallelExecutorPrivate::ApplyMemoryOptimizePass(ir::Graph *graph) { + if (FLAGS_use_ngraph) { + LOG_FIRST_N(WARNING, 1) + << "FLAGS_use_ngraph=True, memory optimization strategy is " + "disabled in ParallelExecutor"; + return graph; + } + std::vector last_live_ops_of_vars; auto ref_cnt_pass = ir::PassRegistry::Instance().Get("reference_count_pass");