未验证 提交 fac8a260 编写于 作者: P pangyoki 提交者: GitHub

print log while use new exe (#45335)

上级 61bc016c
...@@ -412,6 +412,7 @@ void build_op_func_list(const platform::Place& place, ...@@ -412,6 +412,7 @@ void build_op_func_list(const platform::Place& place,
: var_scope->GetMutableScope(); : var_scope->GetMutableScope();
std::vector<std::unique_ptr<OperatorBase>> std::vector<std::unique_ptr<OperatorBase>>
ops_unique; // its elements will be moved to vec_func_list 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. // Step 1: create all ops for current block.
create_all_ops(block, &ops_unique); create_all_ops(block, &ops_unique);
// If gc is enabled and block size > 1 // If gc is enabled and block size > 1
...@@ -438,6 +439,13 @@ void build_op_func_list(const platform::Place& place, ...@@ -438,6 +439,13 @@ void build_op_func_list(const platform::Place& place,
auto op = ops[i].get(); auto op = ops[i].get();
VLOG(6) << "Build OpFuncNode from : " << op->Type(); 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 inputs_names = op->Inputs();
auto outputs_names = op->Outputs(); auto outputs_names = op->Outputs();
......
...@@ -1533,7 +1533,7 @@ class Executor(object): ...@@ -1533,7 +1533,7 @@ class Executor(object):
converted_program.lr_sheduler = inner_program.lr_sheduler converted_program.lr_sheduler = inner_program.lr_sheduler
inner_program = converted_program inner_program = converted_program
# print(f"Program after convert:\n {inner_program}", flush=True) # 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." "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: else:
...@@ -1550,6 +1550,11 @@ class Executor(object): ...@@ -1550,6 +1550,11 @@ class Executor(object):
fetch_var_name=fetch_var_name, fetch_var_name=fetch_var_name,
use_fetch_v2=True) 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 # standalone executor will apply buffer_shared_inplace_pass and
# inplace_addto_op_pass to program according to build_strategy # 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 enable_inplace = True if build_strategy is None or build_strategy.enable_inplace else False
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册