mindspore 2.6.0rc1__cp310-cp310-win_amd64.whl → 2.7.0rc1__cp310-cp310-win_amd64.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.

Potentially problematic release.


This version of mindspore might be problematic. Click here for more details.

Files changed (407) hide show
  1. mindspore/.commit_id +1 -1
  2. mindspore/Microsoft.VisualStudio.Telemetry.dll +0 -0
  3. mindspore/Newtonsoft.Json.dll +0 -0
  4. mindspore/__init__.py +1 -1
  5. mindspore/_c_dataengine.cp310-win_amd64.pyd +0 -0
  6. mindspore/_c_expression.cp310-win_amd64.pyd +0 -0
  7. mindspore/_c_mindrecord.cp310-win_amd64.pyd +0 -0
  8. mindspore/_checkparam.py +40 -9
  9. mindspore/{_deprecated → _extends/optimize}/__init__.py +9 -3
  10. mindspore/_extends/optimize/cell_utils.py +96 -0
  11. mindspore/_extends/parse/__init__.py +2 -2
  12. mindspore/_extends/parse/compile_config.py +44 -22
  13. mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +1 -1
  14. mindspore/_extends/parse/parser.py +37 -62
  15. mindspore/_extends/parse/resources.py +39 -0
  16. mindspore/_extends/parse/standard_method.py +43 -13
  17. mindspore/_extends/parse/trope.py +8 -1
  18. mindspore/_extends/pijit/__init__.py +1 -2
  19. mindspore/amp.py +4 -4
  20. mindspore/atlprov.dll +0 -0
  21. mindspore/avcodec-59.dll +0 -0
  22. mindspore/avdevice-59.dll +0 -0
  23. mindspore/avfilter-8.dll +0 -0
  24. mindspore/avformat-59.dll +0 -0
  25. mindspore/avutil-57.dll +0 -0
  26. mindspore/boost/adasum.py +1 -1
  27. mindspore/boost/boost_cell_wrapper.py +4 -4
  28. mindspore/c1.dll +0 -0
  29. mindspore/c1xx.dll +0 -0
  30. mindspore/c2.dll +0 -0
  31. mindspore/common/__init__.py +27 -2
  32. mindspore/common/_grad_function.py +2 -1
  33. mindspore/common/_pijit_context.py +28 -7
  34. mindspore/common/_stub_tensor.py +1 -209
  35. mindspore/common/_tensor_cpp_method.py +1 -1
  36. mindspore/common/_tensor_docs.py +77 -16
  37. mindspore/common/api.py +238 -113
  38. mindspore/common/dtype.py +21 -11
  39. mindspore/common/dump.py +10 -15
  40. mindspore/common/generator.py +5 -3
  41. mindspore/common/hook_handle.py +11 -2
  42. mindspore/common/jit_config.py +1 -1
  43. mindspore/common/jit_trace.py +84 -105
  44. mindspore/common/parameter.py +26 -12
  45. mindspore/common/recompute.py +3 -3
  46. mindspore/common/sparse_tensor.py +0 -3
  47. mindspore/common/symbol.py +0 -1
  48. mindspore/common/tensor.py +81 -81
  49. mindspore/communication/_comm_helper.py +46 -4
  50. mindspore/communication/management.py +79 -7
  51. mindspore/context.py +58 -40
  52. mindspore/dataset/core/config.py +3 -3
  53. mindspore/dataset/engine/datasets.py +20 -7
  54. mindspore/dataset/engine/datasets_user_defined.py +33 -3
  55. mindspore/dataset/engine/iterators.py +2 -2
  56. mindspore/dataset/engine/obs/config_loader.py +2 -2
  57. mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +8 -0
  58. mindspore/dataset/transforms/py_transforms.py +7 -3
  59. mindspore/dataset/transforms/transforms.py +7 -3
  60. mindspore/dataset/vision/validators.py +1 -0
  61. mindspore/device_context/ascend/device.py +1 -1
  62. mindspore/device_context/gpu/__init__.py +2 -2
  63. mindspore/device_context/gpu/device.py +1 -1
  64. mindspore/device_context/gpu/op_precision.py +4 -2
  65. mindspore/device_context/gpu/op_tuning.py +6 -3
  66. mindspore/device_manager.py +16 -9
  67. mindspore/dnnl.dll +0 -0
  68. mindspore/dpcmi.dll +0 -0
  69. mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +3 -7
  70. mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
  71. mindspore/experimental/optim/adadelta.py +13 -20
  72. mindspore/experimental/optim/adagrad.py +15 -22
  73. mindspore/experimental/optim/adam.py +17 -24
  74. mindspore/experimental/optim/adamax.py +14 -22
  75. mindspore/experimental/optim/adamw.py +28 -34
  76. mindspore/experimental/optim/asgd.py +15 -25
  77. mindspore/experimental/optim/lr_scheduler.py +27 -45
  78. mindspore/experimental/optim/nadam.py +14 -24
  79. mindspore/experimental/optim/optimizer.py +13 -23
  80. mindspore/experimental/optim/radam.py +18 -24
  81. mindspore/experimental/optim/rmsprop.py +14 -25
  82. mindspore/experimental/optim/rprop.py +15 -26
  83. mindspore/experimental/optim/sgd.py +9 -19
  84. mindspore/hal/__init__.py +4 -4
  85. mindspore/hal/contiguous_tensors_handle.py +2 -2
  86. mindspore/hal/memory.py +27 -7
  87. mindspore/include/api/cell.h +37 -1
  88. mindspore/include/api/delegate.h +10 -0
  89. mindspore/include/api/model.h +3 -0
  90. mindspore/include/api/types.h +2 -2
  91. mindspore/include/c_api/model_c.h +0 -58
  92. mindspore/include/c_api/tensor_c.h +0 -26
  93. mindspore/include/dataset/vision_ascend.h +1 -1
  94. mindspore/jpeg62.dll +0 -0
  95. mindspore/mindrecord/tools/cifar10.py +60 -11
  96. mindspore/mindrecord/tools/cifar10_to_mr.py +5 -0
  97. mindspore/mindspore_backend_common.dll +0 -0
  98. mindspore/mindspore_backend_manager.dll +0 -0
  99. mindspore/mindspore_common.dll +0 -0
  100. mindspore/mindspore_core.dll +0 -0
  101. mindspore/mindspore_cpu_res_manager.dll +0 -0
  102. mindspore/mindspore_dump.dll +0 -0
  103. mindspore/mindspore_frontend.dll +0 -0
  104. mindspore/mindspore_glog.dll +0 -0
  105. mindspore/mindspore_memory_pool.dll +0 -0
  106. mindspore/mindspore_ms_backend.dll +0 -0
  107. mindspore/mindspore_ops.dll +0 -0
  108. mindspore/mindspore_ops_host.dll +0 -0
  109. mindspore/mindspore_ops_kernel_common.dll +0 -0
  110. mindspore/mindspore_profiler.dll +0 -0
  111. mindspore/mindspore_pyboost.dll +0 -0
  112. mindspore/mindspore_pynative.dll +0 -0
  113. mindspore/mindspore_res_manager.dll +0 -0
  114. mindspore/mindspore_runtime_pipeline.dll +0 -0
  115. mindspore/mint/__init__.py +6 -46
  116. mindspore/mint/distributed/__init__.py +1 -0
  117. mindspore/mint/distributed/distributed.py +212 -9
  118. mindspore/mint/nn/__init__.py +1 -1
  119. mindspore/mint/nn/functional.py +53 -6
  120. mindspore/mint/nn/layer/_functions.py +164 -294
  121. mindspore/mint/nn/layer/activation.py +8 -6
  122. mindspore/mint/nn/layer/conv.py +137 -101
  123. mindspore/mint/nn/layer/normalization.py +8 -22
  124. mindspore/mint/optim/adam.py +19 -18
  125. mindspore/mint/optim/adamw.py +14 -8
  126. mindspore/mint/optim/sgd.py +5 -5
  127. mindspore/msobj140.dll +0 -0
  128. mindspore/mspdb140.dll +0 -0
  129. mindspore/mspdbcore.dll +0 -0
  130. mindspore/mspdbst.dll +0 -0
  131. mindspore/mspft140.dll +0 -0
  132. mindspore/msvcdis140.dll +0 -0
  133. mindspore/msvcp140_1.dll +0 -0
  134. mindspore/msvcp140_2.dll +0 -0
  135. mindspore/msvcp140_atomic_wait.dll +0 -0
  136. mindspore/msvcp140_codecvt_ids.dll +0 -0
  137. mindspore/nn/cell.py +328 -502
  138. mindspore/nn/grad/cell_grad.py +11 -12
  139. mindspore/nn/layer/activation.py +32 -34
  140. mindspore/nn/layer/basic.py +67 -64
  141. mindspore/nn/layer/channel_shuffle.py +4 -4
  142. mindspore/nn/layer/combined.py +4 -2
  143. mindspore/nn/layer/conv.py +117 -110
  144. mindspore/nn/layer/dense.py +9 -7
  145. mindspore/nn/layer/embedding.py +50 -52
  146. mindspore/nn/layer/image.py +37 -39
  147. mindspore/nn/layer/math.py +111 -112
  148. mindspore/nn/layer/normalization.py +56 -44
  149. mindspore/nn/layer/pooling.py +58 -63
  150. mindspore/nn/layer/rnn_cells.py +33 -33
  151. mindspore/nn/layer/rnns.py +56 -56
  152. mindspore/nn/layer/thor_layer.py +74 -73
  153. mindspore/nn/layer/transformer.py +11 -1
  154. mindspore/nn/learning_rate_schedule.py +20 -20
  155. mindspore/nn/loss/loss.py +79 -81
  156. mindspore/nn/optim/adam.py +3 -3
  157. mindspore/nn/optim/adasum.py +2 -2
  158. mindspore/nn/optim/asgd.py +2 -0
  159. mindspore/nn/optim/optimizer.py +1 -1
  160. mindspore/nn/optim/thor.py +2 -2
  161. mindspore/nn/probability/distribution/exponential.py +2 -1
  162. mindspore/nn/probability/distribution/poisson.py +2 -1
  163. mindspore/nn/sparse/sparse.py +3 -3
  164. mindspore/nn/wrap/cell_wrapper.py +34 -37
  165. mindspore/nn/wrap/grad_reducer.py +37 -37
  166. mindspore/nn/wrap/loss_scale.py +72 -74
  167. mindspore/numpy/array_creations.py +5 -5
  168. mindspore/numpy/fft.py +1 -1
  169. mindspore/numpy/math_ops.py +5 -5
  170. mindspore/opencv_core452.dll +0 -0
  171. mindspore/opencv_imgcodecs452.dll +0 -0
  172. mindspore/opencv_imgproc452.dll +0 -0
  173. mindspore/ops/_grad_experimental/grad_comm_ops.py +51 -13
  174. mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -0
  175. mindspore/ops/_vmap/vmap_array_ops.py +31 -13
  176. mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
  177. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +42 -11
  178. mindspore/ops/auto_generate/gen_extend_func.py +23 -141
  179. mindspore/ops/auto_generate/gen_ops_def.py +727 -321
  180. mindspore/ops/auto_generate/gen_ops_prim.py +1721 -984
  181. mindspore/ops/auto_generate/pyboost_inner_prim.py +31 -1
  182. mindspore/ops/composite/__init__.py +10 -0
  183. mindspore/ops/composite/base.py +8 -4
  184. mindspore/ops/composite/multitype_ops/__init__.py +12 -1
  185. mindspore/ops/composite/multitype_ops/_compile_utils.py +133 -109
  186. mindspore/ops/composite/multitype_ops/add_impl.py +70 -2
  187. mindspore/ops/composite/multitype_ops/div_impl.py +49 -0
  188. mindspore/ops/composite/multitype_ops/floordiv_impl.py +29 -0
  189. mindspore/ops/composite/multitype_ops/getitem_impl.py +11 -0
  190. mindspore/ops/composite/multitype_ops/mod_impl.py +5 -3
  191. mindspore/ops/composite/multitype_ops/mul_impl.py +49 -0
  192. mindspore/ops/composite/multitype_ops/setitem_impl.py +57 -0
  193. mindspore/ops/composite/multitype_ops/sub_impl.py +34 -0
  194. mindspore/ops/composite/multitype_ops/zeros_like_impl.py +14 -0
  195. mindspore/ops/function/__init__.py +3 -1
  196. mindspore/ops/function/_add_attr_func.py +11 -6
  197. mindspore/ops/function/array_func.py +9 -96
  198. mindspore/ops/function/debug_func.py +4 -3
  199. mindspore/ops/function/grad/grad_func.py +1 -1
  200. mindspore/ops/function/math_func.py +33 -540
  201. mindspore/ops/function/nn_func.py +28 -74
  202. mindspore/ops/function/other_func.py +4 -1
  203. mindspore/ops/function/random_func.py +44 -5
  204. mindspore/ops/function/vmap_func.py +2 -1
  205. mindspore/ops/functional.py +2 -3
  206. mindspore/ops/functional_overload.py +571 -6
  207. mindspore/ops/op_info_register.py +21 -0
  208. mindspore/ops/operations/__init__.py +16 -11
  209. mindspore/ops/operations/_custom_ops_utils.py +689 -34
  210. mindspore/ops/operations/_inner_ops.py +3 -6
  211. mindspore/ops/operations/_sequence_ops.py +1 -1
  212. mindspore/ops/operations/array_ops.py +2 -2
  213. mindspore/ops/operations/comm_ops.py +185 -26
  214. mindspore/ops/operations/custom_ops.py +294 -174
  215. mindspore/ops/operations/debug_ops.py +59 -4
  216. mindspore/ops/operations/image_ops.py +13 -13
  217. mindspore/ops/operations/manually_defined/ops_def.py +15 -16
  218. mindspore/ops/operations/math_ops.py +3 -4
  219. mindspore/ops/operations/nn_ops.py +7 -39
  220. mindspore/ops/primitive.py +6 -10
  221. mindspore/ops/tensor_method.py +47 -8
  222. mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +1 -1
  223. mindspore/ops_generate/api/functional_map_cpp_generator.py +10 -9
  224. mindspore/ops_generate/api/functions_cc_generator.py +58 -10
  225. mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +1 -1
  226. mindspore/ops_generate/common/base_generator.py +14 -0
  227. mindspore/ops_generate/common/gen_constants.py +8 -3
  228. mindspore/ops_generate/common/gen_utils.py +0 -19
  229. mindspore/ops_generate/common/op_proto.py +11 -4
  230. mindspore/ops_generate/common/template.py +88 -11
  231. mindspore/ops_generate/gen_ops.py +1 -1
  232. mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +4 -4
  233. mindspore/ops_generate/op_def/ops_def_cc_generator.py +0 -3
  234. mindspore/ops_generate/op_def/ops_name_h_generator.py +0 -3
  235. mindspore/ops_generate/op_def/ops_primitive_h_generator.py +0 -4
  236. mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -2
  237. mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +49 -8
  238. mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +2 -2
  239. mindspore/ops_generate/pyboost/gen_pyboost_func.py +31 -0
  240. mindspore/ops_generate/pyboost/op_template_parser.py +98 -72
  241. mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +70 -273
  242. mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +14 -6
  243. mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +316 -0
  244. mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +1 -1
  245. mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +5 -3
  246. mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +1 -1
  247. mindspore/ops_generate/pyboost/pyboost_internal_functions_cpp_generator.py +76 -0
  248. mindspore/ops_generate/pyboost/pyboost_internal_functions_h_generator.py +76 -0
  249. mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +125 -0
  250. mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +4 -3
  251. mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +348 -61
  252. mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +1 -1
  253. mindspore/ops_generate/pyboost/pyboost_utils.py +118 -9
  254. mindspore/ops_generate/tensor_py_cc_generator.py +1 -24
  255. mindspore/parallel/_auto_parallel_context.py +11 -8
  256. mindspore/parallel/_cell_wrapper.py +113 -45
  257. mindspore/parallel/_parallel_serialization.py +1 -1
  258. mindspore/parallel/_ps_context.py +4 -6
  259. mindspore/parallel/_tensor.py +167 -12
  260. mindspore/parallel/_transformer/moe.py +1 -1
  261. mindspore/parallel/_transformer/transformer.py +13 -8
  262. mindspore/parallel/auto_parallel.py +14 -7
  263. mindspore/parallel/checkpoint_convert.py +3 -3
  264. mindspore/parallel/checkpoint_transform.py +11 -7
  265. mindspore/parallel/cluster/process_entity/_api.py +84 -48
  266. mindspore/parallel/cluster/process_entity/_utils.py +95 -7
  267. mindspore/parallel/cluster/run.py +43 -4
  268. mindspore/parallel/function/__init__.py +8 -1
  269. mindspore/parallel/function/reshard_func.py +6 -7
  270. mindspore/parallel/nn/__init__.py +15 -2
  271. mindspore/parallel/nn/parallel_cell_wrapper.py +9 -10
  272. mindspore/parallel/nn/parallel_grad_reducer.py +7 -6
  273. mindspore/parallel/shard.py +3 -4
  274. mindspore/parallel/transform_safetensors.py +463 -174
  275. mindspore/pgodb140.dll +0 -0
  276. mindspore/pgort140.dll +0 -0
  277. mindspore/profiler/__init__.py +2 -1
  278. mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +7 -7
  279. mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +3 -0
  280. mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +12 -6
  281. mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +3 -3
  282. mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +3 -3
  283. mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +4 -4
  284. mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +3 -3
  285. mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +4 -1
  286. mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +2 -1
  287. mindspore/profiler/analysis/task_manager.py +1 -1
  288. mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +5 -1
  289. mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +2 -1
  290. mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +42 -22
  291. mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +3 -2
  292. mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +9 -5
  293. mindspore/profiler/analysis/viewer/ms_operator_details_viewer.py +132 -0
  294. mindspore/profiler/common/constant.py +16 -0
  295. mindspore/profiler/common/profiler_context.py +25 -27
  296. mindspore/profiler/common/profiler_info.py +0 -16
  297. mindspore/profiler/common/profiler_op_analyse.py +235 -0
  298. mindspore/profiler/common/profiler_output_path.py +23 -8
  299. mindspore/profiler/common/profiler_parameters.py +128 -35
  300. mindspore/profiler/dynamic_profile/__init__.py +0 -0
  301. mindspore/profiler/dynamic_profile/dynamic_monitor_proxy.py +39 -0
  302. mindspore/profiler/dynamic_profile/dynamic_profiler_config_context.py +666 -0
  303. mindspore/profiler/dynamic_profile/dynamic_profiler_utils.py +62 -0
  304. mindspore/profiler/dynamic_profiler.py +305 -314
  305. mindspore/profiler/envprofiler.py +12 -7
  306. mindspore/profiler/experimental_config.py +96 -6
  307. mindspore/profiler/mstx.py +33 -12
  308. mindspore/profiler/platform/__init__.py +2 -3
  309. mindspore/profiler/platform/npu_profiler.py +29 -19
  310. mindspore/profiler/profiler.py +35 -19
  311. mindspore/profiler/profiler_action_controller.py +64 -76
  312. mindspore/profiler/schedule.py +10 -4
  313. mindspore/rewrite/common/config.py +1 -0
  314. mindspore/rewrite/common/namer.py +1 -0
  315. mindspore/rewrite/common/namespace.py +1 -0
  316. mindspore/rewrite/node/node.py +31 -11
  317. mindspore/rewrite/parsers/assign_parser.py +1 -1
  318. mindspore/rewrite/symbol_tree/symbol_tree.py +1 -1
  319. mindspore/run_check/_check_version.py +7 -10
  320. mindspore/runtime/__init__.py +5 -5
  321. mindspore/runtime/event.py +10 -4
  322. mindspore/runtime/executor.py +60 -45
  323. mindspore/runtime/memory.py +30 -32
  324. mindspore/runtime/thread_bind_core.py +298 -164
  325. mindspore/safeguard/rewrite_obfuscation.py +12 -13
  326. mindspore/swresample-4.dll +0 -0
  327. mindspore/swscale-6.dll +0 -0
  328. mindspore/tbbmalloc.dll +0 -0
  329. mindspore/tinyxml2.dll +0 -0
  330. mindspore/train/_utils.py +14 -4
  331. mindspore/train/amp.py +43 -20
  332. mindspore/train/callback/__init__.py +5 -5
  333. mindspore/train/callback/_checkpoint.py +3 -6
  334. mindspore/train/callback/_flops_collector.py +1 -1
  335. mindspore/train/callback/_landscape.py +0 -1
  336. mindspore/train/callback/_train_fault_tolerance.py +97 -16
  337. mindspore/train/data_sink.py +11 -2
  338. mindspore/train/dataset_helper.py +9 -0
  339. mindspore/train/model.py +135 -55
  340. mindspore/train/serialization.py +133 -111
  341. mindspore/train/summary/summary_record.py +13 -2
  342. mindspore/turbojpeg.dll +0 -0
  343. mindspore/utils/__init__.py +3 -2
  344. mindspore/utils/dryrun.py +0 -6
  345. mindspore/utils/runtime_execution_order_check.py +163 -77
  346. mindspore/utils/sdc_detect.py +68 -0
  347. mindspore/utils/utils.py +6 -9
  348. mindspore/vcmeta.dll +0 -0
  349. mindspore/vcruntime140.dll +0 -0
  350. mindspore/vcruntime140_1.dll +0 -0
  351. mindspore/version.py +1 -1
  352. {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0rc1.dist-info}/METADATA +5 -4
  353. {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0rc1.dist-info}/RECORD +356 -394
  354. mindspore/_deprecated/jit.py +0 -198
  355. mindspore/experimental/es/__init__.py +0 -22
  356. mindspore/experimental/es/embedding_service.py +0 -891
  357. mindspore/experimental/es/embedding_service_layer.py +0 -581
  358. mindspore/profiler/parser/__init__.py +0 -14
  359. mindspore/profiler/parser/aicpu_data_parser.py +0 -272
  360. mindspore/profiler/parser/ascend_analysis/__init__.py +0 -14
  361. mindspore/profiler/parser/ascend_analysis/constant.py +0 -71
  362. mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -180
  363. mindspore/profiler/parser/ascend_analysis/function_event.py +0 -185
  364. mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +0 -136
  365. mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +0 -131
  366. mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +0 -104
  367. mindspore/profiler/parser/ascend_analysis/path_manager.py +0 -313
  368. mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +0 -123
  369. mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +0 -86
  370. mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +0 -75
  371. mindspore/profiler/parser/ascend_cluster_generator.py +0 -116
  372. mindspore/profiler/parser/ascend_communicate_generator.py +0 -314
  373. mindspore/profiler/parser/ascend_flops_generator.py +0 -116
  374. mindspore/profiler/parser/ascend_fpbp_generator.py +0 -82
  375. mindspore/profiler/parser/ascend_hccl_generator.py +0 -271
  376. mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
  377. mindspore/profiler/parser/ascend_memory_generator.py +0 -185
  378. mindspore/profiler/parser/ascend_msprof_exporter.py +0 -282
  379. mindspore/profiler/parser/ascend_msprof_generator.py +0 -187
  380. mindspore/profiler/parser/ascend_op_generator.py +0 -334
  381. mindspore/profiler/parser/ascend_steptrace_generator.py +0 -94
  382. mindspore/profiler/parser/ascend_timeline_generator.py +0 -545
  383. mindspore/profiler/parser/base_timeline_generator.py +0 -483
  384. mindspore/profiler/parser/container.py +0 -229
  385. mindspore/profiler/parser/cpu_gpu_timeline_generator.py +0 -697
  386. mindspore/profiler/parser/flops_parser.py +0 -531
  387. mindspore/profiler/parser/framework_enum.py +0 -111
  388. mindspore/profiler/parser/framework_parser.py +0 -464
  389. mindspore/profiler/parser/framework_struct.py +0 -61
  390. mindspore/profiler/parser/gpu_analysis/__init__.py +0 -14
  391. mindspore/profiler/parser/gpu_analysis/function_event.py +0 -44
  392. mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +0 -89
  393. mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +0 -72
  394. mindspore/profiler/parser/hccl_parser.py +0 -573
  395. mindspore/profiler/parser/hwts_log_parser.py +0 -122
  396. mindspore/profiler/parser/integrator.py +0 -526
  397. mindspore/profiler/parser/memory_usage_parser.py +0 -277
  398. mindspore/profiler/parser/minddata_analyzer.py +0 -800
  399. mindspore/profiler/parser/minddata_parser.py +0 -186
  400. mindspore/profiler/parser/minddata_pipeline_parser.py +0 -299
  401. mindspore/profiler/parser/op_intermediate_parser.py +0 -149
  402. mindspore/profiler/parser/optime_parser.py +0 -250
  403. mindspore/profiler/parser/profiler_info.py +0 -213
  404. mindspore/profiler/parser/step_trace_parser.py +0 -666
  405. {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0rc1.dist-info}/WHEEL +0 -0
  406. {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0rc1.dist-info}/entry_points.txt +0 -0
  407. {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0rc1.dist-info}/top_level.txt +0 -0
