pyhw 0.14.2__py3-none-any.whl → 0.14.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyhw/__init__.py +1 -1
- pyhw/__main__.py +11 -1
- pyhw/backend/gpu/macos.py +34 -14
- pyhw/library/lib/iokitGPULib.dylib +0 -0
- pyhw/library/lib/iokitNICLib.dylib +0 -0
- pyhw/library/test/iokitGPULibTest.py +17 -0
- {pyhw-0.14.2.dist-info → pyhw-0.14.3.dist-info}/METADATA +1 -1
- {pyhw-0.14.2.dist-info → pyhw-0.14.3.dist-info}/RECORD +12 -11
- {pyhw-0.14.2.dist-info → pyhw-0.14.3.dist-info}/WHEEL +0 -0
- {pyhw-0.14.2.dist-info → pyhw-0.14.3.dist-info}/entry_points.txt +0 -0
- {pyhw-0.14.2.dist-info → pyhw-0.14.3.dist-info}/licenses/LICENSE +0 -0
- {pyhw-0.14.2.dist-info → pyhw-0.14.3.dist-info}/top_level.txt +0 -0
pyhw/__init__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
__version__ = '0.14.
|
1
|
+
__version__ = '0.14.3'
|
2
2
|
__author__ = 'xiaoran007'
|
pyhw/__main__.py
CHANGED
@@ -154,13 +154,21 @@ def main():
|
|
154
154
|
multiprocessing.Process(target=detect_os, args=(debug_info, current_os, result_dict)),
|
155
155
|
multiprocessing.Process(target=detect_cpu, args=(debug_info, current_os, result_dict)),
|
156
156
|
multiprocessing.Process(target=detect_memory, args=(debug_info, current_os, result_dict)),
|
157
|
-
multiprocessing.Process(target=detect_pci_related, args=(debug_info, current_os, result_dict)),
|
158
157
|
]
|
159
158
|
|
159
|
+
if current_os == "macos":
|
160
|
+
processes.append(multiprocessing.Process(target=detect_gpu, args=(debug_info, current_os, result_dict)))
|
161
|
+
processes.append(multiprocessing.Process(target=detect_nic, args=(debug_info, current_os, result_dict)))
|
162
|
+
processes.append(multiprocessing.Process(target=detect_npu, args=(debug_info, current_os, result_dict)))
|
163
|
+
else:
|
164
|
+
multiprocessing.Process(target=detect_pci_related, args=(debug_info, current_os, result_dict)),
|
165
|
+
|
160
166
|
start_time = time.time()
|
161
167
|
for process in processes:
|
162
168
|
process.start()
|
163
169
|
|
170
|
+
detection_time = time.time() - start_time
|
171
|
+
|
164
172
|
for process in processes[1:]:
|
165
173
|
process.join()
|
166
174
|
|
@@ -179,6 +187,8 @@ def main():
|
|
179
187
|
for func_name, elapsed in debug_dict.items():
|
180
188
|
detection_name = func_name.replace("detect_", "")
|
181
189
|
print(f"{detection_name:<10}: {elapsed:.4f} s")
|
190
|
+
print("-" * 50)
|
191
|
+
print(f"Total create time: {detection_time:.4f} s")
|
182
192
|
print("-"*50)
|
183
193
|
print(f"Total execution time: {total_time:.4f} s")
|
184
194
|
print("="*50)
|
pyhw/backend/gpu/macos.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
from .gpuInfo import GPUInfo
|
2
2
|
from ...pyhwUtil import getArch
|
3
|
+
from ..cpu import CPUDetect
|
3
4
|
import json
|
4
5
|
import subprocess
|
5
6
|
import ctypes
|
@@ -19,22 +20,25 @@ class GPUDetectMacOS:
|
|
19
20
|
return self.__gpuInfo
|
20
21
|
|
21
22
|
def __getGPUAppleSilicon(self):
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
23
|
+
if self.__getGPUIOKitAppleSilicon():
|
24
|
+
pass
|
25
|
+
else:
|
26
|
+
gpus = list()
|
27
|
+
try:
|
28
|
+
gpu_info_dict = json.loads(subprocess.check_output(["system_profiler", "SPDisplaysDataType", "-json"]))
|
29
|
+
if 'SPDisplaysDataType' in gpu_info_dict:
|
30
|
+
gpus = gpu_info_dict['SPDisplaysDataType']
|
31
|
+
self.__gpuInfo.number = len(gpus)
|
32
|
+
else:
|
33
|
+
pass
|
34
|
+
except Exception:
|
35
|
+
return
|
32
36
|
|
33
|
-
|
34
|
-
|
37
|
+
for gpu in gpus:
|
38
|
+
self.__gpuInfo.gpus.append(f'{gpu.get("sppci_model")} ({gpu.get("sppci_cores")} Cores) [SOC Integrated]')
|
35
39
|
|
36
40
|
def __getGPUIntel(self):
|
37
|
-
if self.
|
41
|
+
if self.__getGPUIOKitIntel():
|
38
42
|
pass
|
39
43
|
else: # fallback to the default implementation
|
40
44
|
gpus = list()
|
@@ -56,7 +60,7 @@ class GPUDetectMacOS:
|
|
56
60
|
elif self.__handleVendor(gpu.get("spdisplays_vendor")) == "Nvidia": # Since current macOS does not support NVIDIA GPUs, this condition is not applicable
|
57
61
|
pass
|
58
62
|
|
59
|
-
def
|
63
|
+
def __getGPUIOKitIntel(self):
|
60
64
|
try:
|
61
65
|
package_root = Path(__file__).resolve().parent.parent.parent
|
62
66
|
lib = ctypes.CDLL(f"{package_root}/library/lib/iokitGPULib.dylib")
|
@@ -82,6 +86,22 @@ class GPUDetectMacOS:
|
|
82
86
|
# print(f"An error occurred while getting GPU info using IOKit: {e}")
|
83
87
|
return False
|
84
88
|
|
89
|
+
def __getGPUIOKitAppleSilicon(self):
|
90
|
+
try:
|
91
|
+
package_root = Path(__file__).resolve().parent.parent.parent
|
92
|
+
lib = ctypes.CDLL(f"{package_root}/library/lib/iokitGPULib.dylib")
|
93
|
+
lib.getAppleSiliconGPUInfo.restype = ctypes.c_char_p
|
94
|
+
gpu_cores = lib.getAppleSiliconGPUInfo().decode('utf-8')
|
95
|
+
|
96
|
+
if gpu_cores == "0":
|
97
|
+
return False
|
98
|
+
self.__gpuInfo.number = 1
|
99
|
+
self.__gpuInfo.gpus.append(f'{CPUDetect(os="macos").getCPUInfo().model} ({gpu_cores} Cores) [SOC Integrated]')
|
100
|
+
return True
|
101
|
+
except Exception as e:
|
102
|
+
# print(f"An error occurred while getting GPU info using IOKit: {e}")
|
103
|
+
return False
|
104
|
+
|
85
105
|
@staticmethod
|
86
106
|
def __handleVendor(vendor):
|
87
107
|
if vendor == "sppci_vendor_Apple":
|
Binary file
|
Binary file
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import ctypes
|
2
|
+
|
3
|
+
|
4
|
+
def main():
|
5
|
+
lib = ctypes.CDLL(f"../lib/iokitGPULib.dylib")
|
6
|
+
lib.getGPUInfo.restype = ctypes.c_char_p
|
7
|
+
lib.getAppleSiliconGPUInfo.restype = ctypes.c_char_p
|
8
|
+
gpu_info = lib.getAppleSiliconGPUInfo()
|
9
|
+
print(gpu_info.decode('utf-8'))
|
10
|
+
|
11
|
+
|
12
|
+
if __name__ == "__main__":
|
13
|
+
main()
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
@@ -1,5 +1,5 @@
|
|
1
|
-
pyhw/__init__.py,sha256=
|
2
|
-
pyhw/__main__.py,sha256=
|
1
|
+
pyhw/__init__.py,sha256=uDGqf08M75C64PfWAahj4FwtgOBKhB-Je3iMKkV_bP0,49
|
2
|
+
pyhw/__main__.py,sha256=M2WZgtqir5JBcpMbIqay4Hb08-Ncl1EPobzNkpgoL34,7679
|
3
3
|
pyhw/backend/__init__.py,sha256=X1D1D28lSojDrUzUolgJvmbuctwBh_UxG3FwUeL8adA,51
|
4
4
|
pyhw/backend/backendBase.py,sha256=mloo8mPEbgbIdmyQ3I4vdEXMSSjxWi_wnwACmzvHbEo,506
|
5
5
|
pyhw/backend/cpu/__init__.py,sha256=5YfANJVRwNwTRodG0ENOgusrdN592aaSnfq5ok4dKTo,56
|
@@ -14,7 +14,7 @@ pyhw/backend/gpu/bsd.py,sha256=ladMMIlTwb6Z1ETCLFII--lkeLCp50Wb7WFrlOXa5DQ,123
|
|
14
14
|
pyhw/backend/gpu/gpuBase.py,sha256=ZPT9o7PhYpzlwign0GsCT519F9DGx-1UEMVVOM8MV_k,748
|
15
15
|
pyhw/backend/gpu/gpuInfo.py,sha256=d_z_z5DiZAg85wP0VOBQEU0QHdaK3qFqA2Tp9Eq8-Zs,133
|
16
16
|
pyhw/backend/gpu/linux.py,sha256=myapmOCsfjBxSmXxGt33bCIN18ko5lNDKcNWQ1Vlhcg,3149
|
17
|
-
pyhw/backend/gpu/macos.py,sha256=
|
17
|
+
pyhw/backend/gpu/macos.py,sha256=4OA4rhelS8v4Quy4S-NLpkZfYEk7XFr2ZRf_Sz7pPpY,4957
|
18
18
|
pyhw/backend/gpu/windows.py,sha256=kMCQmk_NLXus45iHM9eKYOno_LPBW1GsrwUy1v5ar3Q,1206
|
19
19
|
pyhw/backend/host/__init__.py,sha256=OmlSGjg3crlFcGz2FhBDyd35R7H0rriy3eq57y8h0_s,59
|
20
20
|
pyhw/backend/host/bsd.py,sha256=xePlHfVYv7PSWMU1a7mTbMK3mzl2ssttkI13Xi5s00w,381
|
@@ -104,12 +104,13 @@ pyhw/frontend/logo/ascii/windows_11.pyhw,sha256=VuQTzbBabaEQhm2JBVhy6Ja6lClUGacQ
|
|
104
104
|
pyhw/frontend/logo/ascii/windows_2025.pyhw,sha256=o8eWsiyhNpDoEjiWFiBMfkd-8MdIslGc1Jpm85LU4P8,643
|
105
105
|
pyhw/frontend/logo/ascii/windows_old.pyhw,sha256=AMsvWAZ50HM8lweWEmzDWbRNDGkKFJo9qLY_VRKrciY,580
|
106
106
|
pyhw/library/lib/iokitCPULib.dylib,sha256=uMDDaijZGvTNkdT0ccQ55SDO4rRrzj8GSbrDMKeLAZ0,34280
|
107
|
-
pyhw/library/lib/iokitGPULib.dylib,sha256=
|
107
|
+
pyhw/library/lib/iokitGPULib.dylib,sha256=uiULOcAPpwOG7LZGR8Sdmjh_p5QjKN1OBBCfDMnUohk,155640
|
108
108
|
pyhw/library/lib/iokitHostLib.dylib,sha256=MKxyKUkD4IZomP4exATikWx2SxqSDqQx4FEuIkFAEnc,149912
|
109
|
-
pyhw/library/lib/iokitNICLib.dylib,sha256=
|
109
|
+
pyhw/library/lib/iokitNICLib.dylib,sha256=gOtCQFxtHnsmU9XuWUp67eOPXJw2gIBxeVLesaIb6rY,212360
|
110
110
|
pyhw/library/lib/nvmlGPULib_amd64.so,sha256=lrkxeJjChUs8oVhaw_uMeXKbUJp24KroQ_hhcLtHfTg,12784
|
111
111
|
pyhw/library/lib/nvmlGPULib_arm64.so,sha256=DFIYqNcuRxiZ8_jrYoaRB3Dx9GrY7UBXscwXQvV4k3I,13528
|
112
112
|
pyhw/library/test/iokitCPULibTest.py,sha256=BrhMypgfJTeMectpDc9Tmwzp8gYwYAcowaTFf72LlLE,311
|
113
|
+
pyhw/library/test/iokitGPULibTest.py,sha256=9Kzu6ZSnxJ5cv1JHA5N9ZUBdhjcHvC9Aes5Rf0AP7OE,305
|
113
114
|
pyhw/library/test/iokitHostLibTest.py,sha256=oz5x1g4WMdoikU3Eo6zoxcHZ4e-UMRhXg0C0Lflo-ac,272
|
114
115
|
pyhw/library/test/iokitNICLibTest.py,sha256=ROjfJf0ocWvRFueIyRBQ4Y0V7stlMNiAADIM3fMy7YY,2947
|
115
116
|
pyhw/library/test/nvmlGPULibTest.py,sha256=F4AjQGZDNj29fRtxvy41zCSFi2Eirp0CQSYuxuw0n60,785
|
@@ -120,9 +121,9 @@ pyhw/pyhwUtil/cliUtil.py,sha256=IUcWun5nDwQb20Qe8YefS5j3Jji8a-F41Qd9QwCf0h0,2454
|
|
120
121
|
pyhw/pyhwUtil/pciUtil.py,sha256=WAluDRDb-gUbqhvSIusFzPrf6r98EkrNEAwbPyMwrTc,202
|
121
122
|
pyhw/pyhwUtil/pyhwUtil.py,sha256=V3M6X9eTirwnwwRiSJaLUWrZKZYMbRihARJVQc879P8,8364
|
122
123
|
pyhw/pyhwUtil/sysctlUtil.py,sha256=S-rUvqi7ZrMyMouIhxlyHEQ4agM7sCT1Y7uzs3Hu5-o,841
|
123
|
-
pyhw-0.14.
|
124
|
-
pyhw-0.14.
|
125
|
-
pyhw-0.14.
|
126
|
-
pyhw-0.14.
|
127
|
-
pyhw-0.14.
|
128
|
-
pyhw-0.14.
|
124
|
+
pyhw-0.14.3.dist-info/licenses/LICENSE,sha256=hJs6RBqSVCexbTsalkMLNFI5t06kekQEsSVaOt_-yLs,1497
|
125
|
+
pyhw-0.14.3.dist-info/METADATA,sha256=0UpA2mqZLUjRxELU5nfjZZwn_rb2PCCzodnvvuKyRdI,7715
|
126
|
+
pyhw-0.14.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
127
|
+
pyhw-0.14.3.dist-info/entry_points.txt,sha256=q-AB8im_QahpmNrmy4aPTJRGi0LlbNlnI3kF7s6pKss,44
|
128
|
+
pyhw-0.14.3.dist-info/top_level.txt,sha256=7Inxvxt1TngEricKZEex9_WJZS3DbKYFUXDz4v5WHYU,5
|
129
|
+
pyhw-0.14.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|