mindspore 2.7.0rc1__cp311-cp311-win_amd64.whl → 2.7.1__cp311-cp311-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 (370) hide show
  1. mindspore/.commit_id +1 -1
  2. mindspore/__init__.py +5 -2
  3. mindspore/_c_dataengine.cp311-win_amd64.pyd +0 -0
  4. mindspore/_c_expression.cp311-win_amd64.pyd +0 -0
  5. mindspore/_c_mindrecord.cp311-win_amd64.pyd +0 -0
  6. mindspore/_checkparam.py +2 -2
  7. mindspore/_extends/builtin_operations.py +3 -3
  8. mindspore/_extends/parallel_compile/akg_compiler/custom.py +1109 -0
  9. mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
  10. mindspore/_extends/parse/__init__.py +3 -3
  11. mindspore/_extends/parse/compile_config.py +24 -1
  12. mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +6 -3
  13. mindspore/_extends/parse/parser.py +28 -22
  14. mindspore/_extends/parse/resources.py +1 -1
  15. mindspore/_extends/parse/standard_method.py +23 -2
  16. mindspore/_extends/parse/trope.py +2 -1
  17. mindspore/_extends/pijit/pijit_func_white_list.py +9 -27
  18. mindspore/amp.py +0 -18
  19. mindspore/avcodec-59.dll +0 -0
  20. mindspore/avdevice-59.dll +0 -0
  21. mindspore/avfilter-8.dll +0 -0
  22. mindspore/avformat-59.dll +0 -0
  23. mindspore/avutil-57.dll +0 -0
  24. mindspore/boost/base.py +29 -2
  25. mindspore/common/__init__.py +18 -12
  26. mindspore/common/_decorator.py +3 -2
  27. mindspore/common/_grad_function.py +3 -1
  28. mindspore/common/_tensor_cpp_method.py +1 -1
  29. mindspore/common/_tensor_docs.py +371 -96
  30. mindspore/common/_utils.py +7 -43
  31. mindspore/common/api.py +434 -135
  32. mindspore/common/dtype.py +98 -57
  33. mindspore/common/dump.py +7 -108
  34. mindspore/common/dynamic_shape/__init__.py +0 -0
  35. mindspore/common/{auto_dynamic_shape.py → dynamic_shape/auto_dynamic_shape.py} +15 -23
  36. mindspore/common/dynamic_shape/enable_dynamic.py +197 -0
  37. mindspore/common/file_system.py +59 -9
  38. mindspore/common/hook_handle.py +82 -3
  39. mindspore/common/jit_config.py +5 -1
  40. mindspore/common/jit_trace.py +27 -12
  41. mindspore/common/lazy_inline.py +5 -3
  42. mindspore/common/np_dtype.py +3 -3
  43. mindspore/common/parameter.py +17 -127
  44. mindspore/common/recompute.py +4 -13
  45. mindspore/common/tensor.py +50 -217
  46. mindspore/communication/_comm_helper.py +11 -1
  47. mindspore/communication/comm_func.py +138 -4
  48. mindspore/communication/management.py +85 -1
  49. mindspore/config/op_info.config +0 -15
  50. mindspore/context.py +20 -106
  51. mindspore/dataset/__init__.py +1 -1
  52. mindspore/dataset/audio/transforms.py +1 -1
  53. mindspore/dataset/core/config.py +35 -1
  54. mindspore/dataset/engine/datasets.py +338 -319
  55. mindspore/dataset/engine/datasets_user_defined.py +38 -22
  56. mindspore/dataset/engine/datasets_vision.py +1 -1
  57. mindspore/dataset/engine/validators.py +1 -15
  58. mindspore/dataset/transforms/c_transforms.py +2 -2
  59. mindspore/dataset/transforms/transforms.py +3 -3
  60. mindspore/dataset/vision/__init__.py +1 -1
  61. mindspore/dataset/vision/py_transforms.py +8 -8
  62. mindspore/dataset/vision/transforms.py +17 -5
  63. mindspore/dataset/vision/utils.py +632 -21
  64. mindspore/device_context/ascend/op_tuning.py +35 -1
  65. mindspore/dnnl.dll +0 -0
  66. mindspore/{profiler/common/validator → graph}/__init__.py +9 -1
  67. mindspore/graph/custom_pass.py +55 -0
  68. mindspore/include/api/cell.h +28 -4
  69. mindspore/include/api/cfg.h +24 -7
  70. mindspore/include/api/context.h +1 -0
  71. mindspore/include/api/delegate.h +0 -2
  72. mindspore/include/api/dual_abi_helper.h +100 -19
  73. mindspore/include/api/graph.h +14 -1
  74. mindspore/include/api/kernel.h +16 -3
  75. mindspore/include/api/kernel_api.h +9 -1
  76. mindspore/include/api/metrics/accuracy.h +9 -0
  77. mindspore/include/api/model.h +5 -1
  78. mindspore/include/api/model_group.h +4 -0
  79. mindspore/include/api/model_parallel_runner.h +2 -0
  80. mindspore/include/api/status.h +48 -10
  81. mindspore/include/api/types.h +6 -1
  82. mindspore/include/dataset/constants.h +9 -0
  83. mindspore/include/dataset/execute.h +2 -2
  84. mindspore/jpeg62.dll +0 -0
  85. mindspore/mindrecord/__init__.py +3 -3
  86. mindspore/mindrecord/common/exceptions.py +1 -0
  87. mindspore/mindrecord/config.py +1 -1
  88. mindspore/{parallel/mpi → mindrecord/core}/__init__.py +4 -1
  89. mindspore/mindrecord/{shardheader.py → core/shardheader.py} +2 -1
  90. mindspore/mindrecord/{shardindexgenerator.py → core/shardindexgenerator.py} +1 -1
  91. mindspore/mindrecord/{shardreader.py → core/shardreader.py} +2 -1
  92. mindspore/mindrecord/{shardsegment.py → core/shardsegment.py} +2 -2
  93. mindspore/mindrecord/{shardutils.py → core/shardutils.py} +1 -1
  94. mindspore/mindrecord/{shardwriter.py → core/shardwriter.py} +1 -1
  95. mindspore/mindrecord/filereader.py +4 -4
  96. mindspore/mindrecord/filewriter.py +5 -5
  97. mindspore/mindrecord/mindpage.py +2 -2
  98. mindspore/mindrecord/tools/cifar10.py +4 -3
  99. mindspore/mindrecord/tools/cifar100.py +1 -1
  100. mindspore/mindrecord/tools/cifar100_to_mr.py +1 -1
  101. mindspore/mindrecord/tools/cifar10_to_mr.py +6 -6
  102. mindspore/mindrecord/tools/csv_to_mr.py +1 -1
  103. mindspore/mindrecord/tools/imagenet_to_mr.py +1 -1
  104. mindspore/mindrecord/tools/mnist_to_mr.py +1 -1
  105. mindspore/mindrecord/tools/tfrecord_to_mr.py +1 -1
  106. mindspore/mindspore_backend_common.dll +0 -0
  107. mindspore/mindspore_backend_manager.dll +0 -0
  108. mindspore/mindspore_cluster.dll +0 -0
  109. mindspore/mindspore_common.dll +0 -0
  110. mindspore/mindspore_core.dll +0 -0
  111. mindspore/mindspore_cpu.dll +0 -0
  112. mindspore/mindspore_dump.dll +0 -0
  113. mindspore/mindspore_frontend.dll +0 -0
  114. mindspore/mindspore_glog.dll +0 -0
  115. mindspore/mindspore_hardware_abstract.dll +0 -0
  116. mindspore/mindspore_memory_pool.dll +0 -0
  117. mindspore/mindspore_ms_backend.dll +0 -0
  118. mindspore/mindspore_ops.dll +0 -0
  119. mindspore/{mindspore_ops_host.dll → mindspore_ops_cpu.dll} +0 -0
  120. mindspore/mindspore_profiler.dll +0 -0
  121. mindspore/mindspore_pyboost.dll +0 -0
  122. mindspore/mindspore_pynative.dll +0 -0
  123. mindspore/mindspore_runtime_pipeline.dll +0 -0
  124. mindspore/mindspore_runtime_utils.dll +0 -0
  125. mindspore/mindspore_tools.dll +0 -0
  126. mindspore/mint/__init__.py +15 -10
  127. mindspore/mint/distributed/__init__.py +4 -0
  128. mindspore/mint/distributed/distributed.py +392 -69
  129. mindspore/mint/nn/__init__.py +2 -16
  130. mindspore/mint/nn/functional.py +4 -110
  131. mindspore/mint/nn/layer/__init__.py +0 -2
  132. mindspore/mint/nn/layer/_functions.py +1 -2
  133. mindspore/mint/nn/layer/activation.py +0 -6
  134. mindspore/mint/nn/layer/basic.py +0 -47
  135. mindspore/mint/nn/layer/conv.py +10 -10
  136. mindspore/mint/nn/layer/normalization.py +11 -16
  137. mindspore/mint/nn/layer/pooling.py +0 -4
  138. mindspore/nn/__init__.py +1 -3
  139. mindspore/nn/cell.py +231 -239
  140. mindspore/nn/layer/activation.py +4 -2
  141. mindspore/nn/layer/basic.py +56 -14
  142. mindspore/nn/layer/container.py +16 -0
  143. mindspore/nn/layer/embedding.py +4 -169
  144. mindspore/nn/layer/image.py +1 -1
  145. mindspore/nn/layer/normalization.py +2 -1
  146. mindspore/nn/layer/thor_layer.py +4 -85
  147. mindspore/nn/optim/ada_grad.py +0 -1
  148. mindspore/nn/optim/adafactor.py +0 -1
  149. mindspore/nn/optim/adam.py +32 -127
  150. mindspore/nn/optim/adamax.py +0 -1
  151. mindspore/nn/optim/asgd.py +0 -1
  152. mindspore/nn/optim/ftrl.py +8 -102
  153. mindspore/nn/optim/lamb.py +1 -4
  154. mindspore/nn/optim/lars.py +0 -3
  155. mindspore/nn/optim/lazyadam.py +25 -218
  156. mindspore/nn/optim/momentum.py +5 -43
  157. mindspore/nn/optim/optimizer.py +6 -55
  158. mindspore/nn/optim/proximal_ada_grad.py +0 -1
  159. mindspore/nn/optim/rmsprop.py +0 -1
  160. mindspore/nn/optim/rprop.py +0 -1
  161. mindspore/nn/optim/sgd.py +0 -1
  162. mindspore/nn/optim/tft_wrapper.py +2 -4
  163. mindspore/nn/optim/thor.py +0 -2
  164. mindspore/nn/probability/bijector/bijector.py +7 -8
  165. mindspore/nn/probability/bijector/gumbel_cdf.py +2 -2
  166. mindspore/nn/probability/bijector/power_transform.py +20 -21
  167. mindspore/nn/probability/bijector/scalar_affine.py +5 -5
  168. mindspore/nn/probability/bijector/softplus.py +13 -14
  169. mindspore/nn/probability/distribution/_utils/utils.py +2 -2
  170. mindspore/nn/wrap/cell_wrapper.py +39 -5
  171. mindspore/nn/wrap/grad_reducer.py +4 -89
  172. mindspore/numpy/array_creations.py +4 -4
  173. mindspore/numpy/fft.py +9 -9
  174. mindspore/numpy/utils_const.py +1 -1
  175. mindspore/{nn/reinforcement → onnx}/__init__.py +5 -8
  176. mindspore/onnx/onnx_export.py +137 -0
  177. mindspore/opencv_core4110.dll +0 -0
  178. mindspore/opencv_imgcodecs4110.dll +0 -0
  179. mindspore/{opencv_imgproc452.dll → opencv_imgproc4110.dll} +0 -0
  180. mindspore/ops/__init__.py +2 -0
  181. mindspore/ops/_grad_experimental/grad_comm_ops.py +38 -2
  182. mindspore/ops/_grad_experimental/grad_inner_ops.py +0 -9
  183. mindspore/ops/_op_impl/aicpu/__init__.py +0 -10
  184. mindspore/ops/_op_impl/cpu/__init__.py +1 -5
  185. mindspore/ops/_op_impl/cpu/{buffer_append.py → joinedstr_op.py} +8 -8
  186. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +28 -24
  187. mindspore/ops/auto_generate/gen_extend_func.py +6 -11
  188. mindspore/ops/auto_generate/gen_ops_def.py +385 -154
  189. mindspore/ops/auto_generate/gen_ops_prim.py +5676 -5167
  190. mindspore/ops/communication.py +97 -0
  191. mindspore/ops/composite/__init__.py +5 -2
  192. mindspore/ops/composite/base.py +16 -2
  193. mindspore/ops/composite/multitype_ops/__init__.py +3 -1
  194. mindspore/ops/composite/multitype_ops/_compile_utils.py +150 -8
  195. mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
  196. mindspore/ops/composite/multitype_ops/add_impl.py +7 -0
  197. mindspore/ops/composite/multitype_ops/mod_impl.py +27 -0
  198. mindspore/ops/function/__init__.py +2 -0
  199. mindspore/ops/function/array_func.py +24 -18
  200. mindspore/ops/function/comm_func.py +3883 -0
  201. mindspore/ops/function/debug_func.py +7 -6
  202. mindspore/ops/function/grad/grad_func.py +4 -12
  203. mindspore/ops/function/math_func.py +89 -86
  204. mindspore/ops/function/nn_func.py +92 -313
  205. mindspore/ops/function/random_func.py +9 -18
  206. mindspore/ops/functional.py +4 -1
  207. mindspore/ops/functional_overload.py +377 -30
  208. mindspore/ops/operations/__init__.py +2 -5
  209. mindspore/ops/operations/_custom_ops_utils.py +7 -9
  210. mindspore/ops/operations/_inner_ops.py +12 -50
  211. mindspore/ops/operations/_rl_inner_ops.py +0 -933
  212. mindspore/ops/operations/array_ops.py +5 -50
  213. mindspore/ops/operations/comm_ops.py +95 -17
  214. mindspore/ops/operations/custom_ops.py +237 -22
  215. mindspore/ops/operations/debug_ops.py +33 -35
  216. mindspore/ops/operations/manually_defined/ops_def.py +39 -318
  217. mindspore/ops/operations/math_ops.py +5 -5
  218. mindspore/ops/operations/nn_ops.py +3 -3
  219. mindspore/ops/operations/sparse_ops.py +0 -83
  220. mindspore/ops/primitive.py +4 -27
  221. mindspore/ops/tensor_method.py +88 -10
  222. mindspore/ops_generate/aclnn/aclnn_kernel_register_auto_cc_generator.py +5 -5
  223. mindspore/ops_generate/aclnn/gen_aclnn_implement.py +8 -8
  224. mindspore/ops_generate/api/functions_cc_generator.py +53 -4
  225. mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +25 -11
  226. mindspore/ops_generate/common/gen_constants.py +11 -10
  227. mindspore/ops_generate/common/op_proto.py +18 -1
  228. mindspore/ops_generate/common/template.py +102 -245
  229. mindspore/ops_generate/common/template_utils.py +212 -0
  230. mindspore/ops_generate/gen_custom_ops.py +69 -0
  231. mindspore/ops_generate/op_def/ops_def_cc_generator.py +78 -7
  232. mindspore/ops_generate/op_def_py/base_op_prim_py_generator.py +360 -0
  233. mindspore/ops_generate/op_def_py/custom_op_prim_py_generator.py +140 -0
  234. mindspore/ops_generate/op_def_py/op_def_py_generator.py +54 -7
  235. mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -312
  236. mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +74 -17
  237. mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +22 -5
  238. mindspore/ops_generate/pyboost/gen_pyboost_func.py +0 -16
  239. mindspore/ops_generate/pyboost/op_template_parser.py +3 -2
  240. mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +21 -5
  241. mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +2 -2
  242. mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +30 -10
  243. mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +10 -3
  244. mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +1 -1
  245. mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +19 -9
  246. mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +71 -28
  247. mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +10 -9
  248. mindspore/ops_generate/pyboost/pyboost_utils.py +27 -16
  249. mindspore/ops_generate/resources/yaml_loader.py +13 -0
  250. mindspore/ops_generate/tensor_py_cc_generator.py +2 -2
  251. mindspore/parallel/_auto_parallel_context.py +5 -15
  252. mindspore/parallel/_cell_wrapper.py +1 -1
  253. mindspore/parallel/_parallel_serialization.py +4 -6
  254. mindspore/parallel/_ps_context.py +2 -2
  255. mindspore/parallel/_utils.py +34 -17
  256. mindspore/parallel/auto_parallel.py +23 -9
  257. mindspore/parallel/checkpoint_transform.py +20 -2
  258. mindspore/parallel/cluster/process_entity/_api.py +28 -33
  259. mindspore/parallel/cluster/process_entity/_utils.py +9 -5
  260. mindspore/parallel/cluster/run.py +5 -3
  261. mindspore/{experimental/llm_boost/ascend_native → parallel/distributed}/__init__.py +21 -22
  262. mindspore/parallel/distributed/distributed_data_parallel.py +393 -0
  263. mindspore/parallel/distributed/flatten_grad_buffer.py +295 -0
  264. mindspore/parallel/function/reshard_func.py +6 -5
  265. mindspore/parallel/nn/parallel_cell_wrapper.py +40 -3
  266. mindspore/parallel/nn/parallel_grad_reducer.py +0 -8
  267. mindspore/parallel/shard.py +7 -21
  268. mindspore/parallel/strategy.py +336 -0
  269. mindspore/parallel/transform_safetensors.py +127 -20
  270. mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +13 -9
  271. mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +1 -1
  272. mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +1 -1
  273. mindspore/profiler/common/constant.py +5 -0
  274. mindspore/profiler/common/file_manager.py +9 -0
  275. mindspore/profiler/common/msprof_cmd_tool.py +40 -4
  276. mindspore/profiler/common/path_manager.py +65 -24
  277. mindspore/profiler/common/profiler_context.py +27 -14
  278. mindspore/profiler/common/profiler_info.py +3 -3
  279. mindspore/profiler/common/profiler_meta_data.py +1 -0
  280. mindspore/profiler/common/profiler_op_analyse.py +10 -6
  281. mindspore/profiler/common/profiler_path_manager.py +13 -0
  282. mindspore/profiler/common/util.py +30 -3
  283. mindspore/profiler/dynamic_profiler.py +91 -46
  284. mindspore/profiler/envprofiler.py +30 -5
  285. mindspore/profiler/experimental_config.py +18 -2
  286. mindspore/profiler/platform/cpu_profiler.py +10 -4
  287. mindspore/profiler/platform/npu_profiler.py +34 -7
  288. mindspore/profiler/profiler.py +193 -145
  289. mindspore/profiler/profiler_action_controller.py +1 -1
  290. mindspore/profiler/profiler_interface.py +2 -2
  291. mindspore/rewrite/symbol_tree/symbol_tree.py +1 -1
  292. mindspore/run_check/_check_version.py +108 -24
  293. mindspore/runtime/__init__.py +9 -6
  294. mindspore/runtime/executor.py +35 -0
  295. mindspore/runtime/memory.py +113 -0
  296. mindspore/runtime/thread_bind_core.py +1 -1
  297. mindspore/swresample-4.dll +0 -0
  298. mindspore/swscale-6.dll +0 -0
  299. mindspore/tinyxml2.dll +0 -0
  300. mindspore/{experimental/llm_boost → tools}/__init__.py +5 -5
  301. mindspore/tools/data_dump.py +130 -0
  302. mindspore/tools/sdc_detect.py +91 -0
  303. mindspore/tools/stress_detect.py +63 -0
  304. mindspore/train/__init__.py +6 -6
  305. mindspore/train/_utils.py +8 -21
  306. mindspore/train/amp.py +6 -7
  307. mindspore/train/callback/_callback.py +2 -1
  308. mindspore/train/callback/_checkpoint.py +1 -17
  309. mindspore/train/callback/_flops_collector.py +10 -6
  310. mindspore/train/callback/_train_fault_tolerance.py +72 -25
  311. mindspore/train/data_sink.py +5 -9
  312. mindspore/train/dataset_helper.py +5 -5
  313. mindspore/train/model.py +41 -230
  314. mindspore/train/serialization.py +160 -401
  315. mindspore/train/train_thor/model_thor.py +2 -2
  316. mindspore/turbojpeg.dll +0 -0
  317. mindspore/utils/__init__.py +6 -3
  318. mindspore/utils/dlpack.py +92 -0
  319. mindspore/utils/dryrun.py +1 -1
  320. mindspore/utils/runtime_execution_order_check.py +10 -0
  321. mindspore/utils/sdc_detect.py +14 -12
  322. mindspore/utils/stress_detect.py +43 -0
  323. mindspore/utils/utils.py +152 -16
  324. mindspore/version.py +1 -1
  325. {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/METADATA +3 -2
  326. {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/RECORD +330 -344
  327. mindspore/_extends/remote/kernel_build_server_ascend.py +0 -75
  328. mindspore/communication/_hccl_management.py +0 -297
  329. mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +0 -207
  330. mindspore/experimental/llm_boost/ascend_native/llm_boost.py +0 -52
  331. mindspore/experimental/llm_boost/atb/__init__.py +0 -23
  332. mindspore/experimental/llm_boost/atb/boost_base.py +0 -385
  333. mindspore/experimental/llm_boost/atb/llama_boost.py +0 -137
  334. mindspore/experimental/llm_boost/atb/qwen_boost.py +0 -124
  335. mindspore/experimental/llm_boost/register.py +0 -130
  336. mindspore/experimental/llm_boost/utils.py +0 -31
  337. mindspore/include/OWNERS +0 -7
  338. mindspore/mindspore_cpu_res_manager.dll +0 -0
  339. mindspore/mindspore_ops_kernel_common.dll +0 -0
  340. mindspore/mindspore_res_manager.dll +0 -0
  341. mindspore/nn/optim/_dist_optimizer_registry.py +0 -111
  342. mindspore/nn/reinforcement/_batch_read_write.py +0 -142
  343. mindspore/nn/reinforcement/_tensors_queue.py +0 -152
  344. mindspore/nn/reinforcement/tensor_array.py +0 -145
  345. mindspore/opencv_core452.dll +0 -0
  346. mindspore/opencv_imgcodecs452.dll +0 -0
  347. mindspore/ops/_op_impl/aicpu/priority_replay_buffer.py +0 -113
  348. mindspore/ops/_op_impl/aicpu/reservoir_replay_buffer.py +0 -96
  349. mindspore/ops/_op_impl/aicpu/sparse_cross.py +0 -42
  350. mindspore/ops/_op_impl/cpu/buffer_get.py +0 -28
  351. mindspore/ops/_op_impl/cpu/buffer_sample.py +0 -28
  352. mindspore/ops/_op_impl/cpu/priority_replay_buffer.py +0 -42
  353. mindspore/ops/operations/_tensor_array.py +0 -359
  354. mindspore/ops/operations/rl_ops.py +0 -288
  355. mindspore/parallel/_offload_context.py +0 -275
  356. mindspore/parallel/_recovery_context.py +0 -115
  357. mindspore/parallel/_transformer/__init__.py +0 -35
  358. mindspore/parallel/_transformer/layers.py +0 -765
  359. mindspore/parallel/_transformer/loss.py +0 -251
  360. mindspore/parallel/_transformer/moe.py +0 -693
  361. mindspore/parallel/_transformer/op_parallel_config.py +0 -222
  362. mindspore/parallel/_transformer/transformer.py +0 -3124
  363. mindspore/parallel/mpi/_mpi_config.py +0 -116
  364. mindspore/profiler/common/validator/validate_path.py +0 -84
  365. mindspore/train/memory_profiling_pb2.py +0 -298
  366. mindspore/utils/hooks.py +0 -81
  367. /mindspore/common/{_auto_dynamic.py → dynamic_shape/_auto_dynamic.py} +0 -0
  368. {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/WHEEL +0 -0
  369. {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/entry_points.txt +0 -0
  370. {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/top_level.txt +0 -0
@@ -24,7 +24,9 @@ import multiprocessing
24
24
 
25
25
  from mindspore import log as logger
26
26
  from mindspore.train import Callback
27
- from mindspore.profiler import Profiler, tensorboard_trace_handler, schedule
27
+ from mindspore.profiler import tensorboard_trace_handler, schedule
28
+ from mindspore.profiler.profiler import Profile
29
+ from mindspore.profiler.experimental_config import _ExperimentalConfig
28
30
  from mindspore.profiler.common.file_manager import FileManager
29
31
  from mindspore.profiler.common.path_manager import PathManager
30
32
  from mindspore.profiler.dynamic_profile.dynamic_profiler_config_context import DynamicProfilerConfigContext
@@ -41,7 +43,7 @@ def print_msg(msg):
41
43
 
42
44
  class DynamicProfilerMonitorBase(Callback):
43
45
  """
44
- Dynamic profile callback base class implementing the dynamic profile functionality.
46
+ Dynamic profiler callback base class implementing the dynamic profiler functionality.
45
47
  """
46
48
 
47
49
  NPU_MONITOR_START = "NPU_MONITOR_START"
@@ -88,15 +90,23 @@ class DynamicProfilerMonitorBase(Callback):
88
90
  @no_exception_func()
89
91
  def step_begin(self, run_context):
90
92
  """
91
- Start profile at the begin of step.
93
+ Start profiler at the begin of step.
92
94
 
93
95
  Args:
94
96
  run_context (RunContext): Context of the train running.
95
97
  """
96
98
  prof_json = self._get_prof_args()
99
+ if not prof_json:
100
+ return
101
+ if self._is_dyno:
102
+ # Dyno monitor process
103
+ if self.NPU_MONITOR_START in prof_json:
104
+ self._call_dyno_monitor(prof_json)
105
+ return
106
+
97
107
  prof_args = DynamicProfilerConfigContext(prof_json)
98
108
  if not prof_args.is_valid:
99
- logger.error("Dynamic profile json is not valid, please check the json file.")
109
+ logger.error("Dynamic profiler json is not valid, please check the json file.")
100
110
  return
101
111
 
102
112
  if prof_args.start_step in (-1, self._last_start_step):
@@ -109,16 +119,22 @@ class DynamicProfilerMonitorBase(Callback):
109
119
  # Prevent repeated calls of the start function within a complete interval
110
120
  if step_num == start_step:
111
121
  if self._is_started:
112
- logger.error("Dynamic profile is already started at step %d, "
113
- "please wait the first profile finished at step %d.",
122
+ logger.error("Dynamic profiler is already started at step %d, "
123
+ "please wait the first profiler finished at step %d.",
114
124
  self._last_start_step, self._last_stop_step)
115
125
  return
116
126
 
117
127
  if self._profiler is None:
118
- prof_path = os.path.join(self._output_path, f"rank{self._rank_id}_start{start_step}_stop{stop_step}")
128
+ output_path = prof_args.prof_path if prof_args.prof_path != "./" else self._output_path
129
+ prof_path = os.path.join(
130
+ output_path,
131
+ f"rank{self._rank_id}_start{start_step}_stop{stop_step}"
132
+ )
119
133
  PathManager.check_input_directory_path(prof_path)
120
- self._profiler = Profiler(on_trace_ready=tensorboard_trace_handler(dir_name=prof_path),
121
- start_profile=False, **prof_args.args)
134
+ profiler_config = self._get_prof_config(prof_args, prof_path, start_step, stop_step,
135
+ start_profile=False,
136
+ skip_first=0)
137
+ self._profiler = Profile(**profiler_config)
122
138
  print_msg(f"Rank {self._rank_id} create output path {prof_path}")
123
139
 
124
140
  self._profiler.start()
@@ -128,10 +144,58 @@ class DynamicProfilerMonitorBase(Callback):
128
144
  print_msg(f"Rank {self._rank_id} Dynamic profiler start at step {start_step}, "
129
145
  f"will stop at step {stop_step}")
130
146
 
147
+ @staticmethod
148
+ def _get_prof_config(prof_args, prof_path, start_step, stop_step, start_profile, skip_first):
149
+ """
150
+ Get profiler config.
151
+
152
+ Args:
153
+ prof_args: Profiler config.
154
+ prof_path: Profiler output path.
155
+ start_step: Start step.
156
+ stop_step: Stop step.
157
+ start_profile: enable start_profile.
158
+ skip_first: skip first step.
159
+ """
160
+ profiler_config = {
161
+ "activities": prof_args.args.get("activities"),
162
+ "with_stack": prof_args.args.get("with_stack"),
163
+ "profile_memory": prof_args.args.get("profile_memory"),
164
+ "parallel_strategy": prof_args.args.get("parallel_strategy"),
165
+ "start_profile": start_profile,
166
+ "record_shapes": prof_args.args.get("record_shapes"),
167
+ "schedule": schedule(
168
+ wait=0,
169
+ warmup=0,
170
+ active=stop_step - start_step + 1,
171
+ repeat=1,
172
+ skip_first=skip_first
173
+ ),
174
+ "on_trace_ready": tensorboard_trace_handler(
175
+ dir_name=prof_path,
176
+ analyse_flag=prof_args.analyse,
177
+ async_mode=prof_args.analyse_mode == "async",
178
+ ),
179
+ "experimental_config": _ExperimentalConfig(
180
+ profiler_level=prof_args.args.get("profiler_level"),
181
+ aic_metrics=prof_args.args.get("aic_metrics"),
182
+ l2_cache=prof_args.args.get("l2_cache"),
183
+ mstx=prof_args.args.get("mstx"),
184
+ data_simplification=prof_args.args.get("data_simplification"),
185
+ export_type=prof_args.args.get("export_type"),
186
+ mstx_domain_include=prof_args.args.get("mstx_domain_include"),
187
+ mstx_domain_exclude=prof_args.args.get("mstx_domain_exclude"),
188
+ sys_io=prof_args.args.get("sys_io"),
189
+ sys_interconnection=prof_args.args.get("sys_interconnection"),
190
+ host_sys=prof_args.args.get("host_sys")
191
+ )
192
+ }
193
+ return profiler_config
194
+
131
195
  @no_exception_func()
132
196
  def step_end(self, run_context):
133
197
  """
134
- Stop profile at the end of step.
198
+ Stop profiler at the end of step.
135
199
 
136
200
  Args:
137
201
  run_context (RunContext): Context of the train running.
@@ -140,26 +204,22 @@ class DynamicProfilerMonitorBase(Callback):
140
204
  prof_args = DynamicProfilerConfigContext(prof_json)
141
205
 
142
206
  if not prof_args.is_valid:
143
- logger.error("Dynamic profile json is not valid, please check the json file.")
207
+ logger.error("Dynamic profiler json is not valid, please check the json file.")
144
208
  return
145
209
 
146
210
  if prof_args.stop_step == -1:
147
211
  return
148
212
 
213
+ if self._profiler:
214
+ self._profiler.step()
215
+
149
216
  cb_params = run_context.original_args()
150
217
  step_num = cb_params.cur_step_num
151
218
 
152
219
  if step_num == self._last_stop_step and self._is_started:
153
- if self._profiler:
154
- self._profiler.stop()
155
- if prof_args.analyse_mode:
156
- self._profiler.analyse(mode=prof_args.analyse_mode)
157
- else:
158
- ProfilerInterface.finalize()
159
- ProfilerInterface.clear()
160
- self._profiler = None
161
- self._is_started = False
162
- print_msg(f"Rank {self._rank_id} Dynamic profiler stop at step {step_num}")
220
+ self._profiler = None
221
+ self._is_started = False
222
+ print_msg(f"Rank {self._rank_id} Dynamic profiler stop at step {step_num}")
163
223
 
164
224
  @no_exception_func()
165
225
  def step(self):
@@ -271,7 +331,7 @@ class DynamicProfilerMonitorBase(Callback):
271
331
 
272
332
  prof_args = DynamicProfilerConfigContext(prof_json)
273
333
  if not prof_args.is_valid:
274
- logger.error("Dynamic profile config is not valid, please check the json or dyno config.")
334
+ logger.error("Dynamic profiler config is not valid, please check the json or dyno config.")
275
335
  return
276
336
  self._handle_profiler_setup(prof_args)
277
337
 
@@ -293,14 +353,13 @@ class DynamicProfilerMonitorBase(Callback):
293
353
  if not (start_step >= 0 and 0 <= start_step <= stop_step):
294
354
  self._profiler = None
295
355
  logger.error(
296
- "Rank %d Dynamic profile start at step %d and stop at step %d must be "
356
+ "Rank %d Dynamic profiler start at step %d and stop at step %d must be "
297
357
  "greater than or equal to 0, and stop step should not be less than start step",
298
358
  self._rank_id, start_step, stop_step
299
359
  )
300
360
  return
301
361
 
302
362
  # Setup profiler configuration
303
- active_steps = stop_step - start_step + 1
304
363
  output_path = args.prof_path if args.prof_path != "./" else self._output_path
305
364
  prof_path = os.path.join(
306
365
  output_path,
@@ -308,26 +367,12 @@ class DynamicProfilerMonitorBase(Callback):
308
367
  )
309
368
  print_msg(f"Rank {self._rank_id} create output path {prof_path}")
310
369
  print_msg(
311
- f"Rank {self._rank_id} Dynamic profile start at step {start_step}, "
370
+ f"Rank {self._rank_id} Dynamic profiler start at step {start_step}, "
312
371
  f"will stop at step {stop_step}"
313
372
  )
314
- profiler_config = {
315
- "schedule": schedule(
316
- wait=0,
317
- warmup=0,
318
- active=active_steps,
319
- repeat=1,
320
- skip_first=1
321
- ),
322
- "on_trace_ready": tensorboard_trace_handler(
323
- dir_name=prof_path,
324
- analyse_flag=args.analyse,
325
- async_mode=args.analyse_mode == "async",
326
- ),
327
- **args.args
328
- }
329
-
330
- self._profiler = Profiler(**profiler_config)
373
+ profiler_config = self._get_prof_config(args, prof_path, start_step, stop_step, start_profile=True,
374
+ skip_first=1)
375
+ self._profiler = Profile(**profiler_config)
331
376
 
332
377
  def _is_valid_start_stop_step(self, step_num, start_step, stop_step):
333
378
  """Verify whether start_step and stop_step are valid parameters."""
@@ -546,10 +591,10 @@ if sys.version_info >= (3, 8):
546
591
 
547
592
  class DynamicProfilerMonitor(DynamicProfilerMonitorBase):
548
593
  r"""
549
- This class to enable the dynamic profile monitoring of MindSpore neural networks.
594
+ This class to enable the dynamic profiler monitoring of MindSpore neural networks.
550
595
 
551
596
  Args:
552
- cfg_path (str): (Ascend only) Dynamic profile json config file directory. The requirement is a shared path
597
+ cfg_path (str): (Ascend only) Dynamic profiler json config file directory. The requirement is a shared path
553
598
  that can be accessed by all nodes. The parameters of the json configuration file are as follows:
554
599
 
555
600
  - start_step (int, required) - Sets the step number at which the Profiler starts collecting data.
@@ -795,10 +840,10 @@ else:
795
840
 
796
841
  class DynamicProfilerMonitor(DynamicProfilerMonitorBase):
797
842
  r"""
798
- This class to enable the dynamic profile monitoring of MindSpore neural networks.
843
+ This class to enable the dynamic profiler monitoring of MindSpore neural networks.
799
844
 
800
845
  Args:
801
- cfg_path (str): Dynamic profile json config file directory. The requirement is a shared path
846
+ cfg_path (str): Dynamic profiler json config file directory. The requirement is a shared path
802
847
  that can be accessed by all nodes.
803
848
  output_path (str, optional): Output data path. Default: ``"./dyn_profile_data"`` .
804
849
  poll_interval (int, optional): The polling period of the monitoring process, in seconds.
@@ -16,7 +16,9 @@
16
16
  import os
17
17
  import json
18
18
  from mindspore import log as logger
19
- from mindspore.profiler.profiler import Profiler
19
+ from mindspore.profiler.profiler import Profile
20
+ from mindspore.profiler.experimental_config import _ExperimentalConfig
21
+ from mindspore.profiler import tensorboard_trace_handler
20
22
  from mindspore.profiler.common.constant import (
21
23
  ProfilerLevel,
22
24
  AicoreMetrics,
@@ -47,8 +49,31 @@ class EnvProfiler:
47
49
 
48
50
  params = cls._convert_options_to_profiler_params(options)
49
51
  logger.info(f"params: {params}")
50
- if params["start_profile"]:
51
- cls.profiler = Profiler(**params)
52
+ if params["start"]:
53
+ experimental_config = _ExperimentalConfig(profiler_level=params.get("profiler_level"),
54
+ aic_metrics=params.get("aic_metrics"),
55
+ l2_cache=params.get("l2_cache"),
56
+ mstx=params.get("mstx"),
57
+ data_simplification=params.get("data_simplification"),
58
+ export_type=params.get("export_type"),
59
+ mstx_domain_include=params.get("mstx_domain_include"),
60
+ mstx_domain_exclude=params.get("mstx_domain_exclude"),
61
+ sys_io=params.get("sys_io"),
62
+ sys_interconnection=params.get("sys_interconnection"),
63
+ host_sys=params.get("host_sys"))
64
+ cls.profiler = Profile(activities=params.get("activities"),
65
+ with_stack=params.get("with_stack"),
66
+ profile_memory=params.get("profile_memory"),
67
+ data_process=params.get("data_process"),
68
+ parallel_strategy=params.get("parallel_strategy"),
69
+ start_profile=params.get("start_profile"),
70
+ hbm_ddr=params.get("hbm_ddr"),
71
+ pcie=params.get("pcie"),
72
+ sync_enable=params.get("sync_enable"),
73
+ record_shapes=params.get("record_shapes"),
74
+ on_trace_ready=tensorboard_trace_handler(params.get("output_path")),
75
+ experimental_config=experimental_config)
76
+ cls.profiler.start()
52
77
  logger.info("Profiler init success.")
53
78
 
54
79
  def analyse(self):
@@ -59,7 +84,7 @@ class EnvProfiler:
59
84
  if not self.profiler:
60
85
  logger.info("Profiler is not initialized, skip analyse.")
61
86
  return
62
- self.profiler.analyse()
87
+ self.profiler.stop()
63
88
  logger.info("analyse end")
64
89
 
65
90
  @classmethod
@@ -101,7 +126,7 @@ class EnvProfiler:
101
126
  params["output_path"] = options["output_path"]
102
127
 
103
128
  # if start is not set, default is False
104
- params["start_profile"] = options.get("start", False)
129
+ params["start"] = options.get("start", False)
105
130
 
106
131
  for param, (_, default_value) in ProfilerParameters.PARAMS.items():
107
132
  if param in options and param not in cls.NOT_SUPPORTED_PARAMS:
@@ -59,7 +59,7 @@ class _ExperimentalConfig:
59
59
  storage and l2 cache etc.
60
60
  l2_cache (bool, optional): (Ascend only) Whether to collect l2 cache data, collect when True.
61
61
  Default: ``False`` . The l2_cache.csv file is generated in the ASCEND_PROFILER_OUTPUT folder. In GE backend,
62
- only wait and skip_first parameters in schedule configuration can be set to 0.
62
+ only support :class:`mindspore.profiler.schedule` configuration wait and skip_first parameter is 0.
63
63
  mstx (bool, optional): (Ascend only) Whether to collect light weight profiling data, collect when True.
64
64
  Default: ``False`` .
65
65
  data_simplification (bool, optional): (Ascend only) Whether to remove FRAMEWORK data and other redundant data.
@@ -84,7 +84,8 @@ class _ExperimentalConfig:
84
84
  HCCS data, PCIe data, and Stars Chip Trans. Default: ``False``.
85
85
  host_sys (list, optional): Collect the data of system call classes on the host side.
86
86
  Default: ``[]``, indicating that system class data on the host side is not collected.
87
- You need to set `start_profile` of :class:`mindspore.profiler.profile` to ``False``.When collecting DISK or
87
+ You need to set `start_profile` of :class:`mindspore.profiler.profile` to ``False``.Currently, only
88
+ the **root user** supports collecting DISK or OSRT data, when collecting DISK or
88
89
  OSRT data, it is necessary to install the iotop, perf, and ltrace third-party tools in advance.
89
90
  For detailed steps, please refer to `Installing Third-party Tools
90
91
  <https://www.hiascend.com/document/detail/zh/mindstudio/80RC1/T&ITools/Profiling/atlasprofiling_16_0136.
@@ -98,6 +99,21 @@ class _ExperimentalConfig:
98
99
  <https://gitee.com/mindspore/mindspore/blob/master/docs/api/api_python/mindspore/script/
99
100
  msprof_data_collection.sh>`_.
100
101
 
102
+ Final deliverables by `MindStudio Insight
103
+ <https://www.hiascend.com/developer/download/community/result?module=pt+sto+cann>`_
104
+ tool visualizes the analysis results.
105
+ For detailed analysis, please refer to `host-side CPU data analysis
106
+ <https://www.hiascend.com/document/detail/zh/mindstudio/80RC1/T&ITools/Profiling/
107
+ atlasprofiling_16_0106.html>`_, `host-side MEM data analysis
108
+ <https://www.hiascend.com/document/detail/zh/mindstudio/80RC1/T&ITools/Profiling/
109
+ atlasprofiling_16_0107.html>`_, `host-side DISK data analysis
110
+ <https://www.hiascend.com/document/detail/zh/mindstudio/80RC1/T&ITools/Profiling/
111
+ atlasprofiling_16_0108.html>`_, `host-side NETWORK data analysis
112
+ <https://www.hiascend.com/document/detail/zh/mindstudio/80RC1/T&ITools/Profiling/
113
+ atlasprofiling_16_0109.html>`_, `host-side OSRT data analysis
114
+ <https://www.hiascend.com/document/detail/zh/mindstudio/80RC1/T&ITools/Profiling/
115
+ atlasprofiling_16_0110.html>`_.
116
+
101
117
  - HostSystem.CPU: Collect the CPU utilization at the process level.
102
118
  - HostSystem.MEM: Collect the memory utilization at the process level.
103
119
  - HostSystem.DISK: Collect the disk I/O utilization at the process level.
@@ -16,10 +16,11 @@
16
16
  import mindspore._c_expression as c_expression
17
17
 
18
18
  from mindspore.profiler.common.registry import PROFILERS
19
- from mindspore.profiler.common.constant import DeviceTarget, ProfilerActivity
19
+ from mindspore.profiler.common.constant import DeviceTarget, ProfilerActivity, AnalysisMode
20
20
  from mindspore.profiler.common.util import print_msg_with_pid
21
21
  from mindspore.profiler.common.profiler_context import ProfilerContext
22
22
  from mindspore.profiler.common.profiler_path_manager import ProfilerPathManager
23
+ from mindspore.profiler.common.process_pool import MultiProcessPool
23
24
  from mindspore.profiler.platform.base_profiler import BaseProfiler
24
25
  from mindspore.profiler.analysis.time_converter import TimeConverter
25
26
  from mindspore.profiler.analysis.task_manager import TaskManager
@@ -68,7 +69,7 @@ class CpuProfiler(BaseProfiler):
68
69
  if ProfilerContext().device_target_set != {DeviceTarget.CPU.value}:
69
70
  return
70
71
  self._logger.info("CpuProfiler analyse.")
71
- CPUProfilerAnalysis.online_analyse()
72
+ CPUProfilerAnalysis.online_analyse(**kwargs)
72
73
 
73
74
  def finalize(self) -> None:
74
75
  """Finalize profiling data."""
@@ -81,12 +82,17 @@ class CPUProfilerAnalysis:
81
82
  """
82
83
 
83
84
  @classmethod
84
- def online_analyse(cls):
85
+ def online_analyse(cls, async_mode: bool = False):
85
86
  """
86
87
  Online analysis for CPU
87
88
  """
88
89
  cls._pre_analyse_online()
89
- cls._run_tasks(**ProfilerContext().to_dict())
90
+ if async_mode:
91
+ ProfilerContext().mode = AnalysisMode.ASYNC_MODE.value
92
+ MultiProcessPool().add_async_job(cls._run_tasks, **ProfilerContext().to_dict())
93
+ else:
94
+ ProfilerContext().mode = AnalysisMode.SYNC_MODE.value
95
+ cls._run_tasks(**ProfilerContext().to_dict())
90
96
 
91
97
  @classmethod
92
98
  def _pre_analyse_online(cls):
@@ -36,6 +36,8 @@ from mindspore.profiler.platform.base_profiler import BaseProfiler
36
36
  from mindspore.profiler.common.profiler_path_manager import ProfilerPathManager
37
37
  from mindspore.profiler.common.profiler_info import ProfilerInfo
38
38
  from mindspore.profiler.common.process_pool import MultiProcessPool
39
+ from mindspore.profiler.common.constant import MsprofModeName
40
+ from mindspore.profiler.common.util import no_exception_func
39
41
  from mindspore.profiler.analysis.task_manager import TaskManager
40
42
  from mindspore.profiler.analysis.time_converter import TimeConverter
41
43
  from mindspore.profiler.analysis.parser.ascend_cann_parser import AscendMsprofParser
@@ -58,6 +60,7 @@ from mindspore.profiler.analysis.viewer.ms_operator_details_viewer import MsOper
58
60
  from mindspore.profiler.common.util import print_msg_with_pid
59
61
  from mindspore.profiler.common.log import ProfilerLogger
60
62
  from mindspore.profiler.mstx import Mstx
63
+ from mindspore.profiler.common.util import get_device_id
61
64
 
62
65
 
63
66
  @PROFILERS.register_module(DeviceTarget.NPU.value)
@@ -68,6 +71,7 @@ class NpuProfiler(BaseProfiler):
68
71
 
69
72
  def __init__(self) -> None:
70
73
  super().__init__()
74
+ self._is_env_not_valid = self._is_environment_not_valid()
71
75
  self._prof_ctx = ProfilerContext()
72
76
  self._prof_info = ProfilerInfo()
73
77
  self._prof_path_mgr = ProfilerPathManager()
@@ -78,7 +82,7 @@ class NpuProfiler(BaseProfiler):
78
82
  # initialize profiler backend
79
83
  self._profiler.init(
80
84
  self._prof_ctx.ascend_ms_dir,
81
- int(self._prof_ctx.device_id),
85
+ int(get_device_id()),
82
86
  json.dumps(self._prof_ctx.npu_profiler_params),
83
87
  )
84
88
  self._logger.info("NpuProfiler init profiler backend params %s",
@@ -97,6 +101,8 @@ class NpuProfiler(BaseProfiler):
97
101
 
98
102
  def start(self) -> None:
99
103
  """Start profiling."""
104
+ if self._is_env_not_valid:
105
+ return
100
106
  self._logger.info("NpuProfiler start.")
101
107
 
102
108
  Mstx.enable = self._prof_ctx.npu_profiler_params.get("mstx", False)
@@ -115,6 +121,8 @@ class NpuProfiler(BaseProfiler):
115
121
 
116
122
  def stop(self) -> None:
117
123
  """Stop profiling."""
124
+ if self._is_env_not_valid:
125
+ return
118
126
  self._logger.info("NpuProfiler stop.")
119
127
 
120
128
  Mstx.enable = False
@@ -149,16 +157,29 @@ class NpuProfiler(BaseProfiler):
149
157
 
150
158
  def analyse(self, **kwargs) -> None:
151
159
  """Analyse the profiling data."""
160
+ if self._is_env_not_valid:
161
+ return
152
162
  self._logger.info("NpuProfiler analyse.")
153
163
 
154
- NPUProfilerAnalysis.online_analyse()
164
+ NPUProfilerAnalysis.online_analyse(async_mode=kwargs.get('async_mode'))
155
165
 
156
166
  def finalize(self) -> None:
157
167
  """Finalize profiling data."""
168
+ if self._is_env_not_valid:
169
+ return
158
170
  self._logger.info("NpuProfiler finalize.")
159
171
  if self._profiler:
160
172
  self._profiler.finalize()
161
173
 
174
+ @staticmethod
175
+ def _is_environment_not_valid() -> bool:
176
+ # check msprof dynamic environment variable
177
+ if os.getenv(MsprofModeName.MSPROF_DYNAMIC_ENV) is not None:
178
+ logger.error(f"The environment variable '{MsprofModeName.MSPROF_DYNAMIC_ENV}' has been set."
179
+ f"Please execute 'unset {MsprofModeName.MSPROF_DYNAMIC_ENV}'.")
180
+ return True
181
+ return False
182
+
162
183
 
163
184
  class NPUProfilerAnalysis:
164
185
  """
@@ -166,6 +187,7 @@ class NPUProfilerAnalysis:
166
187
  """
167
188
 
168
189
  @classmethod
190
+ @no_exception_func()
169
191
  def online_analyse(cls, async_mode: bool = False):
170
192
  """
171
193
  Online analysis for NPU
@@ -179,6 +201,7 @@ class NPUProfilerAnalysis:
179
201
  cls._run_tasks(**ProfilerContext().to_dict())
180
202
 
181
203
  @classmethod
204
+ @no_exception_func()
182
205
  def offline_analyse(
183
206
  cls,
184
207
  path: str,
@@ -262,11 +285,15 @@ class NPUProfilerAnalysis:
262
285
  task_mgr = cls._construct_task_mgr(**kwargs)
263
286
  task_mgr.run()
264
287
  ProfilerLogger.get_instance().info(json.dumps(task_mgr.cost_time, indent=4))
265
- activities = kwargs.get("activities")
266
- if activities and ProfilerActivity.NPU.value in activities:
267
- ProfilerPathManager().move_db_file()
268
- if kwargs.get("data_simplification") and ProfilerActivity.NPU.value in kwargs.get("activities"):
269
- ProfilerPathManager().simplify_data()
288
+ activities = kwargs.get("activities", [])
289
+ export_type = kwargs.get("export_type", [])
290
+ if ProfilerActivity.NPU.value in activities:
291
+ if ExportType.Db.value in export_type:
292
+ ProfilerPathManager().move_db_file()
293
+ else:
294
+ ProfilerPathManager().remove_db_file()
295
+ if kwargs.get("data_simplification"):
296
+ ProfilerPathManager().simplify_data()
270
297
 
271
298
  @classmethod
272
299
  def _construct_task_mgr(cls, **kwargs) -> TaskManager: