From fac8a2604e23e0ca35809faf6772fe1d5bd3b71b Mon Sep 17 00:00:00 2001 From: pangyoki Date: Tue, 23 Aug 2022 20:26:51 +0800 Subject: [PATCH] print log while use new exe (#45335) --- .../fluid/framework/new_executor/interpretercore_util.cc | 8 ++++++++ python/paddle/fluid/executor.py | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/framework/new_executor/interpretercore_util.cc b/paddle/fluid/framework/new_executor/interpretercore_util.cc index 055a765af11..38ef5fd70ce 100644 --- a/paddle/fluid/framework/new_executor/interpretercore_util.cc +++ b/paddle/fluid/framework/new_executor/interpretercore_util.cc @@ -412,6 +412,7 @@ void build_op_func_list(const platform::Place& place, : var_scope->GetMutableScope(); std::vector> ops_unique; // its elements will be moved to vec_func_list + bool flag_log_is_printed = false; // Step 1: create all ops for current block. create_all_ops(block, &ops_unique); // If gc is enabled and block size > 1 @@ -438,6 +439,13 @@ void build_op_func_list(const platform::Place& place, auto op = ops[i].get(); VLOG(6) << "Build OpFuncNode from : " << op->Type(); + // Print new executor log if grad op is used. + // It's only for test and will be removed later. + if (!flag_log_is_printed && op->Type().find("_grad") != std::string::npos) { + VLOG(0) << "Standalone Executor is Used."; + flag_log_is_printed = true; + } + auto inputs_names = op->Inputs(); auto outputs_names = op->Outputs(); diff --git a/python/paddle/fluid/executor.py b/python/paddle/fluid/executor.py index f9a527ec94e..601c66f5b30 100755 --- a/python/paddle/fluid/executor.py +++ b/python/paddle/fluid/executor.py @@ -1533,7 +1533,7 @@ class Executor(object): converted_program.lr_sheduler = inner_program.lr_sheduler inner_program = converted_program # print(f"Program after convert:\n {inner_program}", flush=True) - logging.warning( + warnings.warn( "FLAGS_USE_STANDALONE_EXECUTOR and FLAGS_CONVERT_GRAPH_TO_PROGRAM is set to 1. Graph will be converted to Program and executed using new executor." ) else: @@ -1550,6 +1550,11 @@ class Executor(object): fetch_var_name=fetch_var_name, use_fetch_v2=True) + # If there are multiple blocks in the program, subblock will not be + # executed with the new executor in temporary + if program.num_blocks > 1: + warnings.warn("There are more than 1 block in program.") + # standalone executor will apply buffer_shared_inplace_pass and # inplace_addto_op_pass to program according to build_strategy enable_inplace = True if build_strategy is None or build_strategy.enable_inplace else False -- GitLab