-
Notifications
You must be signed in to change notification settings - Fork 825
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
Refactor scope #3652
Refactor scope #3652
Conversation
ci/test/1node_op_test.sh
Outdated
true \ | ||
&& ONEFLOW_TEST_DEVICE_NUM=1 python3 -m unittest --failfast --verbose \ | ||
&& ONEFLOW_TEST_DEVICE_NUM=2 python3 -m unittest --failfast --verbose \ | ||
&& ONEFLOW_TEST_DEVICE_NUM=4 python3 -m unittest --failfast --verbose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
带逻辑截断能最快地failfast
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
什么意思,这个脚本已经加了 set -ex,出错就退出了,不需要加&吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jackalcooper bash -e 对 && || 的处理比较坑,https://stackoverflow.com/questions/41760057/bash-e-flag-and-list-command ,只有最后一个子命令出错才会退出
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
晟航已回滚了这地方的代码
@@ -0,0 +1,129 @@ | |||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这就是旧的scope_util.py,原来名字不太好。
return scope | ||
|
||
|
||
def MakeInitialScope(job_conf, device_tag, machine_device_ids, is_mirrored): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个函数是从compiler.py移动过来的,其他都是从Session类里移动过来的。
return scope | ||
|
||
|
||
def InitScopeStack(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个在环境初始化之后调用
@@ -70,13 +70,11 @@ def __init__(self): | |||
self.interface_op_name2op_attr_ = {} | |||
self.interface_op_name2job_name_ = {} | |||
self.job_name2name_scope_stack_ = {} | |||
self.job_name2current_scope_ = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scope不需要特别强调是属于哪个job的scope,它都不是Session的成员。
* refactor Session.job_name2current_scope_ to Session.scope_stack_ * Seperate scope related functions from Session to scope_util.py * revert change Co-authored-by: Shenghang Tsai <jackalcooper@gmail.com> Former-commit-id: 278b50a
将Scope相关的函数从Session移动到新文件scope_util.py,原来scope_util.py被重命名为scope_symbol.py