Giter Club home page Giter Club logo

Comments (6)

leofang avatar leofang commented on June 14, 2024

NVRTC is now dlopen'd

return SoftLink(libname, prefix, mandatory=True)

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.

ccoulombe avatar ccoulombe commented on June 14, 2024

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.

kmaehashi avatar kmaehashi commented on June 14, 2024

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:

  1. Add a new extension module cupy_backends.cuda.libs._cuda_deps, which has libnvrtc.so.12 as NEEDED.
  2. During import cupy, do import 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.

leofang avatar leofang commented on June 14, 2024

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.

leofang avatar leofang commented on June 14, 2024

@ccoulombe gentle ping, could you help us understand better?

from cupy.

ccoulombe avatar ccoulombe commented on June 14, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.