-
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
Unify core_avx and core_noavx to paddle_core #45895
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -1635,6 +1638,7 @@ All parameter, weight, gradient are variables in Paddle. | |||
m.def("init_devices", []() { framework::InitDevices(); }); | |||
m.def("init_default_kernel_signatures", | |||
[]() { framework::InitDefaultKernelSignatureMap(); }); | |||
m.def("is_compiled_with_avx", IsCompiledWithCUDA); |
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.
IsCompiledWithCUDA
-> IsCompiledWithAVX
?
|
||
if avx_supported(): | ||
if platform.system().lower() != 'darwin' or (platform.system().lower() | ||
== 'darwin' and avx_supported()): |
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.
是不是没有考虑这种情况:用户机器是支持avx的,但是安装了noavx包(只编译noavx的安装包,没有把avx和noavx合并)。
这时候这个包里没有paddle_core?
libs = [':core_avx.so'] | ||
if not core.has_avx_core and core.has_noavx_core: | ||
libs = [':core_noavx.so'] | ||
libs = [':paddle_core.so'] |
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.
macos上只编noavx会不会有问题?
原来这段判断是否需要对macos特殊处理?
if not core.has_avx_core and core.has_noavx_core:
libs = [':core_noavx.so']
libs = [':core_avx.so'] | ||
if not core.has_avx_core and core.has_noavx_core: | ||
libs = [':core_noavx.so'] | ||
libs = [':paddle_core.so'] |
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.
同上
PR types
Function optimization
PR changes
Others
Describe
Unify core_avx and core_noavx to paddle_core
之前paddle为了使一个whl包同时支持avx和noavx,采用了一种比较trick的方式,编译两遍paddle,分别编译avx和noavx,最后打包到一起,#17889
这种方式虽然解决了问题,但也引入了新的问题:
本PR清理了一些历史代码,将动态库名称统一改为
paddle_core
同时需要在PaddleCustomDevice中对这两个命名的使用增加一个if分支:https://github.com/PaddlePaddle/PaddleCustomDevice/search?q=core_avx
PaddlePaddle/PaddleCustomDevice#105
TODO:参考linux shared library的命名公约,下个PR更名为libpaddle:https://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html