Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
eeef550
Add find_site_packages_so.py
rwgk Aug 19, 2025
678947b
Use find_all_so_files_under_all_site_packages() from _find_so_using_n…
rwgk Aug 19, 2025
c3e5d33
Bump cuda-pathfinder version to `1.1.1a3`
rwgk Aug 19, 2025
6421b49
Limit site-packages search to ("nvidia", "nvpl") subdirs.
rwgk Aug 19, 2025
8dc6dd5
Replace find_all_so_files_under_all_site_packages → find_all_so_files…
rwgk Aug 19, 2025
7376bef
Add find_site_packages_dll.py and use from _find_dll_using_nvidia_bin…
rwgk Aug 20, 2025
37b8822
Add mathdx, cufftMp DIRECT_DEPENDENCIES
rwgk Aug 20, 2025
d12cc2c
Add LIBNAMES_REQUIRING_RTLD_DEEPBIND feature (for cufftMp)
rwgk Aug 20, 2025
f3db887
pyproject.toml: add libmathdx, cufftmpm nvshmem, nvpl-fft wheels for …
rwgk Aug 20, 2025
1951ab7
Add SITE_PACKAGES_LIBDIRS_LINUX
rwgk Aug 20, 2025
c6fe20a
Add make_site_packages_libdirs_linux.py
rwgk Aug 20, 2025
fcc7a7c
Use SITE_PACKAGES_LIBDIRS_LINUX in _find_so_using_nvidia_lib_dirs, ke…
rwgk Aug 20, 2025
72fa759
Add SITE_PACKAGES_LIBDIRS_WINDOWS and toolshed/make_site_packages_lib…
rwgk Aug 20, 2025
0b06db9
chmod 755 make_site_packages_libdirs_windows.py
rwgk Aug 20, 2025
0eaecd3
Adds paths for the CUDA static library based on CUDA_HOME (#608).
Andy-Jost Aug 14, 2025
1f2a917
Removes LIB and LIBRARY_PATH environment variables from the build-whe…
Andy-Jost Aug 19, 2025
959d34b
Updates Linux install to search both lib and lib64 directories for CU…
Andy-Jost Aug 19, 2025
6adc349
Removes LIBRARY_PATH environment variable from installation docs (no …
Andy-Jost Aug 20, 2025
a793517
Use SITE_PACKAGES_LIBDIRS_WINDOWS in _find_dll_using_nvidia_bin_dirs,…
rwgk Aug 20, 2025
11ff2d3
Merge branch 'main' into find_all_dynamic_libs_under_all_site_packages
rwgk Aug 20, 2025
c5f2d33
Factor out SITE_PACKAGES_LIBDIRS_*_CTK, add test_supported_libnames_*…
rwgk Aug 20, 2025
2a6eda3
Also exercise "other" (non-CTK) libnames in test_load_nvidia_dynamic_…
rwgk Aug 20, 2025
7957fe4
Exercise fallback code path using pygit2 wheel.
rwgk Aug 21, 2025
6a7f570
Merge branch 'main' into find_all_dynamic_libs_under_all_site_packages
rwgk Aug 21, 2025
12485f1
Add other_wheels,foreign_wheels to pip install nvidia_wheels_cu13
rwgk Aug 21, 2025
70b198c
Add toolshed/collect_site_packages_so_files.sh, with terse Usage comm…
rwgk Aug 21, 2025
6cea192
Add toolshed/collect_site_packages_dll_files.ps1 with terse Usage com…
rwgk Aug 21, 2025
f33d7c8
Add pygit2 comments.
rwgk Aug 21, 2025
1b216d7
Replace special-case workaround in tests/child_load_nvidia_dynamic_li…
rwgk Aug 21, 2025
3c900ae
Add anticipated CTK 13 paths for mathdx in SITE_PACKAGES_LIBDIRS_LINU…
rwgk Aug 21, 2025
58a2520
Rename other_wheels → nvidia_wheels_host
rwgk Aug 21, 2025
1c939a7
WIP
rwgk Aug 21, 2025
acc226b
Restore _no_such_file_in_sub_dirs error reporting
rwgk Aug 21, 2025
b5b12f0
Merge branch 'main' into find_all_dynamic_libs_under_all_site_packages
rwgk Aug 21, 2025
9678a86
Merge branch 'main' into find_all_dynamic_libs_under_all_site_packages
rwgk Aug 22, 2025
fcdd977
Use `pip install -v ".[nvidia_wheels_cu${TEST_CUDA_MAJOR},nvidia_whee…
rwgk Aug 22, 2025
87a8e43
Export TEST_CUDA_MAJOR to the GITHUB_ENV
rwgk Aug 22, 2025
784723f
Merge branch 'main' into find_all_dynamic_libs_under_all_site_packages
rwgk Aug 22, 2025
68b411e
Merge branch 'main' into find_all_dynamic_libs_under_all_site_packages
rwgk Aug 26, 2025
a8a9506
Fix existing (on main) pre-commit error
rwgk Aug 26, 2025
ad72088
Do not install nvidia-cufftmp-cu12 on Windows (it is only a placehold…
rwgk Aug 26, 2025
0c3cd20
Leo's --only-binary=:all: suggestions
rwgk Aug 26, 2025
1c0a0e5
Leo's --only-binary=:all: suggestions (toolshed scripts)
rwgk Aug 26, 2025
5711602
Remove fallback code paths in _find_so_using_nvidia_lib_dirs, _find_d…
rwgk Aug 27, 2025
02a9bea
Merge branch 'main' into find_all_dynamic_libs_under_all_site_packages
rwgk Aug 27, 2025
69d7c98
Consolidate make_site_packages_libdirs_linux.py + make_site_packages_…
rwgk Aug 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Consolidate make_site_packages_libdirs_linux.py + make_site_packages_…
…libdirs_windows.py → make_site_packages_libdirs.py
  • Loading branch information
rwgk committed Aug 27, 2025
commit 69d7c983a5efd37c28c7d3218f76d37ef135497b
4 changes: 2 additions & 2 deletions toolshed/collect_site_packages_dll_files.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

# Usage:
# cd cuda-python
# powershell -File toolshed/collect_site_packages_dll_files.ps1
# python toolshed/make_site_packages_libdirs_windows.py site_packages_dll.txt
# powershell -File toolshed\collect_site_packages_dll_files.ps1
# python .\toolshed\make_site_packages_libdirs.py windows site_packages_dll.txt

$ErrorActionPreference = 'Stop'

Expand Down
4 changes: 2 additions & 2 deletions toolshed/collect_site_packages_so_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

# Usage:
# cd cuda-python
# toolshed/collect_site_packages_so_files.sh
# toolshed/make_site_packages_libdirs_linux.py site_packages_so.txt
# ./toolshed/collect_site_packages_so_files.sh
# ./toolshed/make_site_packages_libdirs.py linux site_packages_so.txt

set -euo pipefail
fresh_venv() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,8 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# For usage see top of collect_site_packages_dll_files.ps1
# For usage see top of collect_site_packages_*_files.*

"""
Build a dict mapping Windows CUDA/NVIDIA DLL *base* names to the tuple of directories
they appear in.

Input:
- A file path argument (text file with one DLL path per line), or stdin if omitted.
- Lines may be relative or absolute paths. Blank lines and lines starting with '#'
are ignored.

Output:
- Prints a valid Python dict literal:
{ "nvrtc": ("nvidia/cu13/bin/x86_64", "nvidia/cuda_nvrtc/bin", ...), ... }

Use the resulting directories to glob like: f"{dirname}/{libname}*.dll"
"""

import sys
import os
import re
import argparse
Expand All @@ -36,6 +19,25 @@ def strip_site_packages_prefix(p: str) -> str:
return _SITE_PACKAGES_RE.sub("", p)


def parse_lines_linux(lines) -> Dict[str, Set[str]]:
d = {} # name -> set of dirs
for raw in lines:
line = raw.strip()
if not line or line.startswith("#"):
continue
line = strip_site_packages_prefix(line)
dirpath, fname = os.path.split(line)
# Require something like libNAME.so, libNAME.so.12, libNAME.so.12.1, etc.
i = fname.find(".so")
if not fname.startswith("lib") or i == -1:
# Skip lines that don't look like shared libs
continue
name = fname[:i] # e.g. "libnvrtc"
name = name[3:] # drop leading "lib" -> "nvrtc"
d.setdefault(name, set()).add(dirpath)
return d


def extract_libname_from_dll(fname: str) -> Optional[str]:
"""Return base libname per the heuristic, or None if not a .dll."""
base = os.path.basename(fname)
Expand All @@ -51,7 +53,7 @@ def extract_libname_from_dll(fname: str) -> Optional[str]:
return name or None


def parse_lines_to_map(lines) -> Dict[str, Set[str]]:
def parse_lines_windows(lines) -> Dict[str, Set[str]]:
"""Collect {libname: set(dirnames)} with deduped directories."""
m: Dict[str, Set[str]] = {}
for raw in lines:
Expand Down Expand Up @@ -83,26 +85,23 @@ def dict_literal(d: Dict[str, Set[str]]) -> str:
return "\n".join(lines)


def main():
def main() -> None:
ap = argparse.ArgumentParser(
description="Convert a list of Windows DLL paths to {libname: (dir1, dir2, ...)}, "
"stripping any prefix up to 'site-packages/'."
description="Convert a list of site-packages library paths into {name: (dirs, ...)}"
)
ap.add_argument(
"paths", nargs="*", help="Input file(s); if omitted, read from stdin"
"platform", choices=["linux", "windows"], help="Target platform to parse"
)
ap.add_argument("path", help="Text file with one library path per line")
args = ap.parse_args()

lines = []
if args.paths:
for path in args.paths:
with open(path, "r", encoding="utf-8") as f:
# Append as if files were `cat`'d together
lines.extend(f.read().splitlines())
else:
lines = sys.stdin.read().splitlines()
with open(args.path, "r", encoding="utf-8") as f:
lines = f.read().splitlines()

m = parse_lines_to_map(lines)
if args.platform == "linux":
m = parse_lines_linux(lines)
else:
m = parse_lines_windows(lines)
print(dict_literal(m))


Expand Down
76 changes: 0 additions & 76 deletions toolshed/make_site_packages_libdirs_linux.py

This file was deleted.