Comments (6)
NVRTC is now dlopen'd
cupy/cupy_backends/cuda/libs/_cnvrtc.pxi
Line 143 in a384b1a
it was part of v13 efforts (#7620) to help CuPy packages stay minimal. This means you need to make it searchable by the dynamic linker (say, set
LD_LIBRARY_PATH
). Could you give it a shot?from cupy.
Setting LD_LIBRARY_PATH
is a workaround but we generally avoid using it. It works, but is not a solution unfortunately as we cannot tell thousands of users to set LD_LIBRARY_PATH for cupy to works. In my opinion, it is best to fail early if cupy depends on cuda.
ctypes find_library has a bug since forever where it does not return the full path of the library, hence not founding said library when they are installed in non standard location, such as on HPC systems. https://bugs.python.org/issue21042
We hacked ctypes with our own version to palliate for this issue, but even that does not work:
[coulombc@ng10403 ~]$ module load gcc python/3.11 cuda/12 custom-ctypes
[coulombc@ng10403 ~]$ makevenv
(15787) [coulombc@ng10403 ~]$ pip install --no-index cupy-13.0.0+computecanada-cp311-cp311-linux_x86_64.whl
(15787) [coulombc@ng10403 ~]$ python -c "import cupy; cupy.show_config()"
RuntimeError: CuPy failed to load libcudart.so.12: OSError: libcudart.so.12: cannot open shared object file: No such file or directory
I'll dig a bit more into why it did not work with our custom-ctypes, but since cupy
links on cuda, would it be possible to offer distributors the option to soft or hard link on cuda libraries? Soft linking does not work for many of us unfortunately.
I could also patch cupy to add needed libs, but I'd prefer to avoid doing that systematically for every release now on.
from cupy.
Thanks for the feedback @ccoulombe, this is a thing I overlooked when moving to ctypes-based loading. I think we can fix it on our side as follows:
- Add a new extension module
cupy_backends.cuda.libs._cuda_deps
, which haslibnvrtc.so.12
as NEEDED. - During
import cupy
, doimport cupy_backends.cuda.libs._cuda_deps
while ignoring any errors raised.
If libnvrtc.so.12
can be discovered in step 2, ctypes.CDLL("libnvrtc.so.12")
will use that shared library. This should allow RPATH set during the build to be searched first.
from cupy.
I am still confused, though. @ccoulombe I agree no one wants users to set LD_LIBRARY_PATH
, but isn't this HPC system admin's job to ensure there's a mechanism for putting DSOs in a linker-searchable path via some administrated mechanisms (ex: module load
)? If the admins set up a proper mechanism and the user follows, ideally the DSOs would be discoverable at run time by the linker, and users don't have do anything weird. (And you don't have to build CuPy from source to hack RPATH.)
To make RPATH work, we still need the DSOs to be locatable by the linker, so I don't know what problem it'd solve?
from cupy.
@ccoulombe gentle ping, could you help us understand better?
from cupy.
@leofang Sorry for the delay, thanks for the ping! :)
I'm out of office and want to take the time to provide a detailed response, I'll add it shortly!
from cupy.
Related Issues (20)
- Jitify is performing a one-time only warm-up to populate the persistent cache HOT 7
- cp.unique runs forever HOT 2
- cupy.sign(NaN) == 0, unlike numpy HOT 9
- [Deleted]
- `cupyx.scipy.sparse._csr.csr_matrix.getcol()` -1 indexing
- Build error on main under Windows w/ CUDA 12.2 HOT 3
- how to properly import cupyx submodules HOT 2
- Support CUDA 12.5
- The version number on main seems to be out of date HOT 2
- cupy do not suport two axis operation? HOT 4
- Create ndarray backed by CUDAarray UnownedPointer from c++ HOT 3
- Does cuPy provide any deterministic result guarantees (i.e., bitwise reproducible)? HOT 2
- Should `cp.ndarray.__getitem__(some_object)` check to see if `some_object` implements `__cuda_array_interface__` or DLPack? HOT 1
- `libnccl.so` is preloaded eagerly for CuPy wheel HOT 2
- Remove support for NVTX earlier than v1
- Add CI to test import with NumPy v1/v2
- need window support for cupy plz HOT 1
- cupyx.scipy.map_coordinates recompiled when coordinates array shape changes
- Stream context manager does not preserve previous cupy.cuda.Stream.use() call
- Certain calls in cupy/cupyx always require a c++ compiler on Windows despite precompiled kernels. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cupy.