Repository navigation
[BUG]: KeyError in load_dl_linux.py:47 EXPECTED_LIB_SYMBOLS[libname] #833
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workingcuda.pathfinderEverything related to the cuda.pathfinder moduleEverything related to the cuda.pathfinder moduletriageNeeds the team's attentionNeeds the team's attention
Milestone
Description
Is this a duplicate?
- I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct
Type of Bug
Runtime Error
Component
cuda.pathfinder
Describe the bug
Under certain circumstances code responsible for loading ctk libraries triggers key error for a library that is not part of ctk
How to Reproduce
python -m venv .venv
source .venv/bin/activate
pip install cuda-pathfinder
export CUDA_HOME=/usr/local/cuda12.9
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
wget -q https://developer.download.nvidia.com/compute/cudss/redist/libcudss/linux-x86_64/libcudss-linux-x86_64-0.5.0.16_cuda12-archive.tar.xz
tar -xvf libcudss-linux-x86_64-0.5.0.16_cuda12-archive.tar.xz
export LD_LIBRARY_PATH=$(pwd)/libcudss-linux-x86_64-0.5.0.16_cuda12-archive/lib:$LD_LIBRARY_PATH
python -c "from cuda import pathfinder as pf; print(pf.load_nvidia_dynamic_lib('cudss'))"Error:
python -c "from cuda import pathfinder as pf; print(pf.load_nvidia_dynamic_lib('cudss'))"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/scratch.yhavrylko_ent/Projects/nvidia/nvmath-python/.venv-sysctk12/lib/python3.11/site-packages/cuda/pathfinder/_dynamic_libs/load_nvidia_dynamic_lib.py", line 71, in load_nvidia_dynamic_lib
return _load_lib_no_cache(libname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/scratch.yhavrylko_ent/Projects/nvidia/nvmath-python/.venv-sysctk12/lib/python3.11/site-packages/cuda/pathfinder/_dynamic_libs/load_nvidia_dynamic_lib.py", line 40, in _load_lib_no_cache
loaded = load_with_system_search(libname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/scratch.yhavrylko_ent/Projects/nvidia/nvmath-python/.venv-sysctk12/lib/python3.11/site-packages/cuda/pathfinder/_dynamic_libs/load_dl_linux.py", line 104, in load_with_system_search
abs_path = abs_path_for_dynamic_library(libname, handle)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/scratch.yhavrylko_ent/Projects/nvidia/nvmath-python/.venv-sysctk12/lib/python3.11/site-packages/cuda/pathfinder/_dynamic_libs/load_dl_linux.py", line 47, in abs_path_for_dynamic_library
for symbol_name in EXPECTED_LIB_SYMBOLS[libname]:
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
KeyError: 'cudss'
Expected behavior
Find library with respect to LD_LIBRARY_PATH or at least return proper runtime error that library was not found (not preferable, since with nvidia-cudss-cu12 it loads library properly).
Operating System
No response
nvidia-smi output
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcuda.pathfinderEverything related to the cuda.pathfinder moduleEverything related to the cuda.pathfinder moduletriageNeeds the team's attentionNeeds the team's attention
Type
Projects
- StatusShow more project fieldsDone
Activity
leofang commentedon Aug 13, 2025
What does this mean?
rwgk commentedon Aug 13, 2025
The library was actually found and loaded.
To figure out the absolute path under Linux, we need a trick (I researched this a lot):
cuda-python/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/load_dl_linux.py
Lines 54 to 58 in b87c787
We need to get our hands on any one symbol in the library, and use that as a wedge (so to speak) to retrieve
info.dli_fname.This is really quite silly, but I haven't found a better way.
So, to support
cudss, really all we need is one symbol name.I'll give it a quick try.
rwgk commentedon Aug 13, 2025
The
abs_path_for_dynamic_library()function is called only fromcheck_if_already_loaded_from_elsewhere()andload_with_system_search(), but not if we figured out the absolute path already by searchingsite-packages.Quick update: ChatGPT 5 suggests we don't need
EXPECTED_LIB_SYMBOLS. If (!) that's true, it's a game changer, so I'll try it out now.rwgk commentedon Aug 13, 2025
PR #834 fixes this issue (in a very general way):
Local testing:
Output:
ZzEeKkAa commentedon Aug 13, 2025
If I install
cudssas a wheel - library is being loaded through the pathfinder correctly. If I installcudssas a tarball and setLD_LIBRARY_PATH, it runs into exception.