gpustack-runtime 0.2.0.post3__tar.gz → 0.2.0.post4__tar.gz

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.
Files changed (133) hide show
  1. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/PKG-INFO +1 -1
  2. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/_version.py +2 -2
  3. gpustack_runtime-0.2.0.post4/gpustack_runtime/_version_appendix.py +1 -0
  4. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/__utils__.py +6 -1
  5. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/amd.py +13 -7
  6. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/ascend.py +76 -7
  7. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/hygon.py +23 -11
  8. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/nvidia.py +3 -13
  9. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/pyamdsmi/__init__.py +35 -0
  10. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/pyhsa/__init__.py +18 -0
  11. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/pyrocmsmi/__init__.py +31 -0
  12. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/envs.py +11 -11
  13. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/ruff.toml +0 -3
  14. gpustack_runtime-0.2.0.post3/gpustack_runtime/_version_appendix.py +0 -1
  15. gpustack_runtime-0.2.0.post3/gpustack_runtime/detector/pyacl/__init__.py +0 -478
  16. gpustack_runtime-0.2.0.post3/gpustack_runtime/detector/pycuda/__init__.py +0 -485
  17. gpustack_runtime-0.2.0.post3/gpustack_runtime/detector/pyrocmcore/__init__.py +0 -97
  18. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/.codespelldict +0 -0
  19. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/.codespellrc +0 -0
  20. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/.dockerignore +0 -0
  21. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/.gitattributes +0 -0
  22. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/.gitignore +0 -0
  23. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/.pre-commit-config.yaml +0 -0
  24. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/.python-version +0 -0
  25. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/LICENSE +0 -0
  26. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/Makefile +0 -0
  27. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/README.md +0 -0
  28. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/deploy/manifests/docker-compose.yaml +0 -0
  29. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/deploy/manifests/kubernetes.yaml +0 -0
  30. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/docs/index.md +0 -0
  31. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/docs/modules/gpustack_runtime.deployer.md +0 -0
  32. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/docs/modules/gpustack_runtime.detector.md +0 -0
  33. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/docs/modules/gpustack_runtime.md +0 -0
  34. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/__init__.py +0 -0
  35. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/__main__.py +0 -0
  36. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/_version.pyi +0 -0
  37. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/cmds/__init__.py +0 -0
  38. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/cmds/__types__.py +0 -0
  39. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/cmds/deployer.py +0 -0
  40. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/cmds/detector.py +0 -0
  41. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/cmds/images.py +0 -0
  42. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/deployer/__init__.py +0 -0
  43. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/deployer/__patches__.py +0 -0
  44. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/deployer/__types__.py +0 -0
  45. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/deployer/__utils__.py +0 -0
  46. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/deployer/cdi/__init__.py +0 -0
  47. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/deployer/cdi/__types__.py +0 -0
  48. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/deployer/cdi/__utils__.py +0 -0
  49. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/deployer/cdi/amd.py +0 -0
  50. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/deployer/cdi/ascend.py +0 -0
  51. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/deployer/cdi/hygon.py +0 -0
  52. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/deployer/cdi/iluvatar.py +0 -0
  53. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/deployer/cdi/metax.py +0 -0
  54. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/deployer/cdi/thead.py +0 -0
  55. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/deployer/docker.py +0 -0
  56. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/deployer/k8s/devicemanager/__init__.py +0 -0
  57. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/deployer/kuberentes.py +0 -0
  58. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/deployer/podman.py +0 -0
  59. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/__init__.py +0 -0
  60. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/__types__.py +0 -0
  61. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/cambricon.py +0 -0
  62. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/iluvatar.py +0 -0
  63. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/metax.py +0 -0
  64. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/mthreads.py +0 -0
  65. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/pyamdgpu/__init__.py +0 -0
  66. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/pydcmi/__init__.py +0 -0
  67. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/pyhgml/__init__.py +0 -0
  68. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/pyhgml/libhgml.so +0 -0
  69. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/pyhgml/libuki.so +0 -0
  70. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/pyixml/__init__.py +0 -0
  71. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/pymtml/__init__.py +0 -0
  72. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/pymxsml/__init__.py +0 -0
  73. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/pynvml/__init__.py +0 -0
  74. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/detector/thead.py +0 -0
  75. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/gpustack_runtime/logging.py +0 -0
  76. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/hatch.toml +0 -0
  77. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/mkdocs.yml +0 -0
  78. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/pack/Dockerfile +0 -0
  79. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/pack/Dockerfile.dummy +0 -0
  80. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/pyproject.toml +0 -0
  81. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/pytest.ini +0 -0
  82. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/deployer/fixtures/__init__.py +0 -0
  83. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/deployer/fixtures/test_compare_versions.json +0 -0
  84. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/deployer/fixtures/test_correct_runner_image.json +0 -0
  85. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/deployer/fixtures/test_load_yaml_or_json.json +0 -0
  86. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/deployer/fixtures/test_load_yaml_or_json_multiple_jsons.json +0 -0
  87. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/deployer/fixtures/test_load_yaml_or_json_multiple_yamls.yaml +0 -0
  88. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/deployer/fixtures/test_load_yaml_or_json_single_json.json +0 -0
  89. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/deployer/fixtures/test_load_yaml_or_json_single_yaml.yaml +0 -0
  90. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/deployer/fixtures/test_nginx_entrypoint.sh +0 -0
  91. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/deployer/test_utils.py +0 -0
  92. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/fixtures/__init__.py +0 -0
  93. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/README.md +0 -0
  94. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/detect_output_amd_mi300x.json +0 -0
  95. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/detect_output_amd_mi308x.json +0 -0
  96. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/detect_output_amd_rx7800xt.json +0 -0
  97. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/detect_output_ascend_310p3.json +0 -0
  98. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/detect_output_ascend_910b2.json +0 -0
  99. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/detect_output_hygon_k100ai.json +0 -0
  100. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/detect_output_metax_c500.json +0 -0
  101. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_gb10.json +0 -0
  102. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_h100.json +0 -0
  103. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_h100_mig.json +0 -0
  104. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_h200.json +0 -0
  105. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_rtx4080super.json +0 -0
  106. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_rtx4090d.json +0 -0
  107. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_rtx5090d.json +0 -0
  108. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/detect_output_thead_ppu.json +0 -0
  109. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/topology_output_amd_mi300x.json +0 -0
  110. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/topology_output_amd_mi308x.json +0 -0
  111. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/topology_output_amd_rx7800xt.json +0 -0
  112. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/topology_output_ascend_310p3.json +0 -0
  113. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/topology_output_ascend_910b2.json +0 -0
  114. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/topology_output_hygon_k100ai.json +0 -0
  115. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/topology_output_metax_c500.json +0 -0
  116. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/topology_output_mthreads_s5000.json +0 -0
  117. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/topology_output_nvidia_h100.json +0 -0
  118. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/topology_output_nvidia_h100_mig.json +0 -0
  119. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/topology_output_nvidia_h200.json +0 -0
  120. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/topology_output_nvidia_rtx4080super.json +0 -0
  121. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/topology_output_nvidia_rtx4090d.json +0 -0
  122. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/topology_output_nvidia_rtx5090d.json +0 -0
  123. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/samples/topology_output_thead_ppu.json +0 -0
  124. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/test_amd.py +0 -0
  125. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/test_ascend.py +0 -0
  126. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/test_cambricon.py +0 -0
  127. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/test_hygon.py +0 -0
  128. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/test_iluvatar.py +0 -0
  129. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/test_metax.py +0 -0
  130. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/test_mthreads.py +0 -0
  131. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/tests/gpustack_runtime/detector/test_nvidia.py +0 -0
  132. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/uv.lock +0 -0
  133. {gpustack_runtime-0.2.0.post3 → gpustack_runtime-0.2.0.post4}/uv.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gpustack-runtime
