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

[Fleet Executor]Add sink interceptor and test #41497

Merged
merged 1 commit into from
Apr 8, 2022

Conversation

LiYuRio
Copy link
Contributor

@LiYuRio LiYuRio commented Apr 7, 2022

PR types

New features

PR changes

Others

Describe

在一个进程中,只会有一个SinkInterceptor,它负责根据当前运行步数,判断是否能停止carrier。SinkInterceptor接收上游发送的DataIsReady的消息,自增计步器,直到达到最大运行上限时停止carrier。

@LiYuRio LiYuRio changed the title Add sink interceptor and test [Fleet Executor]Add sink interceptor and test Apr 7, 2022
@paddle-bot-old
Copy link

paddle-bot-old bot commented Apr 7, 2022

你的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(https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/dev_guides/git_guides/paddle_ci_manual_cn.html) for details.

Copy link
Contributor

@FeixLiu FeixLiu left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@wangxicoding wangxicoding left a comment

Choose a reason for hiding this comment

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

LGTM

void SinkInterceptor::StopCarrierIfComplete() {
bool flag = true;
for (const auto& up : upstream_step_) {
flag = flag & (up.second == max_run_times_);
Copy link
Contributor

Choose a reason for hiding this comment

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

感觉用 && 比较好一些,毕竟bool还是用字节存储的,理论上 >0 的都是true。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

哦对,有道理

std::string carrier_id = "0";
Carrier* carrier =
GlobalMap<std::string, Carrier>::Create(carrier_id, carrier_id);
carrier->Init(0, {{-1, 0}, {0, 0}, {-2, 0}});
Copy link
Contributor

Choose a reason for hiding this comment

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

后续把-1和-2这两个魔数搞成宏定义或者数值常量?好看点

Copy link
Contributor Author

Choose a reason for hiding this comment

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

是的,下一个pr改

@FeixLiu FeixLiu merged commit b3e7973 into PaddlePaddle:develop Apr 8, 2022
douch pushed a commit to douch/Paddle that referenced this pull request Apr 10, 2022
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.

None yet

3 participants