Skip to content

fix(deps): try to dynamically load nvrtc from wheel#2299

Merged
rapids-bot[bot] merged 1 commit into
NVIDIA:mainfrom
gforsyth:dynload_nvrtc
Jul 6, 2026
Merged

fix(deps): try to dynamically load nvrtc from wheel#2299
rapids-bot[bot] merged 1 commit into
NVIDIA:mainfrom
gforsyth:dynload_nvrtc

Conversation

@gforsyth

@gforsyth gforsyth commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Same patch as cudf#23089

I am testing a smaller base image for wheel testing in #2298 -- the current dlopen scripts find libnvrtc.so.12 when the base image is the full cuda development image, but they don't find it when it's provided by nvidia-cuda-nvrtc-cu12.

Here's what the loading looks like with a before+after of this fix:

>>> import libcuvs
>>> libcuvs.load_library()
[]

# so nothing was loaded above (silent failure due to the way wheel library loading is architected)
# try to directly load `libcuvs.so`

>>> from libcuvs.load import _load_wheel_installation
>>> _load_wheel_installation('libcuvs.so')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/pyenv/versions/3.11.15/lib/python3.11/site-packages/libcuvs/load.py", line 31, in _load_wheel_installation
    return ctypes.CDLL(lib, PREFERRED_LOAD_FLAG)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pyenv/versions/3.11.15/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: libnvrtc.so.12: cannot open shared object file: No such file or directory

# that's the issue preventing `libcuvs.so` from loading

# use cuda.pathfinder to load nvrtc
>>> from cuda.pathfinder import load_nvidia_dynamic_lib
>>> load_nvidia_dynamic_lib('nvrtc')
LoadedDL(abs_path='/pyenv/versions/3.11.15/lib/python3.11/site-packages/nvidia/cuda_nvrtc/lib/libnvrtc.so.12', was_already_loaded_from_elsewhere=False, _handle_uint=95154333901152, found_via='site-packages')

# now load `libcuvs.so` again:
>>> _load_wheel_installation('libcuvs.so')
<CDLL '/pyenv/versions/3.11.15/lib/python3.11/site-packages/libcuvs/lib64/libcuvs.so', handle 568ad84cc0c0 at 0x70554dc89b90>

xref rapidsai/build-planning#143

@gforsyth gforsyth requested a review from a team as a code owner July 6, 2026 14:38
@gforsyth gforsyth added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Jul 6, 2026
@gforsyth

gforsyth commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot rapids-bot Bot merged commit 8d51134 into NVIDIA:main Jul 6, 2026
73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants