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
what should i do to disable libcaffe2_nvrtc.so #31985
Comments
I'm not following what "pure executable file without anything .so about torch" means, could you please clarify? |
@zou3519 If the system environment changes, which only install mkl and cuda, however, executable file cannot run because it need the shared libs--libcaffe2_nvrtc.so
|
I'm in the same situation. I'm building a plugin for a commercial host application. This plugin, which is in the form of a shared library (.so file), is statically linking libtorch (i.e. it's baking all of it into it's own so file). The only libraries that are dynamically linked against are the CUDA libs. This plugin needs to be portable to other systems without the need to install lots of dependencies (CUDA is fine to be needed as an additional install). Everything works, except I can't get my shared library to not also need the torch library "libcaffe2_nvrtc.so". Since it doesn't exist a static version of this library "libcaffe2_nvrtc.a", I can't seem to get around it. Is there a way to not have libtorch dynamically depend on this library and still have GPU support? I can build libtorch with CPU support only, and then I don't have the problem, but I need the GPU accelleration. |
I am having the same problem as @wahlberg82. Running my executable with CPU only doesn't spawn any problems, but trying to run it with GPU after compilation gives: "Error in dlopen or dlsym: libcaffe2_nvrtc.so: cannot open shared object file: No such file or directory". I also need this as a standalone that can run perfectly by itself. |
Is have same problem. Hoe make static link libtorch? |
PR against master should address the issue (although your application will still have dynamic dependency on NVRTC library) |
I did a pull of the nightly master yesterday and recompiled statically. I can confirm that this fix is working well and solving the issue. Thanks all for fixing this so quickly and being such a great community! |
Summary: Instead of dynamically loading `caffe2_nvrtc`, lazyNVRTC provides the same functionality by binding all the hooks to lazy bind implementation, very similar to the shared library jump tables: On the first call, each function from the list tries to get a global handle to the respective shared library and replace itself with the dynamically resolved symbol, using the following template: ``` auto fn = reinterpret_cast<decltype(&NAME)>(getCUDALibrary().sym(C10_SYMBOLIZE(NAME))); if (!fn) throw std::runtime_error("Can't get" ## NAME); lazyNVRTC.NAME = fn; return fn(...) ``` Fixes pytorch/pytorch#31985 Pull Request resolved: pytorch/pytorch#45674 Reviewed By: ezyang Differential Revision: D24073946 Pulled By: malfet fbshipit-source-id: 1479a75e5200e14df003144625a859d312885874
Summary: Instead of dynamically loading `caffe2_nvrtc`, lazyNVRTC provides the same functionality by binding all the hooks to lazy bind implementation, very similar to the shared library jump tables: On the first call, each function from the list tries to get a global handle to the respective shared library and replace itself with the dynamically resolved symbol, using the following template: ``` auto fn = reinterpret_cast<decltype(&NAME)>(getCUDALibrary().sym(C10_SYMBOLIZE(NAME))); if (!fn) throw std::runtime_error("Can't get" ## NAME); lazyNVRTC.NAME = fn; return fn(...) ``` Fixes pytorch/pytorch#31985 Pull Request resolved: pytorch/pytorch#45674 Reviewed By: ezyang Differential Revision: D24073946 Pulled By: malfet fbshipit-source-id: 1479a75e5200e14df003144625a859d312885874
I find that executable file must link against libcaffe2_nvrtc.so,but I dont want to link against it due to my projects, I need pure executable file without anything .so about torch, so I build static torch libs and unfortunately libcaffe2_nvrtc.so stoped me
the question is about CUDAHooks.cpp
and the errors is :
cc @ngimel
The text was updated successfully, but these errors were encountered: