You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Unmodified copies of:
* https://github.com/NVIDIA/numba-cuda/blob/bf487d78a40eea87f009d636882a5000a7524c95/numba_cuda/numba/cuda/cuda_paths.py
* https://github.com/numba/numba/blob/f0d24824fcd6a454827e3c108882395d00befc04/numba/misc/findlib.py
* Add Forked from URLs.
* Strip down cuda_paths.py to minimum required for `_get_nvvm_path()`
Tested interactively with:
```
import cuda_paths
nvvm_path = cuda_paths._get_nvvm_path()
print(f"{nvvm_path=}")
```
* ruff auto-fixes (NO manual changes)
* Make `get_nvvm_path()` a pubic API (i.e. remove leading underscore).
* Fetch numba-cuda/numba_cuda/numba/cuda/cuda_paths.py from NVIDIA/numba-cuda#155 AS-IS
* ruff format NO MANUAL CHANGES
* Minimal changes to adapt numba-cuda/numba_cuda/numba/cuda/cuda_paths.py from NVIDIA/numba-cuda#155
* Rename ecosystem/cuda_paths.py -> path_finder.py
* Plug cuda.bindings.path_finder into cuda/bindings/_internal/nvvm_linux.pyx
* Plug cuda.bindings.path_finder into cuda/bindings/_internal/nvjitlink_linux.pyx
* Fix `os.path.exists(None)` issue:
```
______________________ ERROR collecting test_nvjitlink.py ______________________
tests/test_nvjitlink.py:62: in <module>
not check_nvjitlink_usable(), reason="nvJitLink not usable, maybe not installed or too old (<12.3)"
tests/test_nvjitlink.py:58: in check_nvjitlink_usable
return inner_nvjitlink._inspect_function_pointer("__nvJitLinkVersion") != 0
cuda/bindings/_internal/nvjitlink.pyx:257: in cuda.bindings._internal.nvjitlink._inspect_function_pointer
???
cuda/bindings/_internal/nvjitlink.pyx:260: in cuda.bindings._internal.nvjitlink._inspect_function_pointer
???
cuda/bindings/_internal/nvjitlink.pyx:208: in cuda.bindings._internal.nvjitlink._inspect_function_pointers
???
cuda/bindings/_internal/nvjitlink.pyx:102: in cuda.bindings._internal.nvjitlink._check_or_init_nvjitlink
???
cuda/bindings/_internal/nvjitlink.pyx:59: in cuda.bindings._internal.nvjitlink.load_library
???
/opt/hostedtoolcache/Python/3.13.2/x64/lib/python3.13/site-packages/cuda/bindings/path_finder.py:312: in get_cuda_paths
"nvvm": _get_nvvm_path(),
/opt/hostedtoolcache/Python/3.13.2/x64/lib/python3.13/site-packages/cuda/bindings/path_finder.py:285: in _get_nvvm_path
by, path = _get_nvvm_path_decision()
/opt/hostedtoolcache/Python/3.13.2/x64/lib/python3.13/site-packages/cuda/bindings/path_finder.py:96: in _get_nvvm_path_decision
if os.path.exists(nvvm_ctk_dir):
<frozen genericpath>:19: in exists
???
E TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
```
* Fix another `os.path.exists(None)` issue:
```
______________________ ERROR collecting test_nvjitlink.py ______________________
tests/test_nvjitlink.py:62: in <module>
not check_nvjitlink_usable(), reason="nvJitLink not usable, maybe not installed or too old (<12.3)"
tests/test_nvjitlink.py:58: in check_nvjitlink_usable
return inner_nvjitlink._inspect_function_pointer("__nvJitLinkVersion") != 0
cuda/bindings/_internal/nvjitlink.pyx:257: in cuda.bindings._internal.nvjitlink._inspect_function_pointer
???
cuda/bindings/_internal/nvjitlink.pyx:260: in cuda.bindings._internal.nvjitlink._inspect_function_pointer
???
cuda/bindings/_internal/nvjitlink.pyx:208: in cuda.bindings._internal.nvjitlink._inspect_function_pointers
???
cuda/bindings/_internal/nvjitlink.pyx:102: in cuda.bindings._internal.nvjitlink._check_or_init_nvjitlink
???
cuda/bindings/_internal/nvjitlink.pyx:59: in cuda.bindings._internal.nvjitlink.load_library
???
/opt/hostedtoolcache/Python/3.13.2/x64/lib/python3.13/site-packages/cuda/bindings/path_finder.py:313: in get_cuda_paths
"libdevice": _get_libdevice_paths(),
/opt/hostedtoolcache/Python/3.13.2/x64/lib/python3.13/site-packages/cuda/bindings/path_finder.py:126: in _get_libdevice_paths
by, libdir = _get_libdevice_path_decision()
/opt/hostedtoolcache/Python/3.13.2/x64/lib/python3.13/site-packages/cuda/bindings/path_finder.py:73: in _get_libdevice_path_decision
if os.path.exists(libdevice_ctk_dir):
<frozen genericpath>:19: in exists
???
E TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
```
* Change "/lib64/" → "/lib/" in nvjitlink_linux.pyx
* nvjitlink_linux.pyx load_library() enhancements, mainly to avoid os.path.join(None, "libnvJitLink.so")
* Add missing f-string f
* Add back get_nvjitlink_dso_version_suffix() call.
* pytest -ra -s -v
* Rewrite nvjitlink_linux.pyx load_library() to produce detailed error messages.
* Attach listdir output to "Unable to load" exception message.
* Guard os.listdir() call with os.path.isdir()
* Fix logic error in nvjitlink_linux.pyx load_library()
* Move path_finder.py to _path_finder_utils/cuda_paths.py, import only public functions from new path_finder.py
* Add find_nvidia_dynamic_library() and use from nvjitlink_linux.pyx, nvvm_linux.pyx
* Fix oversight in _find_using_lib_dir()
* Also look for versioned library in _find_using_nvidia_lib_dirs()
* glob.glob() Python 3.9 compatibility
* Reduce build-and-test.yml to Windows-only, Python 3.12 only.
* Comment out `if: ${{ github.repository_owner == nvidia }}`
* Revert "Comment out `if: ${{ github.repository_owner == nvidia }}`"
This reverts commit b0db24f.
* Add back `linux-64` `host-platform`
* Rewrite load_library() in nvjitlink_windows.pyx to use path_finder.find_nvidia_dynamic_library()
* Revert "Rewrite load_library() in nvjitlink_windows.pyx to use path_finder.find_nvidia_dynamic_library()"
This reverts commit 1bb7151.
* Add _inspect_environment() in find_nvidia_dynamic_library.py, call from nvjitlink_windows.pyx, nvvm_windows.pyx
* Add & use _find_dll_using_nvidia_bin_dirs(), _find_dll_using_cudalib_dir()
* Fix silly oversight: forgot to undo experimental change.
* Also reduce test test-linux matrix.
* Reimplement load_library() functions in nvjitlink_windows.pyx, nvvm_windows.pyx to actively use path_finder.find_nvidia_dynamic_library()
* Factor out load_nvidia_dynamic_library() from _internal/nvjitlink_linux.pyx, nvvm_linux.pyx
* Generalize load_nvidia_dynamic_library.py to also work under Windows.
* Add `void*` return type to load_library() implementations in _internal/nvjitlink_windows.pyx, nvvm_windows.pyx
* Resolve cython error: object handle vs `void*` handle
```
Error compiling Cython file:
------------------------------------------------------------
...
err = (<int (*)(int*) nogil>__cuDriverGetVersion)(&driver_ver)
if err != 0:
raise RuntimeError('something went wrong')
# Load library
handle = load_library(driver_ver)
^
------------------------------------------------------------
cuda\bindings\_internal\nvjitlink.pyx:72:29: Cannot convert 'void *' to Python object
```
* Resolve another cython error: `void*` handle vs `intptr_t` handle
```
Error compiling Cython file:
------------------------------------------------------------
...
handle = load_library(driver_ver)
# Load function
global __nvJitLinkCreate
try:
__nvJitLinkCreate = <void*><intptr_t>win32api.GetProcAddress(handle, 'nvJitLinkCreate')
^
------------------------------------------------------------
cuda\bindings\_internal\nvjitlink.pyx:78:73: Cannot convert 'void *' to Python object
```
* Resolve signed/unsigned runtime error. Use uintptr_t consistently.
https://github.com/NVIDIA/cuda-python/actions/runs/14224673173/job/39861750852?pr=447#logs
```
=================================== ERRORS ====================================
_____________________ ERROR collecting test_nvjitlink.py ______________________
tests\test_nvjitlink.py:62: in <module>
not check_nvjitlink_usable(), reason="nvJitLink not usable, maybe not installed or too old (<12.3)"
tests\test_nvjitlink.py:58: in check_nvjitlink_usable
return inner_nvjitlink._inspect_function_pointer("__nvJitLinkVersion") != 0
cuda\\bindings\\_internal\\nvjitlink.pyx:221: in cuda.bindings._internal.nvjitlink._inspect_function_pointer
???
cuda\\bindings\\_internal\\nvjitlink.pyx:224: in cuda.bindings._internal.nvjitlink._inspect_function_pointer
???
cuda\\bindings\\_internal\\nvjitlink.pyx:172: in cuda.bindings._internal.nvjitlink._inspect_function_pointers
???
cuda\\bindings\\_internal\\nvjitlink.pyx:73: in cuda.bindings._internal.nvjitlink._check_or_init_nvjitlink
???
cuda\\bindings\\_internal\\nvjitlink.pyx:46: in cuda.bindings._internal.nvjitlink.load_library
???
E OverflowError: can't convert negative value to size_t
```
* Change <void*><uintptr_t>win32api.GetProcAddress` back to `intptr_t`. Changing load_nvidia_dynamic_library() to also use to-`intptr_t` conversion, for compatibility with win32api.GetProcAddress. Document that CDLL behaves differently (it uses to-`uintptr_t`).
* Use win32api.LoadLibrary() instead of ctypes.windll.kernel32.LoadLibraryW(), to be more similar to original (and working) cython code.
Hoping to resolve this kind of error:
```
_ ERROR at setup of test_c_or_v_program_fail_bad_option[txt-compile_program] __
request = <SubRequest 'minimal_nvvmir' for <Function test_c_or_v_program_fail_bad_option[txt-compile_program]>>
@pytest.fixture(params=MINIMAL_NVVMIR_FIXTURE_PARAMS)
def minimal_nvvmir(request):
for pass_counter in range(2):
nvvmir = MINIMAL_NVVMIR_CACHE.get(request.param, -1)
if nvvmir != -1:
if nvvmir is None:
pytest.skip(f"UNAVAILABLE: {request.param}")
return nvvmir
if pass_counter:
raise AssertionError("This code path is meant to be unreachable.")
# Build cache entries, then try again (above).
> major, minor, debug_major, debug_minor = nvvm.ir_version()
tests\test_nvvm.py:148:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cuda\bindings\nvvm.pyx:95: in cuda.bindings.nvvm.ir_version
cpdef tuple ir_version():
cuda\bindings\nvvm.pyx:113: in cuda.bindings.nvvm.ir_version
status = nvvmIRVersion(&major_ir, &minor_ir, &major_dbg, &minor_dbg)
cuda\bindings\cynvvm.pyx:19: in cuda.bindings.cynvvm.nvvmIRVersion
return _nvvm._nvvmIRVersion(majorIR, minorIR, majorDbg, minorDbg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E cuda.bindings._internal.utils.FunctionNotFoundError: function nvvmIRVersion is not found
```
* Remove debug print statements.
* Remove some cruft.
* Trivial renaming of variables. No functional changes.
* Revert debug changes under .github/workflows
* Rename _path_finder_utils → _path_finder
* Remove LD_LIBRARY_PATH in fetch_ctk/action.yml
* Linux: First try using the platform-specific dynamic loader search mechanisms
* Add _windows_load_with_dll_basename()
* Revert "Revert debug changes under .github/workflows"
This reverts commit cc6113c.
* Add debug prints in load_nvidia_dynamic_library()
* Report dlopen error for libnvrtc.so.12
* print("\nLOOOK dlfcn.dlopen('libnvrtc.so.12', dlfcn.RTLD_NOW)", flush=True)
* Revert "Remove LD_LIBRARY_PATH in fetch_ctk/action.yml"
This reverts commit 1b1139c.
* Only remove ${CUDA_PATH}/nvvm/lib64 from LD_LIBRARY_PATH
* Use path_finder.load_nvidia_dynamic_library("nvrtc") from cuda/bindings/_bindings/cynvrtc.pyx.in
* Somewhat ad hoc heuristics for nvidia_cuda_nvrtc wheels.
* Remove LD_LIBRARY_PATH entirely from .github/actions/fetch_ctk/action.yml
* Remove CUDA_PATH\nvvm\bin in .github/workflows/test-wheel-windows.yml
* Revert "Remove LD_LIBRARY_PATH entirely from .github/actions/fetch_ctk/action.yml"
This reverts commit bff8cf0.
* Revert "Somewhat ad hoc heuristics for nvidia_cuda_nvrtc wheels."
This reverts commit 43abec8.
* Restore cuda/bindings/_bindings/cynvrtc.pyx.in as-is on main
* Remove debug print from load_nvidia_dynamic_library.py
* Reapply "Revert debug changes under .github/workflows"
This reverts commit aaa6aff.
0 commit comments