gpustack-runtime 0.1.39.post3__tar.gz → 0.1.40__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 (130) hide show
  1. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/.gitignore +0 -3
  2. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/PKG-INFO +3 -2
  3. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/README.md +1 -0
  4. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/deploy/manifests/docker-compose.yaml +4 -0
  5. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/deploy/manifests/kubernetes.yaml +10 -1
  6. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/__main__.py +7 -3
  7. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/_version.py +2 -2
  8. gpustack_runtime-0.1.40/gpustack_runtime/_version_appendix.py +1 -0
  9. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/cmds/__init__.py +2 -0
  10. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/cmds/deployer.py +84 -2
  11. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/cmds/images.py +2 -0
  12. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/deployer/__init__.py +2 -0
  13. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/deployer/__types__.py +52 -28
  14. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/deployer/__utils__.py +99 -112
  15. gpustack_runtime-0.1.40/gpustack_runtime/deployer/cdi/__init__.py +81 -0
  16. gpustack_runtime-0.1.40/gpustack_runtime/deployer/cdi/__types__.py +667 -0
  17. gpustack_runtime-0.1.40/gpustack_runtime/deployer/cdi/thead.py +103 -0
  18. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/deployer/docker.py +36 -22
  19. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/deployer/kuberentes.py +8 -4
  20. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/deployer/podman.py +35 -21
  21. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/__init__.py +62 -3
  22. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/__types__.py +11 -0
  23. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/iluvatar.py +10 -3
  24. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/nvidia.py +186 -97
  25. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/pyacl/__init__.py +9 -1
  26. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/pyamdgpu/__init__.py +8 -0
  27. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/pycuda/__init__.py +9 -1
  28. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/pydcmi/__init__.py +9 -2
  29. gpustack_runtime-0.1.40/gpustack_runtime/detector/pyhgml/__init__.py +5879 -0
  30. gpustack_runtime-0.1.40/gpustack_runtime/detector/pyhgml/libhgml.so +0 -0
  31. gpustack_runtime-0.1.40/gpustack_runtime/detector/pyhgml/libuki.so +0 -0
  32. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/pyhsa/__init__.py +9 -0
  33. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/pyixml/__init__.py +89 -164
  34. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/pyrocmcore/__init__.py +42 -24
  35. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/pyrocmsmi/__init__.py +138 -129
  36. gpustack_runtime-0.1.40/gpustack_runtime/detector/thead.py +733 -0
  37. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/envs.py +127 -54
  38. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/pack/Dockerfile +18 -1
  39. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/pyproject.toml +1 -1
  40. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/ruff.toml +1 -0
  41. gpustack_runtime-0.1.40/tests/gpustack_runtime/deployer/fixtures/__init__.py +43 -0
  42. gpustack_runtime-0.1.40/tests/gpustack_runtime/deployer/fixtures/test_load_yaml_or_json.json +132 -0
  43. gpustack_runtime-0.1.40/tests/gpustack_runtime/deployer/fixtures/test_load_yaml_or_json_multiple_jsons.json +36 -0
  44. gpustack_runtime-0.1.40/tests/gpustack_runtime/deployer/fixtures/test_load_yaml_or_json_multiple_yamls.yaml +17 -0
  45. gpustack_runtime-0.1.40/tests/gpustack_runtime/deployer/fixtures/test_load_yaml_or_json_single_json.json +17 -0
  46. gpustack_runtime-0.1.40/tests/gpustack_runtime/deployer/fixtures/test_load_yaml_or_json_single_yaml.yaml +8 -0
  47. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/deployer/test_utils.py +6 -18
  48. gpustack_runtime-0.1.40/tests/gpustack_runtime/detector/samples/detect_output_amd_mi308x.json +202 -0
  49. gpustack_runtime-0.1.40/tests/gpustack_runtime/detector/samples/detect_output_nvidia_h100.json +218 -0
  50. gpustack_runtime-0.1.40/tests/gpustack_runtime/detector/samples/detect_output_thead_ppu.json +50 -0
  51. gpustack_runtime-0.1.40/tests/gpustack_runtime/detector/samples/topology_output_amd_mi308x.json +107 -0
  52. gpustack_runtime-0.1.40/tests/gpustack_runtime/detector/samples/topology_output_mthreads_s5000.json +107 -0
  53. gpustack_runtime-0.1.40/tests/gpustack_runtime/detector/samples/topology_output_nvidia_h100.json +107 -0
  54. gpustack_runtime-0.1.40/tests/gpustack_runtime/detector/samples/topology_output_thead_ppu.json +23 -0
  55. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/uv.lock +4 -4
  56. gpustack_runtime-0.1.39.post3/gpustack_runtime/_version_appendix.py +0 -1
  57. gpustack_runtime-0.1.39.post3/tests/gpustack_runtime/deployer/fixtures/test_make_image_with.json +0 -69
  58. gpustack_runtime-0.1.39.post3/tests/gpustack_runtime/deployer/fixtures/test_replace_image_with.json +0 -58
  59. gpustack_runtime-0.1.39.post3/tests/gpustack_runtime/detector/fixtures/__init__.py +0 -23
  60. gpustack_runtime-0.1.39.post3/tests/gpustack_runtime/detector/samples/detect_output_nvidia_h100.json +0 -27
  61. gpustack_runtime-0.1.39.post3/tests/gpustack_runtime/detector/samples/topology_output_nvidia_h100.json +0 -16
  62. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/.codespelldict +0 -0
  63. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/.codespellrc +0 -0
  64. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/.dockerignore +0 -0
  65. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/.gitattributes +0 -0
  66. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/.pre-commit-config.yaml +0 -0
  67. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/.python-version +0 -0
  68. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/LICENSE +0 -0
  69. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/Makefile +0 -0
  70. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/docs/index.md +0 -0
  71. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/docs/modules/gpustack_runtime.deployer.md +0 -0
  72. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/docs/modules/gpustack_runtime.detector.md +0 -0
  73. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/docs/modules/gpustack_runtime.md +0 -0
  74. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/__init__.py +0 -0
  75. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/_version.pyi +0 -0
  76. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/cmds/__types__.py +0 -0
  77. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/cmds/detector.py +0 -0
  78. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/deployer/__patches__.py +0 -0
  79. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/__utils__.py +0 -0
  80. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/amd.py +0 -0
  81. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/ascend.py +0 -0
  82. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/cambricon.py +0 -0
  83. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/hygon.py +0 -0
  84. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/metax.py +0 -0
  85. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/mthreads.py +0 -0
  86. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/pyamdsmi/__init__.py +0 -0
  87. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/pymxsml/__init__.py +0 -0
  88. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/pymxsml/mxsml.py +0 -0
  89. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/pymxsml/mxsml_extension.py +0 -0
  90. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/detector/pymxsml/mxsml_mcm.py +0 -0
  91. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/gpustack_runtime/logging.py +0 -0
  92. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/hatch.toml +0 -0
  93. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/mkdocs.yml +0 -0
  94. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/pack/Dockerfile.dummy +0 -0
  95. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/pytest.ini +0 -0
  96. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/deployer/fixtures/test_compare_versions.json +0 -0
  97. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/deployer/fixtures/test_correct_runner_image.json +0 -0
  98. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/deployer/fixtures/test_nginx_entrypoint.sh +0 -0
  99. {gpustack_runtime-0.1.39.post3/tests/gpustack_runtime/deployer → gpustack_runtime-0.1.40/tests/gpustack_runtime/detector}/fixtures/__init__.py +0 -0
  100. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/README.md +0 -0
  101. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/detect_output_amd_mi300x.json +0 -0
  102. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/detect_output_amd_rx7800xt.json +0 -0
  103. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/detect_output_ascend_310p3.json +0 -0
  104. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/detect_output_ascend_910b2.json +0 -0
  105. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/detect_output_hygon_k100ai.json +0 -0
  106. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/detect_output_metax_c500.json +0 -0
  107. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_gb10.json +0 -0
  108. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_h200.json +0 -0
  109. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_rtx4080super.json +0 -0
  110. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_rtx4090d.json +0 -0
  111. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_rtx5090d.json +0 -0
  112. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/topology_output_amd_mi300x.json +0 -0
  113. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/topology_output_amd_rx7800xt.json +0 -0
  114. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/topology_output_ascend_310p3.json +0 -0
  115. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/topology_output_ascend_910b2.json +0 -0
  116. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/topology_output_hygon_k100ai.json +0 -0
  117. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/topology_output_metax_c500.json +0 -0
  118. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/topology_output_nvidia_h200.json +0 -0
  119. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/topology_output_nvidia_rtx4080super.json +0 -0
  120. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/topology_output_nvidia_rtx4090d.json +0 -0
  121. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/samples/topology_output_nvidia_rtx5090d.json +0 -0
  122. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/test_amd.py +0 -0
  123. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/test_ascend.py +0 -0
  124. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/test_cambricon.py +0 -0
  125. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/test_hygon.py +0 -0
  126. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/test_iluvatar.py +0 -0
  127. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/test_metax.py +0 -0
  128. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/test_mthreads.py +0 -0
  129. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/tests/gpustack_runtime/detector/test_nvidia.py +0 -0
  130. {gpustack_runtime-0.1.39.post3 → gpustack_runtime-0.1.40}/uv.toml +0 -0