3
- Version: 0.2.0.post3
3
+ Version: 0.2.0.post4
4
4
  Summary: GPUStack Runtime is library for detecting GPU resources and launching GPU workloads.
5
5
  Project-URL: Homepage, https://github.com/gpustack/runtime
6
6
  Project-URL: Bug Tracker, https://github.com/gpustack/gpustack/issues
@@ -27,8 +27,8 @@ version_tuple: VERSION_TUPLE
27
27
  __commit_id__: COMMIT_ID
28
28
  commit_id: COMMIT_ID
29
29
 
30
- __version__ = version = '0.2.0.post3'
31
- __version_tuple__ = version_tuple = (0, 2, 0, 'post3')
30
+ __version__ = version = '0.2.0.post4'
31
+ __version_tuple__ = version_tuple = (0, 2, 0, 'post4')
32
32
  try:
33
33
  from ._version_appendix import git_commit
34
34
  __commit_id__ = commit_id = git_commit
@@ -0,0 +1 @@
1
+ git_commit = "992585c"
@@ -13,6 +13,8 @@ from functools import lru_cache
13
13
  from pathlib import Path
14
14
  from typing import Any
15
15
 
16
+ from gpustack_runtime import envs
17
+
16
18
 
17
19
  @dataclass
18
20
  class PCIDevice:
