Skip to content

Commit 233ad08

Browse files
committed
Untangle CTK/Conda subdirs_list
1 parent 5b3c5eb commit 233ad08

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

cuda_pathfinder/cuda/pathfinder/_dynamic_libs/find_nvidia_dynamic_lib.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _find_dll_using_nvidia_bin_dirs(
8080
return None
8181

8282

83-
def _find_lib_dir_using_anchor_point(libname: str, anchor_point: str) -> Optional[str]:
83+
def _find_lib_dir_using_anchor_point(libname: str, anchor_point: str, linux_lib_dir: str) -> Optional[str]:
8484
subdirs_list: tuple[tuple[str, ...], ...]
8585
if IS_WINDOWS:
8686
if libname == "nvvm": # noqa: SIM108
@@ -97,10 +97,7 @@ def _find_lib_dir_using_anchor_point(libname: str, anchor_point: str) -> Optiona
9797
if libname == "nvvm": # noqa: SIM108
9898
subdirs_list = (("nvvm", "lib64"),)
9999
else:
100-
subdirs_list = (
101-
("lib64",), # CTK
102-
("lib",), # Conda
103-
)
100+
subdirs_list = ((linux_lib_dir,),)
104101
for sub_dirs in subdirs_list:
105102
dirname: str # work around bug in mypy
106103
for dirname in find_sub_dirs((anchor_point,), sub_dirs):
@@ -112,15 +109,15 @@ def _find_lib_dir_using_cuda_home(libname: str) -> Optional[str]:
112109
cuda_home = get_cuda_home_or_path()
113110
if cuda_home is None:
114111
return None
115-
return _find_lib_dir_using_anchor_point(libname, cuda_home)
112+
return _find_lib_dir_using_anchor_point(libname, anchor_point=cuda_home, linux_lib_dir="lib64")
116113

117114

118115
def _find_lib_dir_using_conda_prefix(libname: str) -> Optional[str]:
119116
conda_prefix = os.getenv("CONDA_PREFIX")
120117
if not conda_prefix:
121118
return None
122119
return _find_lib_dir_using_anchor_point(
123-
libname, os.path.join(conda_prefix, "Library") if IS_WINDOWS else conda_prefix
120+
libname, anchor_point=os.path.join(conda_prefix, "Library") if IS_WINDOWS else conda_prefix, linux_lib_dir="lib"
124121
)
125122

126123

0 commit comments

Comments
 (0)