Plugins should set rpath so that they can load their dependencies - #612
Conversation
…runtime without needing LD_LIBRARY_PATH Signed-off-by: Ovidiu Mara <ovidium@nvidia.com>
|
👋 Hi ovidiusm! Thank you for contributing to ai-dynamo/nixl. Your PR reviewers will review your contribution then trigger the CI to test your changes. 🚀 |
|
i wonder which nixl libs are needed by plugins? i would expect the main nixl libs would already be loaded in the program when we dlopen() the plugin file? |
The exact issue I have seen was with a plugin trying to load another plugin: For this we need to add $ORIGIN to rpath. Regarding $ORIGIN/.. : It might be possible to have libnixl loading a plugin that then tries to load another nixl library from the parent directory that is not already loaded in the process. I have not seen this fail so far. But it does not hurt to add $ORIGIN/.. since that should be the first location in which the library is looked up. |
|
IMO it should be only $ORIGIN/.. and plugin should not load other plugins, but depend on a common lib instead. Can we check why UCX_MO depends on UCX plugin and not only on libucx_utils.so? |
Good question. UCX MO was built to create a separate UCX plugin instance per GPU: It's a very thin wrapper around the other plugin. IIRC it was made because of a limitation where we could not work with multiple GPUs at the same time from the same plugin. Maybe we can use $ORIGIN/.. and make an exception just for UCX MO, what do you think? |
Yes, was just going to suggest to make ucx_mo use also $ORIGIN as exception + add FIXME comment |
Signed-off-by: Ovidiu Mara <ovidium@nvidia.com>
|
Done. |
|
/build |
|
/build |
…-dynamo#612) * Plugins should set rpath so that they can load their dependencies at runtime without needing LD_LIBRARY_PATH Signed-off-by: Ovidiu Mara <ovidium@nvidia.com> * Adjust rpath so that plugins load binary deps from parent dir only Signed-off-by: Ovidiu Mara <ovidium@nvidia.com> --------- Signed-off-by: Ovidiu Mara <ovidium@nvidia.com> Co-authored-by: Yossi Itigin <yosefe@nvidia.com>
…) (#647) * Plugins should set rpath so that they can load their dependencies at runtime without needing LD_LIBRARY_PATH * Adjust rpath so that plugins load binary deps from parent dir only --------- Signed-off-by: Ovidiu Mara <ovidium@nvidia.com> Co-authored-by: Yossi Itigin <yosefe@nvidia.com>
What?
Set rpath to $ORIGIN (plugin dir) and $ORIGIN/.. (nixl lib dir) for all plugins
Why?
Some of the plugins do not load in the TRT-LLM image because LD_LIBRARY_PATH is not set to include the nixl directory; and some also need the plugin directory. But LD_LIBRARY_PATH should not be needed. Only the main nixl libs must be loadable; then when they dlopen() the plugins, the dependencies should be resolved automatically.
We set both current dir and parent dir because some plugins depend on other plugins; and all plugins depend on the nixl libs from the parent dir.