Skip to content

Commit 2cc9161

Browse files
committed
fix: add /usr/local/cuda fallback for CTK header discovery
When `CUDA_PATH`/`CUDA_HOME` are unset, fall back to `/usr/local/cuda` on non-Windows platforms. Aligns with CuPy's `get_cuda_path()` behavior and fixes CuPy header detection in containers (e.g. Holoscan). Ref: PR #956
1 parent 7832aaf commit 2cc9161

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

cuda_pathfinder/cuda/pathfinder/_headers/find_nvidia_headers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ def _find_ctk_header_directory(libname: str) -> LocatedHeaderDir | None:
107107
if result := _locate_based_on_ctk_layout(libname, h_basename, cuda_home):
108108
return LocatedHeaderDir(abs_path=result, found_via="CUDA_HOME")
109109

110+
# Fallback: typical system install path (matches CuPy's get_cuda_path())
111+
if not IS_WINDOWS and os.path.exists('/usr/local/cuda'):
112+
if result := _locate_based_on_ctk_layout(libname, h_basename, '/usr/local/cuda'):
113+
return LocatedHeaderDir(abs_path=result, found_via="system_default")
114+
110115
return None
111116

112117

0 commit comments

Comments
 (0)