Skip to content

Commit 39ad4e2

Browse files
committed
chore: handle the variants
1 parent df85e29 commit 39ad4e2

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

cuda_pathfinder/cuda/pathfinder/_binaries/find_nvidia_binary_utility.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,20 @@ def find_nvidia_binary_utility(utility_name: str) -> str | None:
8484

8585
# 1. Search in site-packages (NVIDIA wheels)
8686
candidate_dirs = supported_nvidia_binaries.SITE_PACKAGES_BINDIRS.get(utility_name, ())
87-
dirs = [bindir for sub_dir in candidate_dirs if (bindir := find_sub_dirs_all_sitepackages(sub_dir.split("/")))]
87+
dirs = [bin_dir for sub_dir in candidate_dirs if (bin_dir := find_sub_dirs_all_sitepackages(sub_dir.split(os.sep)))]
8888

8989
# 2. Search in Conda environment
90-
conda_prefix = os.environ.get("CONDA_PREFIX")
91-
if conda_prefix is not None:
90+
if (conda_prefix := os.environ.get("CONDA_PREFIX")) is not None:
9291
if IS_WINDOWS:
93-
dirs.append(os.path.join(conda_prefix, "Library"))
94-
dirs.append(conda_prefix)
92+
dirs.append(os.path.join(conda_prefix, "Library", "bin"))
93+
dirs.append(os.path.join(conda_prefix, "bin"))
9594

9695
# 3. Search in CUDA Toolkit (CUDA_HOME/CUDA_PATH)
97-
cuda_home = get_cuda_home_or_path()
98-
if cuda_home is not None:
99-
dirs.append(cuda_home)
96+
if (cuda_home := get_cuda_home_or_path()) is not None:
97+
if IS_WINDOWS:
98+
dirs.extend(os.path.join(cuda_home, "bin", "x64"))
99+
dirs.append(os.path.join(cuda_home, "bin", "x86_64"))
100+
dirs.append(os.path.join(cuda_home, "bin"))
100101

101102
normalized_name = _normalize_utility_name(utility_name)
102103
return shutil.which(normalized_name, path=os.pathsep.join(dirs))

0 commit comments

Comments
 (0)