@@ -31,7 +31,8 @@ from mindspore.profiler.common.constant import (
31
31
  ProfilerLevel,
32
32
  ProfilerActivity,
33
33
  AicoreMetrics,
34
- ExportType
34
+ ExportType,
35
+ HostSystem
35
36
  )
36
37
  from mindspore.profiler.common.profiler_output_path import ProfilerOutputPath
37
38
  from mindspore.profiler.common.profiler_parameters import ProfilerParameters
@@ -62,12 +63,11 @@ class ProfilerContext:
62
63
  self._profiler_path_mgr: ProfilerOutputPath = None
63
64
  self._on_trace_ready_output_path = None
64
65
  self._jit_level: Optional[str] = ""
65
- self._context_mode: Optional[int] = -1
66
66
 
67
67
  self._init_device_target()
68
68
  self._init_device_id()
69
69
  self._init_rank_id()
70
- self._init_context_mode()
70
+ self._init_jit_level()
71
71
 
72
72
  def set_params(self, **kwargs):
73
73
  """
@@ -83,9 +83,7 @@ class ProfilerContext:
83
83
  kwargs["output_path"] = final_path
84
84
 
85
85
  self._profiler_params_mgr: ProfilerParameters = ProfilerParameters(**kwargs)
86
- self._profiler_path_mgr: ProfilerOutputPath = ProfilerOutputPath(
87
- device_id=int(self._device_id), rank_id=int(self._rank_id)
88
- )
86
+ self._profiler_path_mgr: ProfilerOutputPath = ProfilerOutputPath(rank_id=int(self._rank_id))
89
87
 
90
88
  self._profiler_path_mgr.output_path = self._profiler_params_mgr.output_path
91
89
 
@@ -113,7 +111,6 @@ class ProfilerContext:
113
111
  "step_list": self._step_list,
114
112
  "mode": self._mode,
115
113
  "jit_level": self._jit_level,
116
- "context_mode": self._context_mode
117
114
  }
118
115
 
119
116
  def load_offline_profiler_params(self, profiler_parameters: Dict[str, Any]) -> None:
@@ -133,6 +130,8 @@ class ProfilerContext:
133
130
  value = [ProfilerActivity(activity) for activity in profiler_parameters[param]]
134
131
  elif param == "export_type":
135
132
  value = [ExportType(export_type) for export_type in profiler_parameters[param]]
133
+ elif param == "host_sys":
134
+ value = [HostSystem(host_sys) for host_sys in profiler_parameters[param]]
136
135
  elif param == "schedule":
137
136
  continue
138
137
  else:
@@ -290,6 +289,16 @@ class ProfilerContext:
290
289
  """Get the mstx from ProfilerParameters."""
291
290
  return self._profiler_params_mgr.mstx
292
291
 
292
+ @property
293
+ def mstx_domain_include(self) -> List[str]:
294
+ """Get the mstx domain include from ProfilerParameters."""
295
+ return self._profiler_params_mgr.mstx_domain_include
296
+
297
+ @property
298
+ def mstx_domain_exclude(self) -> List[str]:
299
+ """Get the mstx domain exclude from ProfilerParameters."""
300
+ return self._profiler_params_mgr.mstx_domain_exclude
301
+
293
302
  @property
294
303
  def data_simplification(self) -> bool:
295
304
  """Get the data simplification from ProfilerParameters."""
@@ -304,6 +313,11 @@ class ProfilerContext:
304
313
  value = True
305
314
  self._profiler_params_mgr.data_simplification = value
306
315
 
316
+ @property
317
+ def record_shapes(self) -> bool:
318
+ """Get the record shapes from ProfilerParameters."""
319
+ return self._profiler_params_mgr.record_shapes
320
+
307
321
  @property
308
322
  def device_target(self) -> str:
309
323
  """Get device target."""
@@ -419,19 +433,6 @@ class ProfilerContext:
419
433
  """Get the is set schedule from ProfilerParameters."""
420
434
  return self._profiler_params_mgr.is_set_schedule
421
435
 
422
- @property
423
- def context_mode(self) -> int:
424
- return self._context_mode
425
-
426
- @context_mode.setter
427
- def context_mode(self, value: int) -> None:
428
- """Set context mode value."""
429
- if not isinstance(value, int):
430
- logger.warning(f"For profiler, the parameter context_mode must be int, "
431
- f"but got {type(value)}, reset to -1.")
432
- value = -1
433
- self._context_mode = value
434
-
435
436
  @property
436
437
  def jit_level(self) -> str:
437
438
  return self._jit_level
@@ -488,13 +489,10 @@ class ProfilerContext:
488
489
  if not self._rank_id or not self._rank_id.isdigit():
489
490
  self._rank_id = "0"
490
491
 
491
- def _init_context_mode(self):
492
+ def _init_jit_level(self):
492
493
  """
