-
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
Add paddle custom flags support #56256
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@yuanlehome , 我打开 后续也在 所以这个 PR 应该修复了这个问题 |
好的,赞赞赞👍 |
::paddle::distributed::PSParameter _ps_param; | ||
::paddle::distributed::PaddlePSEnvironment _ps_env; |
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.
这个后续还是需要追查一下原因,毕竟原来不需要加::前缀,而且distributed目录下的命名空间都这么写感觉不是一个合理的形式
6875a7a
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
* update * repalce gflags header * replace DEFINE_<type> with PD_DEFINE_<type> * fix bug * fix bug * fix bug * update cmake * add :: before some paddle namespace * fix link error * fix CI-Py3 * allow commandline parse * fix SetFlagsFromEnv * fix bug * fix bug * fix CI-CINN * fix CI-Coverage-build * fix CI-Windows-build * fix CI-Inference * fix bug * fix bug * fix CI-CINN * fix inference api test * fix infer_ut test * revert infer_ut gflags usage * update * fix inference * remove flags export macro * revert inference demo_ci gflags usage * update * update * update * update * update * update * update * update * fix bug when turn on WITH_GFLAGS * turn on WITH_GFLAGS * fix bug when turn on WITH_GFLAGS * fix bug when turn on WITH_GFLAGS * update * update and add unittest * add unittest * fix conflict * rerun ci * update * resolve conflict
PR types
Others
PR changes
Others
Description
背景
paddle 目前使用 gflags 第三方库来统一管理各文件中定义的 flag,以及通过命令行和环境变量的方式来对 flag 进行赋值,但由于 gflags 的内部机制,可能会导致外部用户在同时使用 Paddle C++ 库和 gflags 第三方库的时候会在运行报错,同时对于 Paddle 的使用需求,gflags 中的很多功能是冗余的,
Done
针对上述存在的问题,这个 PR 根据 Paddle 的功能需求实现了一个精简的 flags 独立工具库来替换 gflags,主要实现了以下功能:
PD_DEFINE_<type>
和PD_DECLARE_<type>
实现上述功能的源文件为
paddle/utils/flags_native.h
和paddle/utils/flags_native.cc
,具体的设计方案可以查看:实现 Paddle flags 工具库WITH_GFLAGS
(默认 = OFF) 来切换到原始使用 gflags 第三方库的版本,该编译选项打开后的 CI 通过情况可查看 [flags test] turn on WITH_GFLAGS #56478文件
paddle/utils/flags.h
统一了切换新旧版本 flags 工具库的接口Todo
paddle::xxx
用法加上前缀::
的原因:fix paddle namespace conflict when using paddle_flags #56913遗留问题