@@ -4,9 +4,6 @@
4
4
  .DS_Store
5
5
  *.swp
6
6
 
7
- # C extensions
8
- *.so
9
-
10
7
  # Python-generated files
11
8
  _version.py
12
9
  _version_appendix.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gpustack-runtime
3
- Version: 0.1.39.post3
3
+ Version: 0.1.40
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
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.13
15
15
  Requires-Python: >=3.10
16
16
  Requires-Dist: argcomplete>=3.6.3
17
17
  Requires-Dist: docker>=7.1.0
18
- Requires-Dist: gpustack-runner>=0.1.23.post5
18
+ Requires-Dist: gpustack-runner>=0.1.24.post1
19
19
  Requires-Dist: kubernetes>=33.1.0
20
20
  Requires-Dist: mthreads-ml-py>=2.2.10
21
21
  Requires-Dist: nvidia-ml-py>=13.580.65
@@ -38,6 +38,7 @@ It supports detection of a wide range of GPU and accelerator resources, includin
38
38
  - MetaX GPU
39
39
  - Moore Threads GPU
40
40
  - NVIDIA GPU
41
+ - T-Head PPU
41
42
 
42
43
  Contributions to support additional GPU resources are welcome!
43
44
 
@@ -12,6 +12,7 @@ It supports detection of a wide range of GPU and accelerator resources, includin
12
12
  - MetaX GPU
13
13
  - Moore Threads GPU
14
14
  - NVIDIA GPU
15
+ - T-Head PPU
15
16
 
16
17
  Contributions to support additional GPU resources are welcome!
17
18
 
@@ -32,12 +32,15 @@ services:
32
32
  # see https://github.com/gpustack/runtime/blob/016531084000df8075d53772a3c33f41d829ba37/gpustack_runtime/envs.py#L48-L55 for details.
33
33
  # - GPUSTACK_RUNTIME_DEPLOY_MIRRORED_NAME:
34
34
  # Specify the name of this Container for gpustack-runtime identify itself.
35
+ # - GPUSTACK_RUNTIME_DEPLOY_CDI_SPECS_DIRECTORY:
36
+ # Specify the directory of CDI device interface specs.
35
37
  #
36
38
  container_name: gpustack-runtime
37
39
  environment:
38
40
  - GPUSTACK_RUNTIME_DEPLOY=Docker
39
41
  - GPUSTACK_RUNTIME_DEPLOY_MIRRORED_DEPLOYMENT=true
40
42
  - GPUSTACK_RUNTIME_DEPLOY_MIRRORED_NAME=gpustack-runtime
43
+ - GPUSTACK_RUNTIME_DEPLOY_CDI_SPECS_DIRECTORY=/var/run/cdi
41
44
 
42
45
  # Mount necessary volume for gpustack-runtime to work properly.
43
46
  # - Mount docker socket for docker runtime.