493
494
  Initialize the jit level.
494
495
  """
495
- if context.get_context("mode") == context.GRAPH_MODE:
496
- jit_config = context.get_jit_config()
497
- self._jit_level = jit_config.get("jit_level", "")
498
- ProfilerInfo().jit_level = self._jit_level
499
- ProfilerInfo().context_mode = context.get_context("mode")
500
- self._context_mode = context.get_context("mode")
496
+ jit_config = context.get_jit_config()
497
+ self._jit_level = jit_config.get("jit_level", "")
498
+ ProfilerInfo().jit_level = self._jit_level
@@ -64,7 +64,6 @@ class ProfilerInfo:
64
64
  ANALYSIS_COST_TIME = "analysis_cost_time"
65
65
  MS_VERSION = "ms_version"
66
66
  CANN_VERSION = "cann_version"
67
- CONTEXT_MODE = "context_mode"
68
67
  JIT_LEVEL = "jit_level"
69
68
 
70
69
  US_TO_NS = 1000
@@ -77,7 +76,6 @@ class ProfilerInfo:
77
76
  self.ANALYSIS_COST_TIME: {},
78
77
  self.MS_VERSION: ms_version,
79
78
  self.CANN_VERSION: get_cann_version(),
80
- self.CONTEXT_MODE: -1,
81
79
  self.JIT_LEVEL: "",
82
80
  }
83
81
  # time params
@@ -132,20 +130,6 @@ class ProfilerInfo:
132
130
  """
