-
-
Notifications
You must be signed in to change notification settings - Fork 886
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
Lazy import cuSOLVER #7843
Lazy import cuSOLVER #7843
Conversation
What if I change to use dlopen in |
TBH, after working on this PR, I'm a bit surprised how it is simple to lazy-import cuSOLVER than I initially expected. Although I still think soft linking (or cuSOLVER/cuSPARSE/cuFFT/... support in CUDA Python) is something we will need to support "one CuPy package for all CUDA versions", this is not mandatory to achieve #7620 in v13. For the modules listed in #7620, I'm currently assessing only Runtime & Driver require soft linking (which is imported/cimported from many places), and the remaining can be done just by lazy-importing. I'm thinking of next try lazy-importing cuSPARSE and see if my assumption is correct. As Jitify and CUB modules also have C/C++ level dependencies to CTK, we will need lazy-importing for them anyway. |
35e913a
to
c157e00
Compare
/test mini |
In light of #7727, I would suggest to always statically link to cudart and soft-link to driver/NVRTC. Then,
|
Is it safe to mix multiple versions of CUDA runtimes within the same process? If so, let's static link CUDART to CUB to avoid lazy-importing. 😃 |
If you're referring to static linking to cudart, yes it is safe by design. As long as all DSOs see the same user-mode driver (libcuda), which is already upheld by design, it'd work just fine. Think of it as removing cudart from the dependency chain:
|
(btw NVCC by default statically links to cudart, I suspect we don't see that for any CuPy modules because we use gcc instead of nvcc to link, which is also fine, just FYI) |
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 for the clarification, Leo! Just submitted a PR to static link cudart to CUB (#7850) |
This is a part of #7620.
I tried to softlink cuSOLVER as I did in NVRTC but found there is a native function calls to cuSOLVER in
cupy_lapack.h
where softlink doesn't work.For cuSOLVER I'm thinking of using lazy-import instead of softlink.
Depends on
#7840(merged).