@@ -47,6 +50,7 @@ services:
47
50
  volumes:
48
51
  - gpustack-runtime-data:/var/lib/gpustack
49
52
  - /var/run/docker.sock:/var/run/docker.sock:ro
53
+ - /var/run/cdi:/var/run/cdi
50
54
  # - /opt/...:/opt/...:ro
51
55
  volumes:
52
56
  gpustack-runtime-data: { }
@@ -109,6 +109,8 @@ spec:
109
109
  # Change this if you want to deploy workloads into another namespace.
110
110
  # - GPUSTACK_RUNTIME_KUBERNETES_NODE_NAME:
111
111
  # Make sure that deploy workloads on the same node.
112
+ # - GPUSTACK_RUNTIME_DEPLOY_CDI_SPECS_DIRECTORY:
113
+ # Specify the directory of CDI device interface specs.
112
114
  #
113
115
  env:
114
116
  - name: GPUSTACK_RUNTIME_DEPLOY
@@ -127,6 +129,8 @@ spec:
127
129
  valueFrom:
128
130
  fieldRef:
129
131
  fieldPath: spec.nodeName
132
+ - name: GPUSTACK_RUNTIME_DEPLOY_CDI_SPECS_DIRECTORY
133
+ value: "/var/run/cdi"
130
134
 
131
135
  # Mount necessary volume for gpustack-runtime to work properly.
132
136
  # - Mount gpustack data volume for persistent data storage.
@@ -135,14 +139,19 @@ spec:
135
139
  volumeMounts:
136
140
  - name: gpustack-runtime-data
137
141
  mountPath: /var/lib/gpustack
142
+ - name: cdi
143
+ mountPath: /var/run/cdi
138
144
  # - name: toolkit
139
145
  # mountPath: /opt/...
140
146
  volumes:
141
147
  - name: gpustack-runtime-data
142
148
  emptyDir: { }
149
+ - name: cdi
150
+ hostPath:
151
+ path: /var/run/cdi
143
152
  # - name: toolkit
144
153
  # hostPath:
145
- # name: /opt/...
154
+ # path: /opt/...
146
155
 
147
156
  # Inject service account to the Pod for accessing Kubernetes API.
148
157
  #
@@ -7,10 +7,12 @@ import time
7
7
  from argparse import ArgumentParser
8
8
 
9
9
  import argcomplete
10
+ from gpustack_runner.cmds import LoadImagesSubCommand
10
11
 
11
12
  from . import deployer, detector
12
13
  from ._version import commit_id, version