133
131
  self._profiler_info[self.PROFILER_PARAMETERS] = value
134
132
 
135
- @property
136
- def context_mode(self) -> int:
137
- """
138
- Get context mode.
139
- """
140
- return self._profiler_info[self.CONTEXT_MODE]
141
-
142
- @context_mode.setter
143
- def context_mode(self, value: int):
144
- """
145
- Set context mode.
146
- """
147
- self._profiler_info[self.CONTEXT_MODE] = value
148
-
149
133
  @property
150
134
  def jit_level(self) -> str:
151
135
  """
@@ -0,0 +1,235 @@
1
+ # Copyright 2024-2025 Huawei Technologies Co., Ltd
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ # ============================================================================
15
+ """The OpAnalyser."""
16
+ import json
17
+ import os
18
+ from collections import defaultdict
19
+ from mindspore.profiler.common.validator.validate_path import validate_and_normalize_path
20
+
21
+
22
+ class OpAnalyser:
23
+ """
24
+ The parser for parsing framework files.
25
+
26
+ Note:
27
+ This parser only supports CPU and GPU devices.
28
+
29
+ Args:
30
+ output_path (str): The profiling path which should contain GPU profiling data.
31
+ dev_id (str): The device ID.
32
+ """
33
+
34
+ def __init__(self, output_path, dev_id, op_names=None):
35
+ """The parser for parsing framework files."""
36
+ self._dev_id = dev_id
37
+ self._output_path = output_path
38
+ self.op_names = op_names
39
+ self.op_name = ''
40
+ self.framework_list = []
41
+ self.op_detail = {}
42
+ self.operation_info = {}
43
+ self.activity_info_dir = []
44
+ self.framework_info_dir = []
45
+ self.cpu_detail_info_dir = []
46
+ self.gpu_op_type_info_dir = []
47
+ self.op_execute_times = {}
48
+ self.op_step_shape_info = defaultdict(list)
49
+
50
+ def parse(self):
51
+ """Parse op performance data."""
52
+ self.get_device_target_filename()
53
+ self.get_framework_summary()
54
+ self.get_cpu_op_detail_info()
55
+ self.get_activity_op_info()
56
+ if isinstance(self.op_names, str):
57
+ self.combine_performance_data(self.op_names)
58
+ elif isinstance(self.op_names, list):
59
+ for op_name in self.op_names:
60
+ self.combine_performance_data(op_name)
61
+ self.operation_info["device_id"] = self._dev_id
62
+ return json.dumps(self.operation_info)
63
+
64
+ def get_framework_summary(self):
65
+ """Get framework data."""
66
+ for filename in self.framework_info_dir:
67
+ op_side = filename.split('_')[0]
68
+ framework_file_path = os.path.join(self._output_path, filename)
69
+ framework_file_path = validate_and_normalize_path(framework_file_path)
70
+ with open(framework_file_path, 'r') as f_obj:
71
+ framework_info = f_obj.readlines()
72
+ for line_info in framework_info:
73
+ line_info = line_info.strip(' ').strip('\n').split(';')
74
+ # line_info[0]: op_type, line_info[1]: op_name, line_info[2]: graph_id, line_info[3]: input_shape;
75
+ input_shape = line_info[3:]
76
+ item = [line_info[0], line_info[1], input_shape, op_side]
77
+ if not self.op_step_shape_info.get(line_info[1]):
78
+ self.op_step_shape_info[line_info[1]].append(op_side)
79
+ self.op_step_shape_info[line_info[1]].append(input_shape)
80
+ if item not in self.framework_list:
81
+ self.framework_list.append(item)
82
+
83
+ def get_cpu_op_detail_info(self):
84
+ """Get cpu operators detail data."""
85
+ for filename in self.cpu_detail_info_dir:
86
+ op_side = filename.split('_')[0]
87
+ op_detail_file_path = os.path.join(self._output_path, filename)
88
+ op_detail_file_path = validate_and_normalize_path(op_detail_file_path)
89
+ with open(op_detail_file_path, 'r') as f_obj:
90
+ op_detail_info = f_obj.readlines()
91
+ for line_info in op_detail_info[1:]:
92
+ line_info = line_info.strip(' ').strip('\n').split(',')
93
+ if not self.op_detail.get(line_info[2]):
94
+ # line_info[4]: op_occurrences, line_info[5]: op_detail_time(us), line_info[6]: op_avg_time(us);
95
+ self.op_detail[line_info[2]] = [float(line_info[4]), float(line_info[5]),
96
+ float(line_info[6]), op_side]
97
+
98
+ def get_execute_times(self):
99
+ """Get gpu operators execute times."""
100
+ if self.gpu_op_type_info_dir:
101
+ gpu_op_type_file_path = os.path.join(self._output_path, self.gpu_op_type_info_dir[0])
102
+ gpu_op_type_file_path = validate_and_normalize_path(gpu_op_type_file_path)
103
+ with open(gpu_op_type_file_path, 'r') as fp:
104
+ op_type_info = fp.readlines()
105
+ for line_info in op_type_info[1:]:
106
+ line_info = line_info.strip(' ').strip('\n').split(',')
107
+ self.op_execute_times[line_info[0]] = line_info[1]
108
+
109
+ def get_activity_op_info(self):
110
+ """Get op detail data."""
111
+ all_file = os.listdir(self._output_path)
112
+ for file_name in all_file:
113
+ if file_name.startswith('gpu_op_type') and file_name.endswith(f'{self._dev_id}.csv'):
114
+ self.gpu_op_type_info_dir.append(file_name)
115
+ if not self.gpu_op_type_info_dir and self.activity_info_dir:
116
+ raise RuntimeError(f'The output file <%s> is not found.' % self.gpu_op_type_info_dir)
117
+ self.get_execute_times()
118
+ for filename in self.activity_info_dir:
119
+ op_side = filename.split('_')[0]
120
+ activity_file_path = os.path.join(self._output_path, filename)
121
+ activity_file_path = validate_and_normalize_path(activity_file_path)
122
+ with open(activity_file_path, 'r') as file:
123
+ activity_info = file.readlines()
124
+ for line_info in activity_info[1:]:
125
+ line_info = line_info.strip(' ').strip('\n').replace(', ', ';').split(',')
126
+ op_name = line_info[2].split('/')[-1]
127
+ # op_name: xxx-opx
128
+ op_type = op_name.split('-')[0]
129
+ op_value = self.op_execute_times.get(op_type)
130
+ if op_value is not None and op_value != '':
131
+ try:
132
+ op_occurrences = int(op_value)
133
+ except (ValueError, TypeError):
134
+ op_occurrences = 1
135
+ else:
136
+ op_occurrences = 1
137
+
138
+ op_total_time = float(line_info[-4])
139
+ if not self.op_detail.get(op_name):
140
+ # line_info[4]: op_occurrences, line_info[5]: op_detail_time(us), line_info[6]: op_avg_time(us);
141
+ if op_occurrences > 0:
142
+ avg_time = round(op_total_time / op_occurrences, 4)
143
+ else:
144
+ avg_time = 0
145
+ self.op_detail[op_name] = [
146
+ op_occurrences, op_total_time, avg_time, op_side
147
+ ]
148
+ else:
149
+ self.op_detail.get(op_name)[1] += op_total_time
150
+ self.op_detail.get(op_name)[2] = self.op_detail.get(op_name)[1] / self.op_detail.get(op_name)[0]
151
+ self.op_detail[op_name] = [
152
+ self.op_detail.get(op_name)[0],
153
+ round(self.op_detail.get(op_name)[1], 4),
154
+ round(self.op_detail.get(op_name)[2], 4), op_side
155
+ ]
156
+
157
+ def combine_performance_data(self, op_name):
158
+ """Combine operator detail info with framework info."""
159
+ unique_op_info = []
160
+ op_shape_dict = {}
161
+ operation_info = {}
162
+ factor = 1000 # convert time unit from ms to us.
163
+ for line_info in self.framework_list:
164
+ op_detail = self.op_detail.get(line_info[1])
165
+ if not op_detail:
166
+ continue
167
+ if op_name in line_info and line_info[3] == op_detail[3]:
168
+ op_side = line_info[3]
169
+ op_shape = '[{}]{}'.format(op_side, ','.join(line_info[2]))
170
+ op_occurrences = int(op_detail[0])
171
+ op_total_time = float(op_detail[1])
172
+ op_avg_time = float(op_detail[2])
173
+ if op_shape in op_shape_dict:
174
+ # Classify according to the operator information of the same shape.
175
+ op_shape_dict.get(op_shape)[0] += op_occurrences
176
+ op_shape_dict.get(op_shape)[1] += op_total_time
177
+ if op_shape_dict.get(op_shape)[0] > 0:
178
+ op_shape_dict.get(op_shape)[2] = op_shape_dict.get(op_shape)[1] / op_shape_dict.get(op_shape)[0]
179
+ else:
180
+ op_shape_dict.get(op_shape)[2] = 0
181
+ op_shape_dict[op_shape] = [
182
+ op_shape_dict.get(op_shape)[0], round(op_shape_dict.get(op_shape)[1], 4),
183
+ round(op_shape_dict.get(op_shape)[2], 4), op_side
184
+ ]
185
+ else:
186
+ op_shape_dict[op_shape] = [op_occurrences, op_total_time, op_avg_time, op_side]
187
+
188
+ for input_shape in op_shape_dict:
189
+ # 0: op_occurrences, 1: op_total_time, 2: op_avg_time, 3: op_side
190
+ operation_info['op_side'] = op_shape_dict.get(input_shape)[3]
191
+ operation_info['input_shape'] = input_shape.strip('[').split(']')[-1]
192
+ operation_info['op_occurrences'] = op_shape_dict.get(input_shape)[0]
193
+ if operation_info.get('op_side') == 'cpu':
194
+ operation_info['op_total_time(us)'] = round(op_shape_dict.get(input_shape)[1] * factor, 4)
195
+ operation_info['op_avg_time(us)'] = round(op_shape_dict.get(input_shape)[2] * factor, 4)
196
+ else:
197
+ operation_info['op_total_time(us)'] = op_shape_dict.get(input_shape)[1]
198
+ operation_info['op_avg_time(us)'] = op_shape_dict.get(input_shape)[2]
199
+ unique_op_info.append(operation_info)
200
+ operation_info = dict()
201
+
202
+ if unique_op_info:
203
+ self.operation_info[op_name] = unique_op_info
204
+ else:
205
+ raise RuntimeError(f'The information of <{op_name}> is not found. Please verify that the operator name is'
206
+ f' correct or the operator is used in the network.')
207
+
208
+ def get_device_target_filename(self):
209
+ """Get device target filename."""
210
+ gpu_framework_file = f'gpu_framework_{self._dev_id}.txt'
211
+ cpu_framework_file = f'cpu_framework_{self._dev_id}.txt'
212
+ gpu_activity_file = f'gpu_activity_data_{self._dev_id}.csv'
213
+ cpu_op_detail_file = f'cpu_op_detail_info_{self._dev_id}.csv'
214
+ all_file = os.listdir(self._output_path)
215
+ if not all_file:
216
+ raise RuntimeError(f'No profiler file is found in the path <%s>. '
217
+ f'Check whether the profiler path is correct.' % self._output_path)
218
+ if gpu_activity_file in all_file and gpu_framework_file not in all_file:
219
+ raise RuntimeError(f'The output file <%s> is not found.' % gpu_framework_file)
220
+ if cpu_op_detail_file in all_file and cpu_framework_file not in all_file:
221
+ raise RuntimeError(f'The output file <%s> is not found.' % cpu_framework_file)
222
+ if gpu_framework_file in all_file and gpu_activity_file not in all_file:
223
+ raise RuntimeError(f'The output file <%s> is not found.' % gpu_activity_file)
224
+ if cpu_framework_file in all_file and cpu_op_detail_file not in all_file:
225
+ raise RuntimeError(f'The output file <%s> is not found.' % cpu_op_detail_file)
226
+ if gpu_activity_file not in all_file and cpu_op_detail_file not in all_file:
227
+ raise RuntimeError(f'The profiling data of this card which device_id is equal to {self._dev_id} does not'
228
+ f' exist. Check whether device_id is correct.')
229
+ for file_name in all_file:
230
+ if file_name.endswith(f'activity_data_{self._dev_id}.csv'):
231
+ self.activity_info_dir.append(file_name)
232
+ if file_name.endswith(f'framework_{self._dev_id}.txt'):
233
+ self.framework_info_dir.append(file_name)
234
+ if file_name.startswith('cpu_op_detail') and file_name.endswith(f'{self._dev_id}.csv'):
235
+ self.cpu_detail_info_dir.append(file_name)
@@ -14,7 +14,10 @@
14
14
  # ============================================================================
15
15
  """Profiler output path"""
16
16
  import os
17
+ import glob
18
+ import re
17
19
  from typing import Any, Dict, Optional
20
+ from mindspore import log as logger
18
21
  from mindspore.profiler.common.path_manager import PathManager
19
22
 
20
23
 
@@ -49,12 +52,9 @@ class ProfilerOutputPath:
49
52
  _MINISTUDIO_PROFILER_OUTPUT = "mindstudio_profiler_output"
50
53
  _MINISTUDIO_ANALYZE_OUTPUT = "analyze"
51
54
 
52
- def __init__(self, rank_id: int, device_id: int):
53
- if not isinstance(rank_id, int) or not isinstance(device_id, int):
54
- raise ValueError("rank_id and device_id must be integers")
55
+ def __init__(self, rank_id: int):
55
56
 
56
57
  self._rank_id = rank_id
57
- self._device_id = device_id
58
58
  self._output_path: Optional[str] = None
59
59
  self._ascend_ms_dir: Optional[str] = None
60
60
  self._ascend_profiler_output_path: Optional[str] = None
@@ -269,10 +269,25 @@ class ProfilerOutputPath:
269
269
  self._msprof_profile_host_path = os.path.join(
270
270
  self._msprof_profile_path, ProfilerOutputPath._MINISTUDIO_PROFILER_HOST
271
271
  )
272
- self._msprof_profile_device_path = os.path.join(
273
- self._msprof_profile_path,
274
- ProfilerOutputPath._MINISTUDIO_PROFILER_DEVICE.format(self._device_id)
275
- )
272
+
273
+ device_pattern = os.path.join(self._msprof_profile_path, "device_*")
274
+ device_dirs = glob.glob(device_pattern)
275
+ valid_device_dirs = [d for d in device_dirs if re.match(r'^device_\d+$', os.path.basename(d))]
276
+
277
+ if valid_device_dirs:
278
+ device_dir = os.path.basename(valid_device_dirs[0])
279
+ device_id = device_dir.replace("device_", "")
280
+ self._msprof_profile_device_path = os.path.join(
281
+ self._msprof_profile_path,
282
+ ProfilerOutputPath._MINISTUDIO_PROFILER_DEVICE.format(device_id)
283
+ )
284
+ else:
285
+ logger.error(f"No device_* directory found in {self._msprof_profile_path}, using device_0 as default")
286
+ self._msprof_profile_device_path = os.path.join(
287
+ self._msprof_profile_path,
288
+ ProfilerOutputPath._MINISTUDIO_PROFILER_DEVICE.format("0")
289
+ )
290
+
276
291
  self._msprof_profile_log_path = os.path.join(
277
292
  self._msprof_profile_path, ProfilerOutputPath._MINISTUDIO_PROFILER_LOG
278
293
  )