Skip to content
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

NVVM bindings not working on Windows + CUDA conda packages #453

Open
leofang opened this issue Feb 18, 2025 · 2 comments
Open

NVVM bindings not working on Windows + CUDA conda packages #453

leofang opened this issue Feb 18, 2025 · 2 comments
Assignees
Labels
bug Something isn't working cuda.bindings Everything related to the cuda.bindings module P0 High priority - Must do!

Comments

@leofang
Copy link
Member

leofang commented Feb 18, 2025

As discussed offline, the search logic here

# First check if the DLL has been loaded by 3rd parties
try:
handle = win32api.GetModuleHandle(dll_name)
except:
pass
else:
break
# Next, check if DLLs are installed via pip
for sp in get_site_packages():
mod_path = os.path.join(sp, "nvidia", "nvJitLink", "bin")
if not os.path.isdir(mod_path):
continue
os.add_dll_directory(mod_path)
try:
handle = win32api.LoadLibraryEx(
# Note: LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR needs an abs path...
os.path.join(mod_path, dll_name),
0, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR)
except:
pass
else:
break
# Finally, try default search
try:
handle = win32api.LoadLibrary(dll_name)
except:
pass
else:
break

does not look for conda installations , which has the following path:

%CONDA_PREFIX%\Library\nvvm\lib\x64\nvvm.lib

One way to fix it is to patch to the internal template and regenerate the above file.

@leofang leofang added bug Something isn't working cuda.bindings Everything related to the cuda.bindings module P0 High priority - Must do! labels Feb 18, 2025
@leofang leofang added this to the cuda-python 12-next, 11-next milestone Feb 18, 2025
@leofang
Copy link
Member Author

leofang commented Feb 18, 2025

(FWIW this is the reason why we want to have a general solution #451 🙂)

@leofang
Copy link
Member Author

leofang commented Feb 18, 2025

To make the situation worse, CUDA 11 and CUDA 12 conda packages have different layouts:
https://github.com/conda-forge/cudatoolkit-feedstock/blob/0f01f6edfe22e77ac068daa46505711a1481272e/recipe/meta.yaml#L681-L683
(see docs in https://github.com/conda-forge/cuda-feedstock/tree/main/recipe for more info on the "new" layout)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cuda.bindings Everything related to the cuda.bindings module P0 High priority - Must do!
Projects
None yet
Development

No branches or pull requests

2 participants