-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
auto parallel support pipeline scheduler with standalone executor #54727
auto parallel support pipeline scheduler with standalone executor #54727
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -52,6 +52,10 @@ PADDLE_DEFINE_EXPORTED_bool(new_executor_use_local_scope, | |||
true, | |||
"Use local_scope in new executor(especially used " | |||
"in UT), can turn off for better performance"); | |||
PADDLE_DEFINE_EXPORTED_bool( |
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.
用于控制python代码的环境变量,不需要在C++端声明。
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.
done.
@@ -368,7 +378,17 @@ def _apply_post_optimization( | |||
[main_program], [startup_program], self._pass_context | |||
) | |||
|
|||
if self._strategy.pipeline.enable: | |||
new_executor_micro_batching = os.environ.get( |
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.
这里判断是否使用新执行器的代码在engine.py里也有类似的,两处代码是否可以合成一处?
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.
done.
|
||
if self._strategy.pipeline.enable and use_new_executor: | ||
main_program._pipeline_opt = {} | ||
main_program._pipeline_opt["standalone_exe"] = { |
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.
_pipeline_opt用standalone_exe
做key容易造成误解,建议可以改成standalone_opt
或其它更合适的名字
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.
done。修改成了 standalone_opt
|
||
|
||
def apply_pass(main_program, startup_program, pass_name, pass_attr={}): | ||
from paddle.distributed.passes import PassContext, new_pass |
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.
按照python编码规范,导入语句必须在文件顶部, 位于模块的注释和文档字符串之后、全局变量和全局常量之前
。不建议在函数内部做导入。
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.
done.
python/paddle/fluid/executor.py
Outdated
@@ -653,8 +681,15 @@ def run(self, feed_names, return_numpy=True): | |||
""" | |||
tensors = self._new_exe.run(feed_names)._move_to_list() | |||
if return_numpy: | |||
return as_numpy(tensors, copy=True) | |||
tensors = as_numpy(tensors, copy=True) | |||
if self._plan.micro_batch_num() <= 1: |
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.
_merge_tensors
是否可以处理micro_batch_num=1的情况?
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.
支持。已合并。
python/paddle/fluid/executor.py
Outdated
else: | ||
if self._plan.micro_batch_num() > 1: | ||
logging.warning( |
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.
这里建议直接抛错误
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.
done.
scope, | ||
) | ||
if pipeline_opt: | ||
from paddle.distributed.passes.pipeline_scheduler_pass import ( |
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.
不建议在函数内部做导入。
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.
不在此处做导入会发生循环引用的问题。
python/paddle/fluid/executor.py
Outdated
@@ -1408,7 +1460,21 @@ def _run_impl( | |||
|
|||
fetch_list = self._check_fetch_list(fetch_list) | |||
|
|||
if isinstance(program, Program) and program._pipeline_opt: | |||
new_executor_micro_batching = os.environ.get( |
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.
建议将FLAGS开关判断代码统一到一处
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.
done.
…a/Paddle into standalone_exe_FThenB
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.
LGTM for set_tests_properties(test_pipeline_scheduler_FThenB PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 50)
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.
LGTM
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.
LGTM
PR types
Others
PR changes
Others
Description
Pcard-70448
new_executor_micro_batching
flag 来控制在流水线并行时,是使用standalone executor还是fleet executor。仅用于过渡时期debug,后续迁移完成会删除。