Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add gc for multi jobs #54897

Merged
merged 4 commits into from
Jun 28, 2023
Merged

add gc for multi jobs #54897

merged 4 commits into from
Jun 28, 2023

Conversation

zhaoyinglia
Copy link
Contributor

PR types

Others

PR changes

Others

Description

PCard-71568

  • 新增支持跨子图的gc功能

@paddle-bot
Copy link

paddle-bot bot commented Jun 27, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Comment on lines 63 to 65
std::set<std::string> skip_vars = job->SkipGcVars();
execution_config.skip_gc_vars =
std::set<std::string>(skip_vars.begin(), skip_vars.end());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::set<std::string> skip_vars = job->SkipGcVars();
execution_config.skip_gc_vars =
std::set<std::string>(skip_vars.begin(), skip_vars.end());
execution_config.skip_gc_vars = job->SkipGcVars();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@@ -59,11 +59,10 @@ StandaloneExecutor::StandaloneExecutor(const platform::Place& place,

interpreter::ExecutionConfig execution_config;
execution_config.create_local_scope = false;
// TODO(Ruibiao): hack skip gc all vars for multiple jobs, improve it later
if (jobs.size() > 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个if判断可以直接删除

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

op_info = OpInOutInfo(op)
op_info.build_op_info()

for in_name in op.input_arg_names:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

除了输入var,输出var也应该被处理。
建议在step1中直接预处理每个program的{input_arg_names} + {output_arg_names} - {no_needed_names}集合作为vars_list供step2和step3使用。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Comment on lines +221 to +235
for op in program.global_block().ops:
op_info = OpInOutInfo()
for in_name in op.input_arg_names:
if not var_can_be_deleted(in_name, program):
continue

if not op_info.is_build:
op_info.build_info(op)

if op_info.is_needed(in_name):
vars_list[ip].add(in_name)

for out_name in op.output_arg_names:
if var_can_be_deleted(out_name, program):
vars_list[ip].add(out_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for op in program.global_block().ops:
op_info = OpInOutInfo()
for in_name in op.input_arg_names:
if not var_can_be_deleted(in_name, program):
continue
if not op_info.is_build:
op_info.build_info(op)
if op_info.is_needed(in_name):
vars_list[ip].add(in_name)
for out_name in op.output_arg_names:
if var_can_be_deleted(out_name, program):
vars_list[ip].add(out_name)
for op in program.global_block().ops:
op_info = OpInOutInfo()
op_info.build_info(op)
for var_name in op.input_arg_names + op.output_arg_names :
if op_info.is_needed(var_name) and var_can_be_deleted(var_name, program):
vars_list[ip].add(var_name)

@From00 From00 merged commit fcffd84 into PaddlePaddle:develop Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants