-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[torch deploy] Add -rdynamic option explicitly to CMakeLists.txt #75461
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
Conversation
Summary: This flag is needed in the OSS example and it wasn't clear that it was needed because it wasn't explicitly used when linking to torch deploy for the tests. Since torch deploy builds the tests using `python setup.py develop`, Pytorch actually sets this flag in the `CMAKE_EXE_LINKER_FLAGS` variable somewhere along the build. I had to print out all the variables used in the pytorch build to realize that I did not have this flag set in my OSS torch deploy example. I think having it explicit for the tests makes it clear which flags are actually necessary in an open source environment. **What is -rdynamic?** This flag (also known as `--export-dynamic` at the linker level) signals that the library it is targeting should export its symbols to the dynamic table. In doing so, shared libraries that are opened using `dlopen` (which is what torch deploy uses to launch subinterpreters: https://www.internalfb.com/code/fbsource/[ff6d5cfcc2b3]/xplat/caffe2/torch/csrc/deploy/deploy.cpp?lines=254), will be able to reference symbols defined in the modules that launched them. Without this flag, the symbols from the `torch::deploy` library that the subinterpreters need, remain `undefined`. This leads to runtime errors like: `/tmp/torch_XYZ: undefined symbol - torch::deploy::Etc.` `/tmp/torch_XYZ` is a subinterpreter. Test Plan: Ran the tests in an OSS environment `python torch/csrc/deploy/example/generate_examples.py` `./build/bin/test_deploy` Differential Revision: D35477135 fbshipit-source-id: 10b5bfb6f652f1703128d3b0c82b3785f8186558
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit 868e9b6 (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Please report bugs/suggestions to the (internal) Dr. CI Users group. |
|
This pull request was exported from Phabricator. Differential Revision: D35477135 |
) Summary: Pull Request resolved: #75461 This flag is needed in the OSS example and it wasn't clear that it was needed because it wasn't explicitly used when linking to torch deploy for the tests. Since torch deploy builds the tests using `python setup.py develop`, Pytorch actually sets this flag in the `CMAKE_EXE_LINKER_FLAGS` variable somewhere along the build. I had to print out all the variables used in the pytorch build to realize that I did not have this flag set in my OSS torch deploy example. I think having it explicit for the tests makes it clear which flags are actually necessary in an open source environment. **What is -rdynamic?** This flag (also known as `--export-dynamic` at the linker level) signals that the library it is targeting should export its symbols to the dynamic table. In doing so, shared libraries that are opened using `dlopen` (which is what torch deploy uses to launch subinterpreters: https://www.internalfb.com/code/fbsource/[ff6d5cfcc2b3]/xplat/caffe2/torch/csrc/deploy/deploy.cpp?lines=254), will be able to reference symbols defined in the modules that launched them. Without this flag, the symbols from the `torch::deploy` library that the subinterpreters need, remain `undefined`. This leads to runtime errors like: `/tmp/torch_XYZ: undefined symbol - torch::deploy::Etc.` `/tmp/torch_XYZ` is a subinterpreter. Test Plan: Ran the tests in an OSS environment `python torch/csrc/deploy/example/generate_examples.py` `./build/bin/test_deploy` Reviewed By: PaliC Differential Revision: D35477135 fbshipit-source-id: 30bd2b9fadd36b2a32066a52cda5b746d597e99f
|
Hey @s4ayub. |
Summary:
This flag is needed in the OSS example and it wasn't clear that it was needed because it wasn't explicitly used when linking to torch deploy for the tests.
Since torch deploy builds the tests using
python setup.py develop, Pytorch actually sets this flag in theCMAKE_EXE_LINKER_FLAGSvariable somewhere along the build. I had to print out all the variables used in the pytorch build to realize that I did not have this flag set in my OSS torch deploy example.I think having it explicit for the tests makes it clear which flags are actually necessary in an open source environment.
What is -rdynamic?
This flag (also known as
--export-dynamicat the linker level) signals that the library it is targeting should export its symbols to the dynamic table. In doing so, shared libraries that are opened usingdlopen(which is what torch deploy uses to launch subinterpreters: https://www.internalfb.com/code/fbsource/[ff6d5cfcc2b3]/xplat/caffe2/torch/csrc/deploy/deploy.cpp?lines=254), will be able to reference symbols defined in the modules that launched them.Without this flag, the symbols from the
torch::deploylibrary that the subinterpreters need, remainundefined.This leads to runtime errors like:
/tmp/torch_XYZ: undefined symbol - torch::deploy::Etc./tmp/torch_XYZis a subinterpreter.Test Plan:
Ran the tests in an OSS environment
python torch/csrc/deploy/example/generate_examples.py./build/bin/test_deployDifferential Revision: D35477135