-
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
ENH: Merge multiple static libs into singe one #2533
Conversation
This PR is verified, please try it. CI failed because of no space left on device. |
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! Thanks!
if (cc_library_DEPS) | ||
merge_static_libs(${TARGET_NAME} ${cc_library_DEPS}) | ||
else() | ||
message(FATAL "Please specify source file or library in cc_library.") |
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.
How about changing the error message to be "cc_library requires at least SRCS or DEPS"?
# tensor.cc | ||
# DEPS | ||
# variant) | ||
function(merge_static_libs TARGET_NAME) |
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 ==> compose ?
if (nv_library_DEPS) | ||
merge_static_libs(${TARGET_NAME} ${nv_library_DEPS}) | ||
else() | ||
message(FATAL "Please specify source file or library in nv_library.") |
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.
How about "nv_library requires at least SRCS or DEPS"?
ENHANCEMENT:
If we have lots of source files under framework folder, each of them will invoke
cc_library(filename SRC ...)
to generate *.a, finally, we must provide a target nameframework
(framework.a) for the outside usage.Therefore, we need to merge multiple small libraries into larger one
libframework.a
. This PR is to solve this problem.For example,
If you want to merge
libddim.a
andlibplace.a
... into libframework.a, you can usecc_library
as follows:After this PR be merged, we can completely refactor the underlying building system of Paddle.