-
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
compile and install the static library of fluid inference #7827
Conversation
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.
Please refer to my comment #7231 (comment) 8 days ago.
It seems that this PR and the issue aforementioned are related to the binary release of PaddlePaddle.
However, to what I understand is that our binary release would be in the form of pip packages, but not as binary libraries (/bin, /include, /lib directories).
Also, even if we are going to add binary libraries as an additional form of binary release, we are not supposed to put third-party binaries in our directory hierarchy. The right way is to build only ours and pack a .deb file, which describes on what other .deb files it depends.
My suggestion is that we discard this PR and possibly revert another one (I vaguely remember, had been merged), and rethink about (1) if we are going to do this, and (2) what's the right way to doing it.
Discussed with @Xreki, we have already answered in #7572 (comment), but sorry to forget @ you.
The binary directory
As both IOS and Android don't support pip packages since they don't support python, the fluid inference library should not be in the form of this way.
Our third-party libraries only have There are two reasons why we put third-party libraries in our directory:
|
I agree that we publish our inference library, but with two points different from the current status of this PR:
|
If the same as that in ./build, the final directory hierarchy would like as follows:
|
cmake/external/openblas.cmake
Outdated
@@ -82,6 +82,7 @@ IF(NOT ${CBLAS_FOUND}) | |||
CONFIGURE_COMMAND "" | |||
) | |||
SET(CBLAS_PROVIDER openblas) | |||
FILE(REMOVE_RECURSE ${CBLAS_INSTALL_DIR}/lib/cmake ${CBLAS_INSTALL_DIR}/lib/pkgconfig) |
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.
FILE
命令应该是在执行cmake
命令的时候执行的。extern_openblas
是在make
阶段执行的,也就是说,必须要执行完extern_openblas
这个任务之后,才会生成${CBLAS_INSTALL_DIR}/lib/cmake
和${CBLAS_INSTALL_DIR}/lib/pkgconfig
这两个目录。所以这条语句应该达不到删除的目的。应该使用execute_process
语句删除,并且该语句需要依赖extern_openblas
这个任务。
paddle/inference/CMakeLists.txt
Outdated
# Merge all modules into a single static library | ||
cc_library(paddle_fluid DEPS paddle_fluid_api ${FLUID_CORE_MODULES} ${GLOB_OP_LIB}) | ||
cc_library(paddle_fluid DEPS paddle_fluid_api |
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.
像memory
模块一样,我们在每个模块最后加一个cc_library
,将该模块里面所有的target都合并成一个静态库?
Paddle/paddle/memory/CMakeLists.txt
Lines 6 to 14 in 1185a1b
cc_library(paddle_memory | |
DEPS | |
memory | |
memcpy | |
meta_data | |
meta_cache | |
memory_block | |
buddy_allocator | |
system_allocator) |
这样,在inference里面,我们只需要依赖paddle_memroy
, paddle_framework
, paddle_operators
, paddle_string
, paddle_platform
。不过这样还是不能自动添加。
* use libprotobuf.a instead of libprotobuf-lite.a for profiler
cmake/inference_lib.cmake
Outdated
DSTS ${dst_dir} ${dst_dir}/lib | ||
) | ||
ENDIF(NOT PROTOBUF_FOUND) | ||
|
||
IF(NOT WITH_MKL) |
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.
这里应该是if(NOT CBLAS_FOUND)
,cblas.cmake
里面会去找系统里的一些blas库,只有CBLAS_FOUND
为OFF
时才会自动去下载、编译和安装openblas。原则上,不是Paddle自动下载、编译的库,我们不要拷贝吧。mklml
在加入的时候,也在cblas.cmake
里面设置了CBLAS_FOUND
,这种情况另外再考虑吧。
另外,大小写统一一下?:smile:
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
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 and have tested. It is glad to see all fluid C++ modules can be collected automatically and merged into a single static library. Great work!
related #7231
-DWITH_PYTHON=OFF