forked from NVIDIA/cuda-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_pathfinder_sonames.py
More file actions
executable file
·78 lines (66 loc) · 1.74 KB
/
build_pathfinder_sonames.py
File metadata and controls
executable file
·78 lines (66 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python3
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
# Input for this script:
# output of toolshed/find_sonames.sh
# The output of this script is expected to be usable as-is.
import sys
from pathlib import Path
LIBNAMES_IN_SCOPE_OF_CUDA_PATHFINDER = (
"nvJitLink",
"nvrtc",
"nvvm",
"cudart",
"nvfatbin",
"cublas",
"cublasLt",
"cufft",
"cufftw",
"curand",
"cusolver",
"cusolverMg",
"cusparse",
"nppc",
"nppial",
"nppicc",
"nppidei",
"nppif",
"nppig",
"nppim",
"nppist",
"nppisu",
"nppitc",
"npps",
"nvblas",
"cufile",
"cufile_rdma",
"nvjpeg",
)
def run(args):
assert len(args) == 1, "output-of-find_sonames.sh"
sonames_from_file = set()
for line in Path(args[0]).read_text().splitlines():
flds = line.split()
assert len(flds) == 3, flds
if flds[-1] != "SONAME_NOT_SET":
sonames_from_file.add(flds[-1])
print("SONAMEs in scope of cuda.pathfinder")
print("===================================")
sonames_in_scope = set()
for libname in sorted(LIBNAMES_IN_SCOPE_OF_CUDA_PATHFINDER):
print(f'"{libname}": (')
lib_so = "lib" + libname + ".so"
for soname in sorted(sonames_from_file):
if soname.startswith(lib_so):
sonames_in_scope.add(soname)
print(f' "{soname}",')
print("),")
print()
print("SONAMEs out of scope")
print("====================")
for soname in sorted(sonames_from_file - sonames_in_scope):
print(soname)
print()
if __name__ == "__main__":
run(args=sys.argv[1:])