13
14
  from .cmds import (
15
+ CDIGenerateSubCommand,
14
16
  CopyImagesSubCommand,
15
17
  CreateWorkloadSubCommand,
16
18
  DeleteWorkloadsSubCommand,
@@ -71,12 +73,14 @@ def main():
71
73
  InspectWorkloadSubCommand.register(subcommand_parser)
72
74
  DetectDevicesSubCommand.register(subcommand_parser)
73
75
  GetDevicesTopologySubCommand.register(subcommand_parser)
74
- ListImagesSubCommand.register(subcommand_parser)
75
- SaveImagesSubCommand.register(subcommand_parser)
76
- CopyImagesSubCommand.register(subcommand_parser)
77
76
  LogsSelfSubCommand.register(subcommand_parser)
78
77
  ExecSelfSubCommand.register(subcommand_parser)
79
78
  InspectSelfSubCommand.register(subcommand_parser)
79
+ CDIGenerateSubCommand.register(subcommand_parser)
80
+ ListImagesSubCommand.register(subcommand_parser)
81
+ SaveImagesSubCommand.register(subcommand_parser)
82
+ LoadImagesSubCommand.register(subcommand_parser)
83
+ CopyImagesSubCommand.register(subcommand_parser)
80
84
 
81
85
  # Autocomplete
82
86
  argcomplete.autocomplete(parser)
@@ -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.1.39.post3'
31
- __version_tuple__ = version_tuple = (0, 1, 39, 'post3')
30
+ __version__ = version = '0.1.40'
31
+ __version_tuple__ = version_tuple = (0, 1, 40)
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 = "1f4627e"
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from .deployer import (
4
+ CDIGenerateSubCommand,
4
5
  CreateWorkloadSubCommand,
5
6
  DeleteWorkloadsSubCommand,
6
7
  DeleteWorkloadSubCommand,
@@ -24,6 +25,7 @@ from .images import (
24
25
  )
25
26
 
26
27
  __all__ = [
28
+ "CDIGenerateSubCommand",
27
29
  "CopyImagesSubCommand",
28
30
  "CreateWorkloadSubCommand",
29
31
  "DeleteWorkloadSubCommand",
@@ -5,7 +5,7 @@ import json
5
5
  import os
6
6
  import sys
7
7
  import time
8
- from argparse import REMAINDER
8
+ from argparse import OPTIONAL, REMAINDER
9
9
  from pathlib import Path
10
10
  from typing import TYPE_CHECKING
11
11
 
@@ -25,6 +25,7 @@ from ..deployer import (
25
25
  WorkloadStatusStateEnum,
26
26
  async_logs_self,
27
27
  async_logs_workload,
28
+ cdi_generate_config,
28
29
  create_workload,
29
30
  delete_workload,
30
31
  exec_self,
@@ -34,7 +35,7 @@ from ..deployer import (
34
35
  inspect_workload,
35
36
  list_workloads,
36
37
  )
37
- from ..detector import supported_backends
38
+ from ..detector import supported_backends, supported_manufacturers
38
39
  from .__types__ import SubCommand
39
40
 
40
41
  if TYPE_CHECKING:
@@ -92,6 +93,7 @@ class CreateWorkloadSubCommand(SubCommand):
92
93
  command_script: str | None
93
94
  port: int
94
95
  host_network: bool
96
+ privileged: bool
95
97
  check: bool
96
98
  namespace: str
97
99
  name: str
@@ -133,11 +135,19 @@ class CreateWorkloadSubCommand(SubCommand):
133
135
 
134
136
  deploy_parser.add_argument(
135
137
  "--host-network",
138
+ "--network-host",
136
139
  action="store_true",
137
140
  help="Use host network (default: False)",
138
141
  default=False,
139
142
  )
140
143
 
144
+ deploy_parser.add_argument(
145
+ "--privileged",
146
+ action="store_true",
147
+ help="Run the container in privileged mode (default: False)",
148
+ default=False,
149
+ )
150
+
141
151
  deploy_parser.add_argument(
142
152
  "--check",
143
153
  action="store_true",
@@ -183,6 +193,7 @@ class CreateWorkloadSubCommand(SubCommand):
183
193
  self.command_script = None
184
194
  self.port = args.port
185
195
  self.host_network = args.host_network
196
+ self.privileged = args.privileged
186
197
  self.check = args.check
187
198
  self.namespace = args.namespace
188
199
  self.name = args.name
@@ -237,6 +248,7 @@ class CreateWorkloadSubCommand(SubCommand):
237
248
  execution = ContainerExecution(
238
249
  command_script=self.command_script,
239
250
  args=self.extra_args,
251
+ privileged=self.privileged,
240
252
  )
241
253
  ports = (
242
254
  [
@@ -945,6 +957,76 @@ class InspectSelfSubCommand(SubCommand):
945
957
  print(inspect_self())
946
958
 
947
959
 
960
+ class CDIGenerateSubCommand(SubCommand):
961
+ """
962
+ Command to generate CDI configurations.
963
+ """
964
+
965
+ format: str
966
+ output: Path | None
967
+
968
+ @staticmethod
969
+ def register(parser: _SubParsersAction):
970
+ cdi_parser = parser.add_parser(
971
+ "cdi-generate",
972
+ help="Generate CDI configurations according to the current environment",
973
+ aliases=["cdi-gen"],
974
+ )
975
+
976
+ cdi_parser.add_argument(
977
+ "--format",
978
+ type=str,
979
+ choices=["yaml", "json"],
980
+ default="yaml",
981
+ help="Format of the CDI configurations",
982
+ )
983
+
984
+ cdi_parser.add_argument(
985
+ "output",
986
+ nargs=OPTIONAL,
987
+ help="Output directory to save CDI configurations (default: current directory)",
988
+ )
989
+
990
+ cdi_parser.set_defaults(func=CDIGenerateSubCommand)
991
+
992
+ def __init__(self, args: Namespace):
993
+ self.format = args.format
994
+ self.output = Path(args.output) if args.output else None
995
+
996
+ if self.output:
997
+ try:
998
+ if not self.output.exists():
999
+ self.output.mkdir(parents=True, exist_ok=True)
1000
+ except OSError as e:
1001
+ msg = f"Failed to prepare output directory '{self.output}' for CDI configurations"
1002
+ raise RuntimeError(msg) from e
1003
+
1004
+ if not self.output.is_dir():
1005
+ msg = f"The output path '{self.output}' is not a directory"
1006
+ raise RuntimeError(msg)
1007
+
1008
+ def run(self):
1009
+ print("\033[2J\033[H", end="")
1010
+
1011
+ generated = False
1012
+ for manu in supported_manufacturers():
1013
+ content, path = cdi_generate_config(
1014
+ manufacturer=manu,
1015
+ output=self.output,
1016
+ )
1017
+ if content:
1018
+ generated = True
1019
+ if path:
1020
+ print(f"Generated CDI configuration for '{manu}' at {path}:\n")
1021
+ else:
1022
+ print(f"Generated CDI configuration for '{manu}':\n")
1023
+ print(content)
1024
+ print()
1025
+
1026
+ if not generated:
1027
+ print("No CDI configurations were generated.")
1028
+
1029
+
948
1030
  def format_workloads_json(sts: list[WorkloadStatus]) -> str:
949
1031
  return json.dumps([st.to_dict() for st in sts], indent=2)
950
1032
 
@@ -3,6 +3,7 @@ from __future__ import annotations
3
3
  from gpustack_runner.cmds import (
4
4
  CopyImagesSubCommand,
5
5
  ListImagesSubCommand,
6
+ LoadImagesSubCommand,
6
7
  PlatformedImage,
7
8
  SaveImagesSubCommand,
8
9
  append_images,
@@ -20,6 +21,7 @@ append_images(
20
21
  __all__ = [
21
22
  "CopyImagesSubCommand",
22
23
  "ListImagesSubCommand",
24
+ "LoadImagesSubCommand",
23
25
  "PlatformedImage",
24
26
  "SaveImagesSubCommand",
25
27
  "append_images",
@@ -31,6 +31,7 @@ from .__types__ import (
31
31
  WorkloadStatus,
32
32
  WorkloadStatusStateEnum,
33
33
  )
34
+ from .cdi import generate_config as cdi_generate_config
34
35
  from .docker import (
35
36
  DockerDeployer,
36
37
  DockerWorkloadPlan,
@@ -602,6 +603,7 @@ __all__ = [
602
603
  "WorkloadStatusStateEnum",
603
604
  "async_logs_self",
604
605
  "async_logs_workload",
606
+ "cdi_generate_config",
605
607
  "create_workload",
606
608
  "delete_workload",
607
609
  "exec_self",
@@ -14,6 +14,7 @@ from dataclasses_json import dataclass_json
14
14
 
15
15
  from .. import envs
16
16
  from ..detector import (
17
+ ManufacturerEnum,
17
18
  Topology,
18
19
  detect_devices,
19
20
  get_devices_topologies,
@@ -21,6 +22,7 @@ from ..detector import (
21
22
  manufacturer_to_backend,
22
23
  )
23
24
  from .__utils__ import (
25
+ adjust_image_with_envs,
24
26
  correct_runner_image,
25
27
  fnv1a_32_hex,
26
28
  fnv1a_64_hex,
@@ -1018,20 +1020,8 @@ class WorkloadPlan(WorkloadSecurity):
1018
1020
  c.files.append(command_script)
1019
1021
  c.execution.command = [command_script_name] # Override command.
1020
1022
  c.execution.command_script = None
1021
- # Add default registry if needed.
1022
- if (
1023
- envs.GPUSTACK_RUNTIME_DEPLOY_DEFAULT_CONTAINER_REGISTRY
1024
- and envs.GPUSTACK_RUNTIME_DEPLOY_DEFAULT_CONTAINER_REGISTRY
1025
- not in ["docker.io", "index.docker.io"]
1026
- ):
1027
- image_registry = (
1028
- envs.GPUSTACK_RUNTIME_DEPLOY_DEFAULT_CONTAINER_NAMESPACE
1029
- )
1030
- image_split = c.image.split("/")
1031
- if len(image_split) == 1:
1032
- c.image = f"{image_registry}/library/{c.image}"
1033
- elif len(image_split) == 2:
1034
- c.image = f"{image_registry}/{c.image}"
1023
+ # Adjust images.
1024
+ c.image = adjust_image_with_envs(c.image)
1035
1025
  # Correct runner image if needed.
1036
1026
  if envs.GPUSTACK_RUNTIME_DEPLOY_CORRECT_RUNNER_IMAGE:
1037
1027
  c.image, ok = correct_runner_image(c.image)
@@ -1279,6 +1269,17 @@ class Deployer(ABC):
1279
1269
  """
1280
1270
  Thread pool for the deployer.
1281
1271
  """
1272
+ _visible_devices_manufacturers: dict[str, ManufacturerEnum] | None = None
1273
+ """
1274
+ Recorded visible devices manufacturers,
1275
+ the key is the runtime visible devices env name,
1276
+ the value is the corresponding manufacturer.
1277
+ For example:
1278
+ {
1279
+ "NVIDIA_VISIBLE_DEVICES": ManufacturerEnum.NVIDIA,
1280
+ "AMD_VISIBLE_DEVICES": ManufacturerEnum.AMD
1281
+ }.
1282
+ """
1282
1283
  _visible_devices_env: dict[str, list[str]] | None = None
1283
1284
  """
1284
1285
  Recorded visible devices envs,
@@ -1358,14 +1359,16 @@ class Deployer(ABC):
1358
1359
 
1359
1360
  def _prepare(self):
1360
1361
  """
1361
- Detect devices once, and construct critical elements for post processing, including:
1362
+ Detect devices once, and construct critical elements for post-processing, including:
1363
+ - Prepare visible devices manufacturers mapping.
1362
1364
  - Prepare visible devices environment variables mapping.
1363
1365
  - Prepare visible devices values mapping.
1364
- - Prepare topology.
1366
+ - Prepare visible devices topologies mapping.
1365
1367
  """
1366
- if self._visible_devices_env:
1368
+ if self._visible_devices_manufacturers is not None:
1367
1369
  return
1368
1370
 
1371
+ self._visible_devices_manufacturers = {}
1369
1372
  self._visible_devices_env = {}
1370
1373
  self._visible_devices_cdis = {}
1371
1374
  self._visible_devices_values = {}
@@ -1379,15 +1382,19 @@ class Deployer(ABC):
1379
1382
  if group_devices:
1380
1383
  for manu, devs in group_devices.items():
1381
1384
  backend = manufacturer_to_backend(manu)
1382
- rk = envs.GPUSTACK_RUNTIME_DETECT_BACKEND_MAP_RESOURCE_KEY.get(backend)
1385
+ resource_key = (
1386
+ envs.GPUSTACK_RUNTIME_DETECT_BACKEND_MAP_RESOURCE_KEY.get(backend)
1387
+ )
1388
+ if resource_key is None:
1389
+ continue
1383
1390
  ren = envs.GPUSTACK_RUNTIME_DEPLOY_RESOURCE_KEY_MAP_RUNTIME_VISIBLE_DEVICES.get(
1384
- rk,
1391
+ resource_key,
1385
1392
  )
1386
1393
  ben_list = envs.GPUSTACK_RUNTIME_DEPLOY_RESOURCE_KEY_MAP_BACKEND_VISIBLE_DEVICES.get(
1387
- rk,
1394
+ resource_key,
1388
1395
  )
1389
- cdi = envs.GPUSTACK_RUNTIME_DEPLOY_RESOURCE_KEY_MAP_CONTAINER_DEVICE_INTERFACES.get(
1390
- rk,
1396
+ cdi = envs.GPUSTACK_RUNTIME_DEPLOY_RESOURCE_KEY_MAP_CDI.get(
1397
+ resource_key,
1391
1398
  )
1392
1399
  if ren and ben_list:
1393
1400
  valued_uuid = (
@@ -1401,6 +1408,8 @@ class Deployer(ABC):
1401
1408
  dev_uuids.append(dev.uuid)
1402
1409
  dev_indexes.append(str(dev.index))
1403
1410
  dev_indexes_alignment[str(dev.index)] = str(dev_i)
1411
+ # Map runtime visible devices env <-> manufacturer.
1412
+ self._visible_devices_manufacturers[ren] = manu
1404
1413
  # Map runtime visible devices env <-> backend visible devices env list.
1405
1414
  self._visible_devices_env[ren] = ben_list
1406
1415
  # Map runtime visible devices env <-> CDI key.
@@ -1433,16 +1442,28 @@ class Deployer(ABC):
1433
1442
  return
1434
1443
 
1435
1444
  # Fallback to unknown backend
1436
- self._visible_devices_env["UNKNOWN_RUNTIME_VISIBLE_DEVICES"] = []
1437
- self._visible_devices_values["UNKNOWN_RUNTIME_VISIBLE_DEVICES"] = ["all"]
1445
+ ren = "UNKNOWN_RUNTIME_VISIBLE_DEVICES"
1446
+ self._visible_devices_manufacturers[ren] = ManufacturerEnum.UNKNOWN
1447
+ self._visible_devices_env[ren] = []
1448
+ self._visible_devices_cdis[ren] = "unknown/devices"
1449
+ self._visible_devices_values[ren] = ["all"]
1438
1450
 
1439
- def get_visible_devices_values(
1451
+ def get_visible_devices_materials(
1440
1452
  self,
1441
- ) -> (dict[str, list[str]], dict[str, str], dict[str, list[str]]):
1453
+ ) -> (
1454
+ dict[str, ManufacturerEnum],
1455
+ dict[str, list[str]],
1456
+ dict[str, str],
1457
+ dict[str, list[str]],
1458
+ ):
1442
1459
  """
1443
1460
  Return the visible devices environment variables, cdis and values mappings.
1444
1461
  For example:
1445
1462
  (
1463
+ {
1464
+ "NVIDIA_VISIBLE_DEVICES": ManufacturerEnum.NVIDIA,
1465
+ "AMD_VISIBLE_DEVICES": ManufacturerEnum.AMD
1466
+ },
1446
1467
  {
1447
1468
  "NVIDIA_VISIBLE_DEVICES": ["CUDA_VISIBLE_DEVICES"],
1448
1469
  "AMD_VISIBLE_DEVICES": ["HIP_VISIBLE_DEVICES", "ROCR_VISIBLE_DEVICES"]
@@ -1458,10 +1479,12 @@ class Deployer(ABC):
1458
1479
  ).
1459
1480
 
1460
1481
  Returns:
1461
- A tuple of two dictionaries:
1482
+ A tuple of four dictionaries:
1462
1483
  - The first dictionary maps runtime visible devices environment variable names
1463
- to lists of backend visible devices environment variable names.
1484
+ to corresponding manufacturers.
1464
1485
  - The second dictionary maps runtime visible devices environment variable names
1486
+ to lists of backend visible devices environment variable names.
1487
+ - The third dictionary maps runtime visible devices environment variable names
1465
1488
  to corresponding CDI keys.
1466
1489
  - The last dictionary maps runtime visible devices environment variable names
1467
1490
  to lists of device indexes or UUIDs.
@@ -1469,6 +1492,7 @@ class Deployer(ABC):
1469
1492
  """
1470
1493
  self._prepare()
1471
1494
  return (
1495
+ self._visible_devices_manufacturers,
1472
1496
  self._visible_devices_env,
1473
1497
  self._visible_devices_cdis,
1474
1498
  self._visible_devices_values,