@@ -69,7 +71,10 @@ def get_pci_devices(
69
71
  return pci_devices
70
72
 
71
73
  if not class_prefix:
72
- class_prefix = ["0x02", "0x03", "0x12", "0x0b"]
74
+ class_prefix = []
75
+ for prefix in envs.GPUSTACK_RUNTIME_DETECT_PCI_CLASS_PREFIXES:
76
+ if prefix:
77
+ class_prefix.append(f"0x{prefix.lower()}")
73
78
 
74
79
  if address and isinstance(address, str):
75
80
  address = [address]
@@ -7,7 +7,7 @@ from pathlib import Path
7
7
 
8
8
  from .. import envs
9
9
  from ..logging import debug_log_exception, debug_log_warning
10
- from . import Topology, pyamdgpu, pyamdsmi, pyhsa, pyrocmcore, pyrocmsmi
10
+ from . import Topology, pyamdgpu, pyamdsmi, pyhsa, pyrocmsmi
11
11
  from .__types__ import (
12
12
  Detector,
13
13
  Device,
@@ -94,7 +94,10 @@ class AMDDetector(Detector):
94
94
  ret: Devices = []
95
95
 
96
96
  try:
97
- hsa_agents = {hsa_agent.uuid: hsa_agent for hsa_agent in pyhsa.get_agents()}
97
+ hsa_agents = {
98
+ hsa_agent.bdf or hsa_agent.uuid: hsa_agent
99
+ for hsa_agent in pyhsa.get_agents()
100
+ }
98
101
 
99
102
  pyamdsmi.amdsmi_init()
100
103
  try:
@@ -102,7 +105,7 @@ class AMDDetector(Detector):
102
105
  except Exception:
103
106
  debug_log_exception(logger, "Failed to initialize ROCm SMI")
104
107
 
105
- sys_runtime_ver_original = pyrocmcore.getROCmVersion()
108
+ sys_runtime_ver_original = pyamdsmi.amdsmi_get_rocm_version()
106
109
  sys_runtime_ver = get_brief_version(sys_runtime_ver_original)
107
110
 
108
111
  devs = pyamdsmi.amdsmi_get_processor_handles()
@@ -115,7 +118,13 @@ class AMDDetector(Detector):
115
118
  dev_uuid = f"GPU-{(asic_serial[2:]).lower()}"
116
119
  else:
117
120
  dev_uuid = f"GPU-{pyrocmsmi.rsmi_dev_unique_id_get(dev_idx)[2:]}"
118
- dev_hsa_agent = hsa_agents.get(dev_uuid, pyhsa.Agent())
121
+
122
+ dev_bdf = pyamdsmi.amdsmi_get_gpu_device_bdf(dev)
123
+ dev_card_id, dev_renderd_id = _get_card_and_renderd_id(dev_bdf)
124
+
125
+ dev_hsa_agent = (
126
+ hsa_agents.get(dev_bdf) or hsa_agents.get(dev_uuid) or pyhsa.Agent()
127
+ )
119
128
 
120
129
  dev_gpu_driver_info = pyamdsmi.amdsmi_get_gpu_driver_info(dev)
121
130
  dev_driver_ver = dev_gpu_driver_info.get("driver_version")
@@ -134,9 +143,6 @@ class AMDDetector(Detector):
134
143
  dev_idx,
135
144
  )
136
145
 
137
- dev_bdf = pyamdsmi.amdsmi_get_gpu_device_bdf(dev)
138
- dev_card_id, dev_renderd_id = _get_card_and_renderd_id(dev_bdf)
139
-
140
146
  dev_cores = dev_hsa_agent.compute_units
141
147
  dev_asic_family_id = dev_hsa_agent.asic_family_id
142
148
  if (
@@ -2,11 +2,14 @@ from __future__ import annotations as __future_annotations__
2
2
 
3
3
  import contextlib
4
4
  import logging
5
+ import os
6
+ import re
5
7
  from functools import lru_cache
8
+ from pathlib import Path
6
9
 
7
10
  from .. import envs
8
11
  from ..logging import debug_log_exception, debug_log_warning
9
- from . import pyacl, pydcmi
12
+ from . import pydcmi
10
13
  from .__types__ import (
11
14
  Detector,
12
15
  Device,
@@ -111,7 +114,7 @@ class AscendDetector(Detector):
111
114
 
112
115
  sys_driver_ver = pydcmi.dcmi_get_driver_version()
113
116
 
114
- sys_runtime_ver_original = pyacl.aclsysGetVersion()
117
+ sys_runtime_ver_original = _get_toolkit_version()
115
118
  sys_runtime_ver = get_brief_version(sys_runtime_ver_original)
116
119
 
117
120
  _, card_list = pydcmi.dcmi_get_card_list()
@@ -210,10 +213,7 @@ class AscendDetector(Detector):
210
213
  dev_numa = map_cpu_affinity_to_numa_node(dev_cpu_affinity)
211
214
 
212
215
  dev_appendix = {
213
- "arch_family": (
214
- pyacl.aclrtGetSocName()
215
- or _guess_soc_name_from_dev_name(dev_name)
216
- ),
216
+ "arch_family": _guess_soc_name_from_dev_name(dev_name),
217
217
  "vgpu": dev_is_vgpu,
218
218
  "bdf": dev_bdf,
219
219
  "card_id": dev_card_id,
@@ -478,6 +478,58 @@ def _get_device_virtual_info(
478
478
  return None
479
479
 
480
480
 
481
+ def _get_toolkit_home() -> Path:
482
+ """
483
+ Resolve the Ascend toolkit home directory.
484
+
485
+ Returns:
486
+ The path to the Ascend toolkit home.
487
+
488
+ """
489
+ # Example ASCEND_TOOLKIT_HOME
490
+ # - /usr/local/Ascend/cann
491
+ # - /usr/local/Ascend/ascend-toolkit/latest/runtime
492
+ toolkit_home = os.getenv("ASCEND_TOOLKIT_HOME")
493
+ if toolkit_home:
494
+ return Path(toolkit_home)
495
+
496
+ default_home = Path("/usr/local/Ascend/cann")
497
+ if default_home.is_dir():
498
+ return default_home
499
+
500
+ return Path("/usr/local/Ascend/ascend-toolkit/latest/runtime")
501
+
502
+
503
+ def _get_toolkit_version() -> str | None:
504
+ """
505
+ Read the Ascend toolkit (CANN) version from known version.info files.
506
+
507
+ Returns:
508
+ The toolkit version string, or None if not found.
509
+
510
+ """
511
+ prefix = "Version="
512
+ toolkit_home = _get_toolkit_home()
513
+
514
+ for vf in (
515
+ toolkit_home / "version.info",
516
+ toolkit_home / "share" / "info" / "runtime" / "version.info",
517
+ ):
518
+ if not vf.is_file():
519
+ continue
520
+
521
+ try:
522
+ content = vf.read_text()
523
+ except OSError:
524
+ continue
525
+
526
+ for line in content.splitlines():
527
+ if line.startswith(prefix):
528
+ return line[len(prefix) :].strip()
529
+
530
+ return None
531
+
532
+
481
533
  # Borrowed from https://gitcode.com/Ascend/pytorch/blob/master/torch_npu/csrc/core/npu/NpuVariables.cpp#L13-L40 and
482
534
  # https://gitcode.com/Ascend/pytorch/blob/master/torch_npu/csrc/core/npu/NpuVariables.h#L5-L34.
483
535
  # Ascend product category, please refer to:
@@ -518,6 +570,11 @@ _soc_name_version_mapping: dict[str, int] = {
518
570
  }
519
571
 
520
572
 
573
+ _910A_REGEX = re.compile(r"^910")
574
+ _910B_REGEX = re.compile(r"^(910B\d|A2G\d)")
575
+ _310P_REGEX = re.compile(r"^(310P\d?|I2\d?)")
576
+
577
+
521
578
  def _guess_soc_name_from_dev_name(dev_name: str) -> str | None:
522
579
  """
523
580
  Guess the SoC name from the device name.
@@ -530,11 +587,23 @@ def _guess_soc_name_from_dev_name(dev_name: str) -> str | None:
530
587
  The guessed SoC name, or None if not found.
531
588
 
532
589
  """
590
+ dev_name = dev_name.strip()
533
591
  if dev_name.startswith("Ascend"):
534
- dev_name = dev_name[6:].strip()
592
+ dev_name = dev_name[len("Ascend") :].strip()
535
593
  soc_name = f"Ascend{dev_name}"
536
594
  if soc_name in _soc_name_version_mapping:
537
595
  return soc_name
596
+
597
+ # https://gitcode.com/Ascend/mind-cluster/blob/master/component/ascend-common/devmanager/common/utils.go#L159-L176
598
+ if _310P_REGEX.match(dev_name):
599
+ return "Ascend310P1"
600
+ if "310B" in dev_name:
601
+ return "Ascend310B1"
602
+ if _910B_REGEX.match(dev_name):
603
+ return "Ascend910B1"
604
+ if _910A_REGEX.match(dev_name):
605
+ return "Ascend910A"
606
+
538
607
  return None
539
608
 
540
609
 
@@ -7,7 +7,7 @@ from pathlib import Path
7
7
 
8
8
  from .. import envs
9
9
  from ..logging import debug_log_exception, debug_log_warning
10
- from . import Topology, pyamdgpu, pyhsa, pyrocmcore, pyrocmsmi
10
+ from . import Topology, pyamdgpu, pyhsa, pyrocmsmi
11
11
  from .__types__ import (
12
12
  Detector,
13
13
  Device,
@@ -27,6 +27,7 @@ from .__utils__ import (
27
27
  get_utilization,
28
28
  map_numa_node_to_cpu_affinity,
29
29
  )
30
+ from .amd import _get_arch_family
30
31
 
31
32
  logger = logging.getLogger(__name__)
32
33
 
@@ -94,7 +95,10 @@ class HygonDetector(Detector):
94
95
  ret: Devices = []
95
96
 
96
97
  try:
97
- hsa_agents = {hsa_agent.uuid: hsa_agent for hsa_agent in pyhsa.get_agents()}
98
+ hsa_agents = {
99
+ hsa_agent.bdf or hsa_agent.uuid: hsa_agent
100
+ for hsa_agent in pyhsa.get_agents()
101
+ }
98
102
 
99
103
  pyrocmsmi.rsmi_init()
100
104
 
@@ -108,7 +112,7 @@ class HygonDetector(Detector):
108
112
  sys_driver_ver = path.read_text().strip()
109
113
  break
110
114
 
111
- sys_runtime_ver_original = pyrocmcore.getROCmVersion()
115
+ sys_runtime_ver_original = pyrocmsmi.rsmi_get_rocm_version()
112
116
  sys_runtime_ver = get_brief_version(sys_runtime_ver_original)
113
117
 
114
118
  devs_count = pyrocmsmi.rsmi_num_monitor_devices()
@@ -116,7 +120,13 @@ class HygonDetector(Detector):
116
120
  dev_index = dev_idx
117
121
 
118
122
  dev_uuid = f"GPU-{pyrocmsmi.rsmi_dev_unique_id_get(dev_idx)[2:]}"
119
- dev_hsa_agent = hsa_agents.get(dev_uuid, pyhsa.Agent())
123
+
124
+ dev_bdf = pyrocmsmi.rsmi_dev_pci_id_get(dev_idx)
125
+ dev_card_id, dev_renderd_id = _get_card_and_renderd_id(dev_bdf)
126
+
127
+ dev_hsa_agent = (
128
+ hsa_agents.get(dev_bdf) or hsa_agents.get(dev_uuid) or pyhsa.Agent()
129
+ )
120
130
 
121
131
  dev_name = dev_hsa_agent.name
122
132
  if not dev_name:
@@ -127,17 +137,20 @@ class HygonDetector(Detector):
127
137
  with contextlib.suppress(pyrocmsmi.ROCMSMIError):
128
138
  dev_cc = pyrocmsmi.rsmi_dev_target_graphics_version_get(dev_idx)
129
139
 
130
- dev_bdf = pyrocmsmi.rsmi_dev_pci_id_get(dev_idx)
131
- dev_card_id, dev_renderd_id = _get_card_and_renderd_id(dev_bdf)
132
-
133
140
  dev_cores = dev_hsa_agent.compute_units
134
- if not dev_cores and dev_card_id is not None:
141
+ dev_asic_family_id = dev_hsa_agent.asic_family_id
142
+ if (
143
+ not dev_cores or not dev_asic_family_id
144
+ ) and dev_card_id is not None:
135
145
  with (
136
146
  contextlib.suppress(pyamdgpu.AMDGPUError),
137
147
  pyamdgpu.amdgpu_device(dev_card_id) as dev_gpudev,
138
148
  ):
139
149
  dev_gpudev_info = pyamdgpu.amdgpu_query_gpu_info(dev_gpudev)
140
- dev_cores = dev_gpudev_info.cu_active_number
150
+ if not dev_cores:
151
+ dev_cores = dev_gpudev_info.cu_active_number
152
+ if not dev_asic_family_id:
153
+ dev_asic_family_id = dev_gpudev_info.family_id
141
154
 
142
155
  dev_cores_util = pyrocmsmi.rsmi_dev_busy_percent_get(dev_idx)
143
156
  dev_temp = pyrocmsmi.rsmi_dev_temp_metric_get(dev_idx)
@@ -177,6 +190,7 @@ class HygonDetector(Detector):
177
190
  )
178
191
 
179
192
  dev_appendix = {
193
+ "arch_family": _get_arch_family(dev_asic_family_id),
180
194
  "vgpu": dev_is_vgpu,
181
195
  "bdf": dev_bdf,
182
196
  }
@@ -305,8 +319,6 @@ class HygonDetector(Detector):
305
319
  )
306
320
  else:
307
321
  distance = TopologyDistanceEnum.SYS
308
- case pyrocmsmi.ROCMSMI_IOLINK_TYPE_XGMI:
309
- distance = TopologyDistanceEnum.LINK
310
322
  case _:
311
323
  if link_hops == 0:
312
324
  distance = TopologyDistanceEnum.SELF
@@ -12,7 +12,7 @@ from pathlib import Path
12
12
 
13
13
  from .. import envs
14
14
  from ..logging import debug_log_exception, debug_log_warning
15
- from . import DeviceMemoryStatusEnum, Topology, pycuda, pynvml
15
+ from . import DeviceMemoryStatusEnum, Topology, pynvml
16
16
  from .__types__ import Detector, Device, Devices, ManufacturerEnum, TopologyDistanceEnum
17
17
  from .__utils__ import (
18
18
  PCIDevice,
@@ -97,11 +97,6 @@ class NVIDIADetector(Detector):
97
97
  pci_devs = NVIDIADetector.detect_pci_devices()
98
98
 
99
99
  pynvml.nvmlInit()
100
- if not envs.GPUSTACK_RUNTIME_DETECT_NO_TOOLKIT_CALL:
101
- try:
102
- pycuda.cuInit()
103
- except pycuda.CUDAError:
104
- debug_log_exception(logger, "Failed to initialize CUDA")
105
100
 
106
101
  sys_driver_ver = pynvml.nvmlSystemGetDriverVersion()
107
102
 
@@ -173,13 +168,8 @@ class NVIDIADetector(Detector):
173
168
  dev_uuid = pynvml.nvmlDeviceGetUUID(dev)
174
169
 
175
170
  dev_cores = None
176
- if not envs.GPUSTACK_RUNTIME_DETECT_NO_TOOLKIT_CALL:
177
- with contextlib.suppress(pycuda.CUDAError):
178
- dev_gpudev = pycuda.cuDeviceGet(dev_idx)
179
- dev_cores = pycuda.cuDeviceGetAttribute(
180
- dev_gpudev,
181
- pycuda.CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT,
182
- )
171
+ with contextlib.suppress(pynvml.NVMLError):
172
+ dev_cores = pynvml.nvmlDeviceGetNumGpuCores(dev)
183
173
 
184
174
  dev_cores_util = _get_sm_util_from_gpm_metrics(dev)
185
175
  if dev_cores_util is None:
@@ -74,3 +74,38 @@ except Exception:
74
74
 
75
75
  def amdsmi_shut_down():
76
76
  pass
77
+
78
+
79
+ # Example ROCM_HOME/ROCM_PATH
80
+ # - /opt/rocm
81
+ _rocm_home = Path(os.getenv("ROCM_HOME", os.getenv("ROCM_PATH") or "/opt/rocm"))
82
+
83
+
84
+ # NB: Defined after the `from amdsmi import *` above on purpose:
85
+ # the amdsmi package may export its own amdsmi_get_rocm_version
86
+ # (returning a tuple), which this file-based implementation must override.
87
+ def amdsmi_get_rocm_version() -> str | None:
88
+ """
89
+ Read the ROCm version from known files under the ROCm installation.
90
+
91
+ Returns:
92
+ The ROCm version string, or None if not found.
93
+
94
+ """
95
+ for vf in (
96
+ _rocm_home / ".info" / "version",
97
+ _rocm_home / ".info" / "version-rocm",
98
+ _rocm_home / ".info" / "version-dev",
99
+ _rocm_home / ".info" / "version-libs",
100
+ ):
101
+ if not vf.is_file():
102
+ continue
103
+
104
+ try:
105
+ version = vf.read_text().strip()
106
+ except OSError:
107
+ continue
108
+ if version:
109
+ return version
110
+
111
+ return None
@@ -453,10 +453,24 @@ def has_agent_get_asic_family_id(agent):
453
453
  return c_family_id.value
454
454
 
455
455
 
456
+ def hsa_agent_get_info_bdf(agent):
457
+ c_bdfid = c_uint64()
458
+ hsa_agent_get_info(agent, HSA_AMD_AGENT_INFO_BDFID, byref(c_bdfid))
459
+ # BDFID = ((DOMAIN & 0xFFFFFFFF) << 32) | ((BUS & 0xFF) << 8)
460
+ # | ((DEVICE & 0x1F) << 3) | (FUNCTION & 0x7)
461
+ bdfid = c_bdfid.value
462
+ domain = (bdfid >> 32) & 0xFFFFFFFF
463
+ bus = (bdfid >> 8) & 0xFF
464
+ device_id = (bdfid >> 3) & 0x1F
465
+ function = bdfid & 0x7
466
+ return f"{domain:04x}:{bus:02x}:{device_id:02x}.{function:x}"
467
+
468
+
456
469
  @dataclass
457
470
  class Agent:
458
471
  device_type: int | None = None
459
472
  device_id: str | None = None
473
+ bdf: str | None = None
460
474
  uuid: str | None = None
461
475
  name: str | None = None
462
476
  compute_capability: str | None = None
@@ -476,6 +490,9 @@ def get_agents() -> list[Agent]:
476
490
  return 0
477
491
 
478
492
  agent_device_id = hex(hsa_agent_get_info_chip_id(agent))
493
+ agent_bdf = None
494
+ with contextlib.suppress(HSAError):
495
+ agent_bdf = hsa_agent_get_info_bdf(agent)
479
496
  agent_uuid = hsa_agent_get_info_uuid(agent)
480
497
  agent_name = hsa_agent_get_info_product_name(agent)
481
498
  agent_compute_capability = hsa_agent_get_info_name(agent)
@@ -488,6 +505,7 @@ def get_agents() -> list[Agent]:
488
505
  Agent(
489
506
  device_type=agent_device_type,
490
507
  device_id=agent_device_id,
508
+ bdf=agent_bdf,
491
509
  uuid=agent_uuid,
492
510
  name=agent_name,
493
511
  compute_capability=agent_compute_capability,
@@ -207,6 +207,37 @@ def rsmi_shutdown():
207
207
  _libInitializedException = None
208
208
 
209
209
 
210
+ def rsmi_get_rocm_version() -> str | None:
211
+ """
212
+ Read the ROCm version from known files under the ROCm installation.
213
+
214
+ Returns:
215
+ The ROCm version string, or None if not found.
216
+
217
+ """
218
+ for vf in (
219
+ rocm_path / ".info" / "version",
220
+ rocm_path / ".info" / "version-rocm",
221
+ rocm_path / ".info" / "version-dev",
222
+ rocm_path / ".info" / "version-libs",
223
+ rocm_path.parent / ".info" / "version",
224
+ rocm_path.parent / ".info" / "version-rocm",
225
+ rocm_path.parent / ".info" / "version-dev",
226
+ rocm_path.parent / ".info" / "version-libs",
227
+ ):
228
+ if not vf.is_file():
229
+ continue
230
+
231
+ try:
232
+ version = vf.read_text().strip()
233
+ except OSError:
234
+ continue
235
+ if version:
236
+ return version
237
+
238
+ return None
239
+
240
+
210
241
  @convertStrBytes
211
242
  def rsmi_driver_version_get():
212
243
  component = rsmi_sw_component_t.RSMI_SW_COMP_DRIVER
@@ -39,14 +39,10 @@ if TYPE_CHECKING:
39
39
  Set true to disable PCI check during detection.
40
40
  Useful for WSL environments, where PCI information may not be available.
41
41
  """
42
- GPUSTACK_RUNTIME_DETECT_NO_TOOLKIT_CALL: bool = False
42
+ GPUSTACK_RUNTIME_DETECT_PCI_CLASS_PREFIXES: set[str] | None = None
43
43
  """
44
- Set true to disable toolkit calls during detection.
45
- Device detection typically involves calling platform-side management libraries and platform-side toolkit to retrieve extra information.
46
- For example, during NVIDIA detection, the NVML and CUDA are called, with CUDA used to retrieve GPU cores.
47
- However, if certain toolchains are not correctly installed in the environment,
48
- such as the Nvidia Fabric Manager being missing, calling the CUDA can cause blocking.
49
- Enabling this parameter can prevent blocking events.
44
+ The PCI class prefixes to check during detection.
45
+ When `GPUSTACK_RUNTIME_DETECT_NO_PCI_CHECK` is false, the detector will check if the PCI class of the device starts with any of the given prefixes.
50
46
  """
51
47
  GPUSTACK_RUNTIME_DETECT_NO_HEALTH_CHECK: bool = True
52
48
  """
@@ -374,11 +370,15 @@ variables: dict[str, Callable[[], Any]] = {
374
370
  lambda: to_bool(getenv("GPUSTACK_RUNTIME_DETECT_NO_PCI_CHECK")),
375
371
  lambda: any(x in get_os_release() for x in ("microsoft", "wsl")),
376
372
  ),
377
- "GPUSTACK_RUNTIME_DETECT_NO_TOOLKIT_CALL": lambda: to_bool(
378
- getenv(
379
- "GPUSTACK_RUNTIME_DETECT_NO_TOOLKIT_CALL",
380
- "0",
373
+ "GPUSTACK_RUNTIME_DETECT_PCI_CLASS_PREFIXES": lambda: to_set(
374
+ getenvs(
375
+ [
376
+ "GPUSTACK_RUNTIME_DETECT_PCI_CLASS_PREFIXES",
377
+ "GPUSTACK_PCI_CLASS_PREFIXES",
378
+ ],
379
+ "02,03,0b,12",
381
380
  ),
381
+ sep=",",
382
382
  ),
383
383
  "GPUSTACK_RUNTIME_DETECT_NO_HEALTH_CHECK": lambda: to_bool(
384
384
  getenv(
@@ -121,10 +121,8 @@ parametrize-names-type = "csv"
121
121
 
122
122
  [lint.per-file-ignores]
123
123
  "gpustack_runtime/deployer/__patches__.py" = ["ALL"]
124
- "gpustack_runtime/detector/pyacl/*.py" = ["ALL"]
125
124
  "gpustack_runtime/detector/pyamdsmi/*.py" = ["ALL"]
126
125
  "gpustack_runtime/detector/pyamdgpu/*.py" = ["ALL"]
127
- "gpustack_runtime/detector/pycuda/*.py" = ["ALL"]
128
126
  "gpustack_runtime/detector/pydcmi/*.py" = ["ALL"]
129
127
  "gpustack_runtime/detector/pyhgml/*.py" = ["ALL"]
130
128
  "gpustack_runtime/detector/pyhsa/*.py" = ["ALL"]
@@ -132,7 +130,6 @@ parametrize-names-type = "csv"
132
130
  "gpustack_runtime/detector/pymtml/*.py" = ["ALL"]
133
131
  "gpustack_runtime/detector/pymxsml/*.py" = ["ALL"]
134
132
  "gpustack_runtime/detector/pynvml/*.py" = ["ALL"]
135
- "gpustack_runtime/detector/pyrocmcore/*.py" = ["ALL"]
136
133
  "gpustack_runtime/detector/pyrocmsmi/*.py" = ["ALL"]
137
134
  "tests/*.py" = ["D", "S101"]
138
135
 
@@ -1 +0,0 @@
1
- git_commit = "de1ceac"