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
@@ -1,122 +0,0 @@
1
- # Copyright 2020 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 parser for hwts log file."""
16
- import os
17
- import struct
18
- from mindspore.profiler.common.util import fwrite_format, get_file_join_name
19
- from mindspore import log as logger
20
- from mindspore.profiler.common.validator.validate_path import \
21
- validate_and_normalize_path
22
-
23
-
24
- class HWTSLogParser:
25
- """
26
- The Parser for hwts log files.
27
-
28
- Args:
29
- input_path (str): The profiling job path. Such as: '/var/log/npu/profiling/JOBAIFGJEJFEDCBAEADIFJAAAAAAAAAA".
30
- output_filename (str): The output data path and name. Such as: './output_format_data_hwts_0.txt'.
31
- """
32
-
33
- GRAPH_MODE_MAX_TASKID = 65000
34
- _source_file_target_old = 'hwts.log.data.45.dev.profiler_default_tag'
35
- _source_file_target = 'hwts.data.'
36
- _dst_file_title = 'title:45 HWTS data'
37
- _dst_file_column_title = 'Type cnt Core_ID Block_ID Task_ID Cycle_counter Stream_ID'
38
-
39
- def __init__(self, input_path, output_filename, dynamic_status):
40
- self._input_path = input_path
41
- self._output_filename = output_filename
42
- self._source_flie_name = self._get_source_file()
43
- self._dynamic_status = dynamic_status
44
-
45
- def execute(self):
46
- """
47
- Execute the parser, get result data, and write it to the output file.
48
-
49
- Returns:
50
- bool, whether succeed to analyse hwts log.
51
- """
52
-
53
- content_format = ['QIIIIIIIIIIII', 'QIIQIIIIIIII', 'IIIIQIIIIIIII']
54
- log_type = ['Start of task', 'End of task', 'Start of block', 'End of block', 'Block PMU']
55
- result_data = ""
56
- flip_times = 0
57
- last_task_stream_map = {}
58
- task_id_threshold = 65536
59
-
60
- self._source_flie_name = validate_and_normalize_path(self._source_flie_name)
61
- with open(self._source_flie_name, 'rb') as hwts_data:
62
- while True:
63
- line = hwts_data.read(64)
64
- if not line:
65
- break
66
- if not line.strip():
67
- continue
68
- if len(line) < 64:
69
- logger.error("Length of hwts data is less than 64, it is %s", len(line))
70
- continue
71
- byte_first_four = struct.unpack('BBHHH', line[0:8])
72
- byte_first = bin(byte_first_four[0]).replace('0b', '').zfill(8)
73
- ms_type, is_warn_res0_ov = byte_first[-3:], byte_first[4]
74
- cnt, core_id = int(byte_first[0:4], 2), byte_first_four[1]
75
- blk_id, task_id = byte_first_four[3], int(byte_first_four[4])
76
- if ms_type in ['000', '001', '010']: # log type 0,1,2
77
- result = struct.unpack(content_format[0], line[8:])
78
- syscnt = result[0]
79
- stream_id = result[1]
80
- elif ms_type == '011': # log type 3
81
- result = struct.unpack(content_format[1], line[8:])
82
- syscnt = result[0]
83
- stream_id = result[1]
84
- elif ms_type == '100': # log type 4
85
- result = struct.unpack(content_format[2], line[8:])
86
- stream_id = result[2]
87
- syscnt = None
88
- if is_warn_res0_ov == '0':
89
- syscnt = result[4]
90
- else:
91
- logger.info("Profiling: invalid hwts log record type %s", ms_type)
92
- continue
93
-
94
- if HWTSLogParser.GRAPH_MODE_MAX_TASKID < last_task_stream_map.get(stream_id, task_id) \
95
- and task_id < last_task_stream_map.get(stream_id, task_id):
96
- flip_times += 1
97
- task_id_str = ("%s_%s" % (str(stream_id), str(task_id + flip_times * task_id_threshold)))
98
- result_data += ("%-14s %-4s %-8s %-9s %-8s %-15s %s\n" % (log_type[int(ms_type, 2)], cnt, core_id,
99
- blk_id, task_id_str, syscnt, stream_id))
100
- last_task_stream_map[stream_id] = task_id
101
-
102
- fwrite_format(self._output_filename, data_source=self._dst_file_title, is_start=True)
103
- fwrite_format(self._output_filename, data_source=self._dst_file_column_title)
104
- fwrite_format(self._output_filename, data_source=result_data)
105
- return True
106
-
107
- def _get_source_file(self):
108
- """Get hwts log file name, which was created by ada service."""
109
-
110
- file_name = get_file_join_name(self._input_path, self._source_file_target)
111
- if not file_name:
112
- file_name = get_file_join_name(self._input_path, self._source_file_target_old)
113
- if not file_name:
114
- data_path = os.path.join(self._input_path, "data")
115
- file_name = get_file_join_name(data_path, self._source_file_target)
116
- if not file_name:
117
- file_name = get_file_join_name(data_path, self._source_file_target_old)
118
- if not file_name:
119
- msg = "Fail to find hwts log file, under profiling directory"
120
- raise RuntimeError(msg)
121
-
122
- return file_name
@@ -1,526 +0,0 @@
1
- # Copyright 2020-2022 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 integrator for integrating parsed profiling files."""
16
- import csv
17
- import json
18
- import os
19
- import stat
20
- from decimal import Decimal
21
- from enum import Enum
22
- import sys
23
- from mindspore import log as logger
24
- from mindspore.profiler.common.exceptions.exceptions import ProfilerRawFileException
25
- from mindspore.profiler.common.util import query_latest_trace_time_file, to_int, to_millisecond
26
- from mindspore.profiler.common.validator.validate_path import validate_and_normalize_path
27
-
28
-
29
- class Integrator:
30
- """
31
- The integrator for integrating parsed profiling files.
32
-
33
- Args:
34
- profiling_dir (str): The directory where the parsed profiling files are
35
- located.
36
- device_id (str): The device ID.
37
- """
38
- _file_name_aicore_detail_time = 'output_op_compute_time_{}.txt'
39
- _file_name_aicpu_time = 'output_data_preprocess_aicpu_{}.txt'
40
- _file_name_framework = 'framework_raw_{}.csv'
41
- _header_aicore_type = ['op_type', 'total_time', 'execution_frequency', 'percent']
42
- _header_aicore_detail = ['full_op_name', 'execution_time', 'execution_frequency']
43
- _header_aicpu = [
44
- 'serial_number', 'op_type', 'total_time', 'dispatch_time',
45
- 'execution_time', 'run_start', 'run_end'
46
- ]
47
-
48
- _file_name_aicore_type_time = 'aicore_intermediate_{}_type.csv'
49
- _file_name_aicore_detail_info = 'aicore_intermediate_{}_detail.csv'
50
- _col_names_detail = ['op_name', 'op_type', 'avg_execution_time', 'subgraph', 'full_op_name', 'op_info']
51
- _none_filter_condition_key = ['is_display_detail', 'is_display_full_op_name']
52
- _none_sort_col_names = ['op_info']
53
- _aicore_data = []
54
- _aicore_detail_data = []
55
- _aicore_trace_data = []
56
-
57
- def __init__(self, profiling_dir, device_id):
58
- csv.field_size_limit(sys.maxsize)
59
- self._profiling_dir = profiling_dir
60
- self._device_id = device_id
61
- self._op_time_cache = {}
62
- self._total_time = Decimal('0.0')
63
- self._column = ""
64
- self._result = []
65
-
66
- @staticmethod
67
- def _is_match_condition(exp_key, exp_value, actual_value):
68
- """
69
- Check whether the actual value meets the expect condition.
70
-
71
- Args:
72
- exp_key (str): Expect key of the condition.
73
- exp_value (str): Expect value.
74
- actual_value (str): Actual value.
75
-
76
- Returns:
77
- bool, `True` if the actual meets the expect condition, else `False`.
78
- """
79
- if exp_key == 'in':
80
- if actual_value not in exp_value:
81
- return False
82
- elif exp_key == 'not_in':
83
- if actual_value in exp_value:
84
- return False
85
- elif exp_key == 'partial_match_str_in':
86
- for partial_match_str in exp_value:
87
- if partial_match_str in actual_value:
88
- return True
89
- return False
90
- else:
91
- return False
92
-
93
- return True
94
-
95
- def integrate(self):
96
- """Integrate the parsed profiling files."""
97
- self._parse_aicore_detail_time()
98
- self._parse_aicore_type_time()
99
- self._parse_aicpu_time()
100
-
101
- def get_aicore_data(self):
102
- """Get ai core data."""
103
- self._aicore_data_load()
104
- return self._aicore_data
105
-
106
- def get_aicore_detail_data(self):
107
- """Get ai core detail data."""
108
- self._aicore_detail_data_load()
109
- return self._aicore_detail_data
110
-
111
- def get_aicore_trace_data(self):
112
- """Get ai core trace data."""
113
- self._aicore_trace_data_load()
114
- return self._aicore_trace_data
115
-
116
- def query_for_all_reduce(self):
117
- """Query all reduce data."""
118
- return self._query_for_all_reduce()
119
-
120
- def query_and_sort_by_op_type(self, filter_condition, op_type_order):
121
- """Query and sort by op type."""
122
- return self._query_and_sort_by_op_type(filter_condition, op_type_order)
123
-
124
- def _parse_aicore_type_time(self):
125
- """Parse the parsed AICORE operator type file."""
126
- if self._total_time == 0:
127
- logger.info("AICORE data does not exist.")
128
- return
129
-
130
- framework_file = os.path.join(
131
- self._profiling_dir,
132
- self._file_name_framework.format(self._device_id)
133
- )
134
- framework_file = validate_and_normalize_path(framework_file)
135
- if not os.path.isfile(framework_file):
136
- return
137
-
138
- op_name_type_cache = {}
139
- with open(framework_file, 'r') as src_file:
140
- csv_reader = csv.reader(src_file)
141
- _ = next(csv_reader)
142
- for row in csv_reader:
143
- op_name_type_cache[row[3]] = row[5]
144
-
145
- op_type_time_cache = {}
146
- total_time = 0
147
- for full_op_name, op_info in self._op_time_cache.items():
148
- total_time += op_info[0] * op_info[1]
149
- op_type = op_name_type_cache.get(full_op_name)
150
- op_type_time = op_type_time_cache.get(op_type)
151
- if not op_type_time:
152
- op_type_time = [op_info[0] * op_info[1], op_info[1]]
153
- op_type_time_cache[op_type] = op_type_time
154
- else:
155
- op_type_time[0] += op_info[0] * op_info[1]
156
- op_type_time[1] += op_info[1]
157
- op_type_file_name = 'aicore_intermediate_' + self._device_id + '_type.csv'
158
- op_type_file_path = os.path.join(self._profiling_dir, op_type_file_name)
159
- with os.fdopen(os.open(op_type_file_path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600), 'w') as type_file:
160
- csv_writer = csv.writer(type_file)
161
- csv_writer.writerow(self._header_aicore_type)
162
-
163
- for op_type, op_type_time_info in op_type_time_cache.items():
164
- if total_time != 0:
165
- type_info = [
166
- op_type, op_type_time_info[0], op_type_time_info[1],
167
- round((op_type_time_info[0] / total_time) * 100, 2)
168
- ]
169
- csv_writer.writerow(type_info)
170
- os.chmod(op_type_file_path, stat.S_IREAD | stat.S_IWRITE)
171
-
172
- def _parse_aicore_detail_time(self):
173
- """Parse the parsed AICORE operator time file."""
174
- aicore_detail_file = os.path.join(
175
- self._profiling_dir,
176
- self._file_name_aicore_detail_time.format(self._device_id)
177
- )
178
- aicore_detail_file = validate_and_normalize_path(aicore_detail_file)
179
- if not os.path.isfile(aicore_detail_file):
180
- return
181
-
182
- op_detail_file_name = 'aicore_intermediate_' + self._device_id + '_detail.csv'
183
- op_detail_file_path = os.path.join(
184
- self._profiling_dir, op_detail_file_name
185
- )
186
- with open(aicore_detail_file, 'r') as src_file:
187
- row = src_file.readline()
188
- if row.startswith('op_name'):
189
- _ = src_file.readline()
190
- elif row.startswith('====='):
191
- _ = src_file.readline()
192
- _ = src_file.readline()
193
- else:
194
- return
195
- with os.fdopen(os.open(op_detail_file_path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600),
196
- 'w') as detail_file:
197
- csv_writer = csv.writer(detail_file)
198
- csv_writer.writerow(self._header_aicore_detail)
199
-
200
- while True:
201
- row = src_file.readline()
202
- if not row:
203
- break
204
-
205
- op_infos = row.split()
206
- if op_infos[0] == 'total':
207
- self._total_time = Decimal(op_infos[2])
208
- continue
209
- self._op_time_cache[op_infos[0]] = [Decimal(op_infos[1]), int(op_infos[3])]
210
- csv_writer.writerow([op_infos[0], op_infos[1], op_infos[3]])
211
- os.chmod(op_detail_file_path, stat.S_IREAD | stat.S_IWRITE)
212
-
213
- def _parse_aicpu_time(self):
214
- """Parse the parsed AICPU operator time file."""
215
- aicpu_file = os.path.join(
216
- self._profiling_dir,
217
- self._file_name_aicpu_time.format(self._device_id)
218
- )
219
- aicpu_file = validate_and_normalize_path(aicpu_file)
220
- if not os.path.isfile(aicpu_file):
221
- return
222
-
223
- save_file_name = 'aicpu_intermediate_' + self._device_id + '.csv'
224
- save_file_path = os.path.join(self._profiling_dir, save_file_name)
225
- with open(aicpu_file, 'r') as src_file:
226
- row = src_file.readline()
227
- if not row.startswith('serial_number'):
228
- return
229
- with os.fdopen(os.open(save_file_path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600), 'w') as save_file:
230
- csv_writer = csv.writer(save_file)
231
- csv_writer.writerow(self._header_aicpu)
232
-
233
- while True:
234
- row = src_file.readline()
235
- if not row:
236
- break
237
- infos = row.split()
238
- if infos[0] == 'AI':
239
- continue
240
- csv_writer.writerow(infos)
241
- os.chmod(save_file_path, stat.S_IREAD | stat.S_IWRITE)
242
-
243
- def _aicore_data_load(self):
244
- """Load data according to the parsed AICORE operator types file."""
245
- op_type_file_path = os.path.join(
246
- self._profiling_dir,
247
- self._file_name_aicore_type_time.format(self._device_id)
248
- )
249
- op_type_file_path = validate_and_normalize_path(op_type_file_path)
250
- if not os.path.isfile(op_type_file_path):
251
- logger.warning('The file <%s> does not exist.', op_type_file_path)
252
- return
253
-
254
- with open(op_type_file_path, 'r') as file:
255
- csv_reader = csv.reader(file)
256
- _ = next(csv_reader)
257
- for info in csv_reader:
258
- self._aicore_data.append([info[0], float(info[1]), int(info[2]), float(info[3])])
259
-
260
- def _aicore_detail_data_load(self):
261
- """Load data according to the parsed AICORE operator file."""
262
- op_detail_file_path = os.path.join(
263
- self._profiling_dir,
264
- self._file_name_aicore_detail_info.format(self._device_id)
265
- )
266
- framework_file_path = os.path.join(
267
- self._profiling_dir,
268
- self._file_name_framework.format(self._device_id)
269
- )
270
- op_detail_file_path = validate_and_normalize_path(op_detail_file_path)
271
- framework_file_path = validate_and_normalize_path(framework_file_path)
272
- if not os.path.isfile(op_detail_file_path):
273
- logger.warning('The file <%s> does not exist.', op_detail_file_path)
274
- return
275
- if not os.path.isfile(framework_file_path):
276
- logger.warning('The file <%s> does not exist.', framework_file_path)
277
- return
278
-
279
- framework_infos = dict()
280
- with open(framework_file_path, 'r') as file:
281
- csv_reader = csv.reader(file)
282
- _ = next(csv_reader)
283
- for info in csv_reader:
284
- framework_infos[info[3]] = [
285
- info[3], info[5], info[6], info[7], json.loads(info[8]) if info[8] else None
286
- ]
287
-
288
- with open(op_detail_file_path, 'r') as file:
289
- csv_reader = csv.reader(file)
290
- _ = next(csv_reader)
291
- for info in csv_reader:
292
- framework_info = framework_infos.get(info[0])
293
- if not framework_info:
294
- continue
295
- self._aicore_detail_data.append(
296
- [
297
- framework_info[1], framework_info[2], float(info[1]),
298
- framework_info[3], framework_info[0], framework_info[4]
299
- ]
300
- )
301
- del framework_infos
302
-
303
- def _aicore_trace_data_load(self):
304
- """Load data according to the parsed AICORE operator types file."""
305
- file_path = query_latest_trace_time_file(self._profiling_dir, int(self._device_id))
306
- if not file_path:
307
- logger.warning("Failed to find parsed trace time file.")
308
- return
309
- file_path = validate_and_normalize_path(file_path)
310
- with open(file_path, 'r') as handle:
311
- csv_reader = csv.reader(handle)
312
- self._column = next(csv_reader)
313
- self._aicore_trace_data = list(csv_reader)
314
- self._size = len(self._aicore_trace_data) - 1
315
- self._load_point_info()
316
-
317
- def _load_point_info(self):
318
- """Load point info."""
319
- file_path = os.path.join(self._profiling_dir, 'step_trace_point_info.json')
320
- file_path = validate_and_normalize_path(file_path)
321
- if os.path.isfile(file_path):
322
- with open(file_path, 'r', encoding='utf-8') as file:
323
- try:
324
- self._point_info = json.load(file)
325
- except (json.JSONDecodeError, TypeError) as err:
326
- logger.warning(err)
327
- raise ProfilerRawFileException('Fail to parse point info file.') from err
328
-
329
- def _query_for_all_reduce(self):
330
- """
331
- Query for all reduce info.
332
-
333
- Returns:
334
- list[dict], reduce information. Each item is the reduce info for one step.
335
- The reduce info is format like:
336
- {stream_id: List[Tuple(start_point, end_point, duration, field_name)]}.
337
- """
338
- self._aicore_trace_data_load()
339
- reduce_infos = []
340
- for row_info in self._aicore_trace_data[:-1]:
341
- row_info_dict = self._get_info_dict_from_row_data(row_info, 'systime')
342
- reduce_info = self._sort_reduce_by_time(row_info_dict)
343
- if reduce_info:
344
- reduce_infos.extend(reduce_info)
345
- reduce_infos.sort(key=lambda x: float(x[2]))
346
- return reduce_infos
347
-
348
- def _get_info_dict_from_row_data(self, row_info, time_type):
349
- """
350
- Get step info in dict format.
351
-
352
- Args:
353
- row_info (list[str]): Step info, the value is corresponding to `__column__`.
354
- time_type (str): The value type. `systime` keeps the original value.
355
- `realtime` transforms the value in millisecond. Default: `realtime`.
356
-
357
- Returns:
358
- dict, step trace information. The key is in `__column__`.
359
- """
360
- row_info_dict = {}
361
- for key, value in zip(self._column, row_info):
362
- if key == 'step_num':
363
- continue
364
- value = to_int(value, key)
365
- row_info_dict[key] = to_millisecond(value) if time_type == 'realtime' else value
366
- return row_info_dict
367
-
368
- def _sort_reduce_by_time(self, row_info_dict):
369
- """
370
- Sort reduce info by time.
371
-
372
- Args:
373
- row_info_dict (dict): Step trace information.
374
-
375
- Returns:
376
- list, including the all reduce info sorted by start time only.
377
- [
378
- [reduce_field, stream_id, reduce_start, reduce_duration],
379
- [...],
380
- [...]
381
- ]
382
- """
383
- factor = 1e5 # convert time unit from 10ns to 1ms
384
- reduce_pid = 10000
385
- reduce_info = []
386
- reduce_fields = [
387
- field_name for field_name in self._column
388
- if field_name.startswith('stream_') and not field_name.endswith('point')
389
- ]
390
- for reduce_field in reduce_fields:
391
- reduce_start = row_info_dict.get(reduce_field + '_start_point')
392
- reduce_start = reduce_start / factor \
393
- if reduce_start else 0
394
- reduce_duration = row_info_dict.get(reduce_field)
395
- reduce_duration = reduce_duration / factor if reduce_duration else 0
396
- if not (reduce_start and reduce_duration):
397
- logger.info("Reduce event missing value.")
398
- continue
399
- cur_stream_id = reduce_field.split('_', 3)[1]
400
- if reduce_field.split('_', 2)[1] == 'ops':
401
- cur_stream_id = reduce_field.split('_', 3)[2]
402
- reduce_meta = [
403
- reduce_field, int(cur_stream_id), reduce_start,
404
- reduce_duration, reduce_pid
405
- ]
406
- reduce_info.append(reduce_meta)
407
-
408
- return reduce_info
409
-
410
- def _query_and_sort_by_op_type(self, filter_condition, op_type_order: list):
411
- """
412
- Query the AICORE operator detail information by `filter_condition`,
413
- and sort by `op_type_order` and execution time.
414
-
415
- Args:
416
- filter_condition (dict): The filter condition.
417
- op_type_order (list[str]): The name of the operator type in order.
418
-
419
- Returns:
420
- dict, The results are filtered and sorted.
421
- """
422
- self._aicore_detail_data_load()
423
- if filter_condition is None:
424
- filter_condition = {}
425
- self._filter(filter_condition)
426
-
427
- type_detail_cache = {}
428
- for detail_info in self._result:
429
- op_type = detail_info[1]
430
- if op_type not in op_type_order:
431
- continue
432
- infos = type_detail_cache.get(op_type)
433
- if infos:
434
- infos.append(detail_info)
435
- else:
436
- type_detail_cache[op_type] = [detail_info]
437
-
438
- result = []
439
- for op_type in op_type_order:
440
- detail_infos = type_detail_cache.get(op_type)
441
- if detail_infos is None:
442
- continue
443
- detail_infos.sort(key=lambda item: item[2], reverse=True)
444
- result.extend(detail_infos)
445
-
446
- return {
447
- 'col_name_detail': self._display_col_names_detail,
448
- 'object': result
449
- }
450
-
451
- def _filter(self, filter_condition):
452
- """
453
- Filter the profiling data according to the filter condition.
454
-
455
- Args:
456
- filter_condition (dict): The filter condition.
457
- """
458
-
459
- def _inner_filter(item: list):
460
- return self._default_filter(item, filter_condition)
461
-
462
- def _inner_map(item: list):
463
- inner_item = item[0:4]
464
- if is_display_full_op_name:
465
- inner_item.append(item[4])
466
- if is_display_detail:
467
- inner_item.append(item[5])
468
- return inner_item
469
-
470
- is_display_detail = filter_condition.get('is_display_detail', True)
471
- is_display_full_op_name = filter_condition.get(
472
- 'is_display_full_op_name', True
473
- )
474
- self._set_display_col_name(is_display_detail, is_display_full_op_name)
475
- if is_display_detail and is_display_full_op_name:
476
- self._result = list(filter(_inner_filter, self._aicore_detail_data))
477
- else:
478
- self._result = list(
479
- map(_inner_map, filter(_inner_filter, self._aicore_detail_data))
480
- )
481
-
482
- def _default_filter(self, item, condition):
483
- """
484
- The default filter method.
485
-
486
- Args:
487
- item (list[Union[str, float, int]]): A piece of data to be filtered.
488
- condition (dict): The filter condition.
489
-
490
- Returns:
491
- bool, `True` if the item is satisfied.
492
- """
493
- for condition_key, condition_value in condition.items():
494
- if condition_key in self._none_filter_condition_key:
495
- continue
496
- if condition_key in self._col_names_detail:
497
- index = self._col_names_detail.index(condition_key)
498
- actual_value = item[index]
499
- for exp_key, exp_value in condition_value.items():
500
- if not self._is_match_condition(
501
- exp_key, exp_value, actual_value):
502
- return False
503
- return True
504
-
505
- def _set_display_col_name(self, is_display_detail, is_display_full_op_name):
506
- """
507
- Set the display column name according to the filter condition.
508
-
509
- Args:
510
- is_display_detail (bool): Whether to display the detailed operator
511
- information.
512
- is_display_full_op_name (bool): Whether to display the operator full
513
- name.
514
- """
515
- self._display_col_names_detail = self._col_names_detail[0:4]
516
- if is_display_full_op_name:
517
- self._display_col_names_detail.append(self._col_names_detail[4])
518
- if is_display_detail:
519
- self._display_col_names_detail.append(self._col_names_detail[5])
520
-
521
-
522
- class DeviceTarget(Enum):
523
- """The device target enum."""
524
- CPU = 'cpu'
525
- GPU = 'gpu'
526
- ASCEND = 'ascend'