mindspore 2.4.10__cp311-cp311-win_amd64.whl → 2.5.0__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 (366) hide show
  1. mindspore/.commit_id +1 -1
  2. mindspore/__init__.py +8 -3
  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 +0 -5
  7. mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
  8. mindspore/_extends/parse/compile_config.py +64 -0
  9. mindspore/_extends/parse/deprecated/__init__.py +0 -0
  10. mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +375 -0
  11. mindspore/_extends/parse/parser.py +23 -5
  12. mindspore/_extends/parse/standard_method.py +123 -27
  13. mindspore/_extends/pijit/pijit_func_white_list.py +1 -1
  14. mindspore/amp.py +7 -1
  15. mindspore/avcodec-59.dll +0 -0
  16. mindspore/avdevice-59.dll +0 -0
  17. mindspore/avfilter-8.dll +0 -0
  18. mindspore/avformat-59.dll +0 -0
  19. mindspore/avutil-57.dll +0 -0
  20. mindspore/boost/boost_cell_wrapper.py +136 -41
  21. mindspore/common/__init__.py +3 -1
  22. mindspore/common/_register_for_tensor.py +0 -1
  23. mindspore/common/_stub_tensor.py +25 -4
  24. mindspore/common/_tensor_cpp_method.py +17 -0
  25. mindspore/common/_tensor_docs.py +6132 -0
  26. mindspore/common/api.py +98 -21
  27. mindspore/common/dtype.py +34 -34
  28. mindspore/common/dump.py +2 -1
  29. mindspore/common/file_system.py +8 -3
  30. mindspore/common/generator.py +2 -0
  31. mindspore/common/hook_handle.py +3 -1
  32. mindspore/common/initializer.py +3 -4
  33. mindspore/common/lazy_inline.py +8 -2
  34. mindspore/common/mindir_util.py +10 -2
  35. mindspore/common/parameter.py +31 -15
  36. mindspore/common/tensor.py +713 -1337
  37. mindspore/communication/__init__.py +1 -1
  38. mindspore/communication/_comm_helper.py +5 -0
  39. mindspore/communication/comm_func.py +215 -173
  40. mindspore/communication/management.py +23 -20
  41. mindspore/context.py +285 -191
  42. mindspore/dataset/__init__.py +23 -19
  43. mindspore/dataset/callback/ds_callback.py +2 -1
  44. mindspore/dataset/core/config.py +84 -3
  45. mindspore/dataset/engine/cache_admin.py +3 -3
  46. mindspore/dataset/engine/cache_client.py +5 -4
  47. mindspore/dataset/engine/datasets.py +192 -149
  48. mindspore/dataset/engine/datasets_audio.py +14 -0
  49. mindspore/dataset/engine/datasets_standard_format.py +11 -11
  50. mindspore/dataset/engine/datasets_text.py +38 -1
  51. mindspore/dataset/engine/datasets_user_defined.py +100 -66
  52. mindspore/dataset/engine/datasets_vision.py +81 -8
  53. mindspore/dataset/engine/iterators.py +281 -63
  54. mindspore/dataset/engine/obs/util.py +8 -0
  55. mindspore/dataset/engine/queue.py +40 -0
  56. mindspore/dataset/engine/samplers.py +26 -2
  57. mindspore/dataset/engine/serializer_deserializer.py +1 -1
  58. mindspore/dataset/engine/validators.py +43 -11
  59. mindspore/dataset/transforms/py_transforms_util.py +17 -0
  60. mindspore/dataset/transforms/transforms.py +29 -12
  61. mindspore/dataset/vision/validators.py +1 -2
  62. mindspore/device_context/__init__.py +21 -0
  63. mindspore/device_context/ascend/__init__.py +25 -0
  64. mindspore/device_context/ascend/device.py +72 -0
  65. mindspore/device_context/ascend/op_debug.py +94 -0
  66. mindspore/device_context/ascend/op_precision.py +193 -0
  67. mindspore/device_context/ascend/op_tuning.py +127 -0
  68. mindspore/device_context/cpu/__init__.py +25 -0
  69. mindspore/device_context/cpu/device.py +62 -0
  70. mindspore/device_context/cpu/op_tuning.py +43 -0
  71. mindspore/device_context/gpu/__init__.py +21 -0
  72. mindspore/device_context/gpu/device.py +70 -0
  73. mindspore/device_context/gpu/op_precision.py +67 -0
  74. mindspore/device_context/gpu/op_tuning.py +175 -0
  75. mindspore/device_manager.py +134 -0
  76. mindspore/dnnl.dll +0 -0
  77. mindspore/experimental/llm_boost/__init__.py +1 -0
  78. mindspore/experimental/llm_boost/ascend_native/__init__.py +22 -0
  79. mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +211 -0
  80. mindspore/experimental/llm_boost/ascend_native/llm_boost.py +52 -0
  81. mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
  82. mindspore/experimental/llm_boost/atb/llama_boost.py +6 -1
  83. mindspore/experimental/llm_boost/register.py +1 -0
  84. mindspore/experimental/optim/adadelta.py +26 -22
  85. mindspore/experimental/optim/adam.py +3 -0
  86. mindspore/experimental/optim/lr_scheduler.py +33 -24
  87. mindspore/experimental/optim/radam.py +33 -30
  88. mindspore/hal/device.py +28 -0
  89. mindspore/hal/event.py +17 -0
  90. mindspore/hal/memory.py +94 -3
  91. mindspore/hal/stream.py +91 -6
  92. mindspore/include/api/context.h +0 -1
  93. mindspore/jpeg62.dll +0 -0
  94. mindspore/log.py +12 -0
  95. mindspore/mindrecord/__init__.py +1 -1
  96. mindspore/mindrecord/config.py +17 -316
  97. mindspore/mindrecord/filereader.py +1 -9
  98. mindspore/mindrecord/filewriter.py +5 -15
  99. mindspore/mindrecord/mindpage.py +1 -9
  100. mindspore/mindspore_backend.dll +0 -0
  101. mindspore/mindspore_common.dll +0 -0
  102. mindspore/mindspore_core.dll +0 -0
  103. mindspore/mindspore_glog.dll +0 -0
  104. mindspore/mindspore_ops.dll +0 -0
  105. mindspore/mint/__init__.py +824 -218
  106. mindspore/mint/distributed/__init__.py +66 -4
  107. mindspore/mint/distributed/distributed.py +2594 -44
  108. mindspore/mint/linalg/__init__.py +6 -0
  109. mindspore/mint/nn/__init__.py +473 -14
  110. mindspore/mint/nn/functional.py +486 -11
  111. mindspore/mint/nn/layer/__init__.py +17 -4
  112. mindspore/mint/nn/layer/_functions.py +330 -0
  113. mindspore/mint/nn/layer/activation.py +169 -1
  114. mindspore/mint/nn/layer/basic.py +123 -0
  115. mindspore/mint/nn/layer/conv.py +727 -0
  116. mindspore/mint/nn/layer/normalization.py +215 -19
  117. mindspore/mint/nn/layer/padding.py +797 -0
  118. mindspore/mint/nn/layer/pooling.py +170 -0
  119. mindspore/mint/optim/__init__.py +2 -1
  120. mindspore/mint/optim/adam.py +223 -0
  121. mindspore/mint/optim/adamw.py +26 -19
  122. mindspore/mint/special/__init__.py +2 -1
  123. mindspore/multiprocessing/__init__.py +5 -0
  124. mindspore/nn/cell.py +126 -19
  125. mindspore/nn/dynamic_lr.py +2 -1
  126. mindspore/nn/layer/activation.py +6 -6
  127. mindspore/nn/layer/basic.py +35 -25
  128. mindspore/nn/layer/channel_shuffle.py +3 -3
  129. mindspore/nn/layer/embedding.py +3 -3
  130. mindspore/nn/layer/normalization.py +8 -7
  131. mindspore/nn/layer/padding.py +4 -3
  132. mindspore/nn/layer/pooling.py +47 -13
  133. mindspore/nn/layer/rnn_cells.py +1 -1
  134. mindspore/nn/layer/rnns.py +2 -1
  135. mindspore/nn/layer/timedistributed.py +5 -5
  136. mindspore/nn/layer/transformer.py +48 -26
  137. mindspore/nn/learning_rate_schedule.py +5 -3
  138. mindspore/nn/loss/loss.py +31 -36
  139. mindspore/nn/optim/ada_grad.py +1 -0
  140. mindspore/nn/optim/adadelta.py +2 -2
  141. mindspore/nn/optim/adam.py +1 -1
  142. mindspore/nn/optim/lars.py +1 -4
  143. mindspore/nn/optim/optimizer.py +1 -1
  144. mindspore/nn/optim/rprop.py +2 -2
  145. mindspore/nn/optim/thor.py +2 -1
  146. mindspore/nn/utils/init.py +13 -11
  147. mindspore/nn/wrap/cell_wrapper.py +4 -6
  148. mindspore/nn/wrap/loss_scale.py +3 -4
  149. mindspore/numpy/array_creations.py +60 -62
  150. mindspore/numpy/array_ops.py +148 -143
  151. mindspore/numpy/logic_ops.py +41 -42
  152. mindspore/numpy/math_ops.py +361 -359
  153. mindspore/numpy/utils.py +16 -16
  154. mindspore/numpy/utils_const.py +4 -4
  155. mindspore/opencv_core452.dll +0 -0
  156. mindspore/opencv_imgcodecs452.dll +0 -0
  157. mindspore/opencv_imgproc452.dll +0 -0
  158. mindspore/ops/__init__.py +2 -1
  159. mindspore/ops/_grad_experimental/grad_comm_ops.py +94 -13
  160. mindspore/ops/_grad_experimental/grad_debug_ops.py +6 -1
  161. mindspore/ops/_grad_experimental/grad_inner_ops.py +9 -0
  162. mindspore/ops/_grad_experimental/grad_math_ops.py +2 -1
  163. mindspore/ops/_op_impl/cpu/__init__.py +1 -0
  164. mindspore/ops/_op_impl/cpu/raise_op.py +28 -0
  165. mindspore/ops/_vmap/vmap_array_ops.py +20 -19
  166. mindspore/ops/_vmap/vmap_base.py +0 -2
  167. mindspore/ops/_vmap/vmap_grad_nn_ops.py +19 -13
  168. mindspore/ops/_vmap/vmap_math_ops.py +11 -9
  169. mindspore/ops/_vmap/vmap_nn_ops.py +20 -34
  170. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +149 -12
  171. mindspore/ops/auto_generate/gen_arg_handler.py +0 -61
  172. mindspore/ops/auto_generate/gen_extend_func.py +554 -60
  173. mindspore/ops/auto_generate/gen_ops_def.py +1621 -115
  174. mindspore/ops/auto_generate/gen_ops_prim.py +8024 -3409
  175. mindspore/ops/auto_generate/pyboost_inner_prim.py +183 -79
  176. mindspore/ops/composite/base.py +1 -1
  177. mindspore/ops/composite/multitype_ops/_compile_utils.py +229 -30
  178. mindspore/ops/composite/multitype_ops/pow_impl.py +0 -29
  179. mindspore/ops/function/__init__.py +12 -0
  180. mindspore/ops/function/array_func.py +561 -159
  181. mindspore/ops/function/clip_func.py +64 -0
  182. mindspore/ops/function/debug_func.py +28 -20
  183. mindspore/ops/function/image_func.py +1 -1
  184. mindspore/ops/function/linalg_func.py +5 -4
  185. mindspore/ops/function/math_func.py +1659 -290
  186. mindspore/ops/function/nn_func.py +988 -317
  187. mindspore/ops/function/parameter_func.py +3 -56
  188. mindspore/ops/function/random_func.py +243 -33
  189. mindspore/ops/function/sparse_unary_func.py +1 -1
  190. mindspore/ops/functional.py +18 -5
  191. mindspore/ops/functional_overload.py +897 -0
  192. mindspore/ops/operations/__init__.py +3 -2
  193. mindspore/ops/operations/_embedding_cache_ops.py +4 -4
  194. mindspore/ops/operations/_grad_ops.py +2 -34
  195. mindspore/ops/operations/_infer_ops.py +2 -1
  196. mindspore/ops/operations/_inner_ops.py +38 -8
  197. mindspore/ops/operations/array_ops.py +45 -303
  198. mindspore/ops/operations/comm_ops.py +19 -16
  199. mindspore/ops/operations/custom_ops.py +11 -55
  200. mindspore/ops/operations/debug_ops.py +42 -47
  201. mindspore/ops/operations/inner_ops.py +6 -4
  202. mindspore/ops/operations/linalg_ops.py +3 -2
  203. mindspore/ops/operations/manually_defined/ops_def.py +185 -104
  204. mindspore/ops/operations/math_ops.py +11 -216
  205. mindspore/ops/operations/nn_ops.py +146 -308
  206. mindspore/ops/primitive.py +23 -21
  207. mindspore/ops/tensor_method.py +1669 -0
  208. mindspore/ops_generate/aclnn_kernel_register_auto_cc_generator.py +110 -0
  209. mindspore/ops_generate/add_tensor_docs_generator.py +54 -0
  210. mindspore/ops_generate/arg_handler.py +0 -61
  211. mindspore/ops_generate/auto_grad_impl_cc_generator.py +135 -0
  212. mindspore/ops_generate/auto_grad_reg_cc_generator.py +93 -0
  213. mindspore/ops_generate/base_generator.py +11 -0
  214. mindspore/ops_generate/cpp_create_prim_instance_helper_generator.py +108 -0
  215. mindspore/ops_generate/functional_map_cpp_generator.py +491 -0
  216. mindspore/ops_generate/functional_overload_py_generator.py +110 -0
  217. mindspore/ops_generate/functions_cc_generator.py +233 -0
  218. mindspore/ops_generate/gen_aclnn_implement.py +110 -114
  219. mindspore/ops_generate/gen_constants.py +157 -3
  220. mindspore/ops_generate/gen_ops.py +245 -990
  221. mindspore/ops_generate/gen_pyboost_func.py +97 -998
  222. mindspore/ops_generate/gen_utils.py +119 -33
  223. mindspore/ops_generate/lite_ops_cpp_generator.py +155 -0
  224. mindspore/ops_generate/op_api_proto.py +206 -0
  225. mindspore/ops_generate/op_def_py_generator.py +131 -0
  226. mindspore/ops_generate/op_prim_py_generator.py +480 -0
  227. mindspore/ops_generate/op_proto.py +373 -108
  228. mindspore/ops_generate/op_template_parser.py +436 -0
  229. mindspore/ops_generate/ops_def_cc_generator.py +288 -0
  230. mindspore/ops_generate/ops_def_h_generator.py +74 -0
  231. mindspore/ops_generate/ops_name_h_generator.py +68 -0
  232. mindspore/ops_generate/ops_primitive_h_generator.py +81 -0
  233. mindspore/ops_generate/pyboost_functions_cpp_generator.py +370 -0
  234. mindspore/ops_generate/pyboost_functions_h_generator.py +68 -0
  235. mindspore/ops_generate/pyboost_functions_py_generator.py +148 -0
  236. mindspore/ops_generate/pyboost_grad_function_cpp_generator.py +154 -0
  237. mindspore/ops_generate/pyboost_inner_prim_generator.py +131 -0
  238. mindspore/ops_generate/pyboost_native_grad_functions_generator.py +268 -0
  239. mindspore/ops_generate/pyboost_op_cpp_code_generator.py +851 -0
  240. mindspore/ops_generate/pyboost_overload_functions_cpp_generator.py +344 -0
  241. mindspore/ops_generate/pyboost_utils.py +92 -33
  242. mindspore/ops_generate/template.py +294 -44
  243. mindspore/ops_generate/tensor_func_reg_cpp_generator.py +422 -0
  244. mindspore/parallel/__init__.py +3 -3
  245. mindspore/parallel/_auto_parallel_context.py +24 -33
  246. mindspore/parallel/_parallel_serialization.py +13 -2
  247. mindspore/parallel/_utils.py +4 -1
  248. mindspore/parallel/algo_parameter_config.py +1 -1
  249. mindspore/parallel/checkpoint_transform.py +44 -0
  250. mindspore/parallel/cluster/process_entity/_api.py +131 -37
  251. mindspore/parallel/cluster/process_entity/_utils.py +41 -6
  252. mindspore/parallel/cluster/run.py +20 -3
  253. mindspore/parallel/parameter_broadcast.py +1 -1
  254. mindspore/parallel/shard.py +3 -0
  255. mindspore/parallel/transform_safetensors.py +119 -253
  256. mindspore/profiler/__init__.py +17 -4
  257. mindspore/profiler/analysis/__init__.py +0 -0
  258. mindspore/profiler/analysis/parser/__init__.py +0 -0
  259. mindspore/profiler/analysis/parser/ascend_cann_parser.py +166 -0
  260. mindspore/profiler/analysis/parser/base_parser.py +158 -0
  261. mindspore/profiler/analysis/parser/framework_cann_relation_parser.py +45 -0
  262. mindspore/profiler/analysis/parser/ms_framework_parser.py +142 -0
  263. mindspore/profiler/analysis/parser/ms_minddata_parser.py +145 -0
  264. mindspore/profiler/analysis/parser/timeline_assembly_factory/__init__.py +0 -0
  265. mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +261 -0
  266. mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +40 -0
  267. mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +84 -0
  268. mindspore/profiler/analysis/parser/timeline_creator/__init__.py +0 -0
  269. mindspore/profiler/analysis/parser/timeline_creator/base_timeline_creator.py +44 -0
  270. mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +90 -0
  271. mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +76 -0
  272. mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +103 -0
  273. mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +134 -0
  274. mindspore/profiler/analysis/parser/timeline_event/__init__.py +0 -0
  275. mindspore/profiler/analysis/parser/timeline_event/base_event.py +233 -0
  276. mindspore/profiler/analysis/parser/timeline_event/cpu_op_event.py +47 -0
  277. mindspore/profiler/analysis/parser/timeline_event/flow_event.py +36 -0
  278. mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +260 -0
  279. mindspore/profiler/analysis/parser/timeline_event/msprof_event.py +73 -0
  280. mindspore/profiler/analysis/parser/timeline_event/scope_layer_event.py +53 -0
  281. mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +146 -0
  282. mindspore/profiler/analysis/task_manager.py +131 -0
  283. mindspore/profiler/analysis/time_converter.py +84 -0
  284. mindspore/profiler/analysis/viewer/__init__.py +0 -0
  285. mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +333 -0
  286. mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +87 -0
  287. mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +252 -0
  288. mindspore/profiler/analysis/viewer/ascend_memory_viewer.py +313 -0
  289. mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +322 -0
  290. mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +265 -0
  291. mindspore/profiler/analysis/viewer/ascend_timeline_viewer.py +58 -0
  292. mindspore/profiler/analysis/viewer/base_viewer.py +26 -0
  293. mindspore/profiler/analysis/viewer/ms_dataset_viewer.py +97 -0
  294. mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +581 -0
  295. mindspore/profiler/analysis/work_flow.py +73 -0
  296. mindspore/profiler/common/ascend_msprof_exporter.py +138 -0
  297. mindspore/profiler/common/command_executor.py +90 -0
  298. mindspore/profiler/common/constant.py +174 -3
  299. mindspore/profiler/common/file_manager.py +208 -0
  300. mindspore/profiler/common/log.py +130 -0
  301. mindspore/profiler/common/msprof_cmd_tool.py +202 -0
  302. mindspore/profiler/common/path_manager.py +371 -0
  303. mindspore/profiler/common/process_bar.py +168 -0
  304. mindspore/profiler/common/process_pool.py +9 -3
  305. mindspore/profiler/common/profiler_context.py +476 -0
  306. mindspore/profiler/common/profiler_info.py +304 -0
  307. mindspore/profiler/common/profiler_output_path.py +284 -0
  308. mindspore/profiler/common/profiler_parameters.py +210 -0
  309. mindspore/profiler/common/profiler_path_manager.py +120 -0
  310. mindspore/profiler/common/record_function.py +76 -0
  311. mindspore/profiler/common/tlv_decoder.py +76 -0
  312. mindspore/profiler/common/util.py +75 -2
  313. mindspore/profiler/dynamic_profiler.py +270 -37
  314. mindspore/profiler/envprofiler.py +138 -0
  315. mindspore/profiler/mstx.py +199 -0
  316. mindspore/profiler/platform/__init__.py +21 -0
  317. mindspore/profiler/platform/base_profiler.py +40 -0
  318. mindspore/profiler/platform/cpu_profiler.py +124 -0
  319. mindspore/profiler/platform/gpu_profiler.py +74 -0
  320. mindspore/profiler/platform/npu_profiler.py +309 -0
  321. mindspore/profiler/profiler.py +580 -93
  322. mindspore/profiler/profiler_action_controller.py +187 -0
  323. mindspore/profiler/profiler_interface.py +114 -0
  324. mindspore/profiler/schedule.py +208 -0
  325. mindspore/rewrite/api/symbol_tree.py +1 -2
  326. mindspore/run_check/_check_version.py +2 -6
  327. mindspore/runtime/__init__.py +37 -0
  328. mindspore/runtime/device.py +27 -0
  329. mindspore/runtime/event.py +209 -0
  330. mindspore/runtime/executor.py +148 -0
  331. mindspore/runtime/memory.py +392 -0
  332. mindspore/runtime/stream.py +460 -0
  333. mindspore/runtime/thread_bind_core.py +401 -0
  334. mindspore/swresample-4.dll +0 -0
  335. mindspore/swscale-6.dll +0 -0
  336. mindspore/tinyxml2.dll +0 -0
  337. mindspore/train/__init__.py +2 -2
  338. mindspore/train/_utils.py +53 -18
  339. mindspore/train/amp.py +8 -4
  340. mindspore/train/callback/_checkpoint.py +32 -18
  341. mindspore/train/callback/_early_stop.py +1 -1
  342. mindspore/train/callback/_flops_collector.py +105 -69
  343. mindspore/train/callback/_history.py +1 -1
  344. mindspore/train/callback/_summary_collector.py +44 -6
  345. mindspore/train/callback/_tft_register.py +31 -10
  346. mindspore/train/dataset_helper.py +11 -11
  347. mindspore/train/metrics/precision.py +4 -5
  348. mindspore/train/mind_ir_pb2.py +167 -46
  349. mindspore/train/model.py +13 -15
  350. mindspore/train/serialization.py +462 -76
  351. mindspore/train/summary/summary_record.py +1 -2
  352. mindspore/train/train_thor/model_thor.py +1 -1
  353. mindspore/turbojpeg.dll +0 -0
  354. mindspore/utils/__init__.py +4 -2
  355. mindspore/utils/dryrun.py +138 -0
  356. mindspore/utils/runtime_execution_order_check.py +550 -0
  357. mindspore/version.py +1 -1
  358. {mindspore-2.4.10.dist-info → mindspore-2.5.0.dist-info}/METADATA +2 -3
  359. {mindspore-2.4.10.dist-info → mindspore-2.5.0.dist-info}/RECORD +362 -238
  360. {mindspore-2.4.10.dist-info → mindspore-2.5.0.dist-info}/entry_points.txt +1 -1
  361. mindspore/common/_tensor_overload.py +0 -139
  362. mindspore/mindspore_np_dtype.dll +0 -0
  363. mindspore/profiler/envprofiling.py +0 -254
  364. mindspore/profiler/profiling.py +0 -1926
  365. {mindspore-2.4.10.dist-info → mindspore-2.5.0.dist-info}/WHEEL +0 -0
  366. {mindspore-2.4.10.dist-info → mindspore-2.5.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,187 @@
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
+ """Profiler Action Controller"""
16
+ from functools import partial
17
+ from typing import Dict, Optional, Callable, Any
18
+
19
+ from mindspore.profiler.profiler_interface import ProfilerInterface
20
+ from mindspore.profiler.schedule import ProfilerAction
21
+
22
+ from mindspore import log as logger
23
+
24
+ __all__ = []
25
+
26
+
27
+ class ProfilerActionController:
28
+ """
29
+ A controller class for managing profiler actions and transitions.
30
+
31
+ This class handles the actions and transitions between different profiler states.
32
+ It uses two maps, abnormal_action_map and normal_action_map, to determine the actions
33
+ to take based on the previous and current profiler actions.
34
+
35
+ Attributes:
36
+ profiler: The profiler instance associated with this controller.
37
+ prof_interface (ProfilerInterface): The profiler interface instance.
38
+ on_trace_ready (Optional[Callable[..., Any]]): A callback function to be called when the trace is ready.
39
+ abnormal_action_map (Dict): A map of abnormal transitions and their corresponding actions.
40
+ normal_action_map (Dict): A map of normal transitions and their corresponding actions.
41
+ """
42
+
43
+ def __init__(self, prof_interface: ProfilerInterface, on_trace_ready: Optional[Callable[..., Any]] = None) -> None:
44
+ """
45
+ Initializes a new instance of ProfActionController.
46
+
47
+ Args:
48
+ prof_interface (ProfilerInterface): The profiler interface instance.
49
+ on_trace_ready (Optional[Callable[..., Any]]): A callback function to be called when the trace is ready.
50
+ """
51
+ self.prof_interface = prof_interface
52
+ self.abnormal_action_map: Dict = self.init_abnormal_action_map()
53
+ self.normal_action_map: Dict = self.init_normal_action_map()
54
+ self.on_trace_ready = on_trace_ready
55
+
56
+ def _trace_ready(self):
57
+ """
58
+ Calls the on_trace_ready callback function if it is set.
59
+
60
+ This method is called when the trace is ready to notify the callback function.
61
+ """
62
+ if self.on_trace_ready:
63
+ self.on_trace_ready()
64
+
65
+ def transit_action(self, prev_action: ProfilerAction, current_action: ProfilerAction) -> None:
66
+ """
67
+ Handles actions between previous action and latter action
68
+
69
+ Args:
70
+ prev_action: The previous state
71
+ current_action: the latter state
72
+ """
73
+ # Check whether the action is in the abnormal map
74
+ action_list = self.abnormal_action_map.get((prev_action, current_action), [])
75
+ if not action_list:
76
+ if isinstance(prev_action, ProfilerAction) and isinstance(current_action, ProfilerAction):
77
+ # Check whether the action is in the normal map
78
+ action_list = self.handle_normal_action(prev_action, current_action)
79
+ if not action_list:
80
+ return
81
+ for action in action_list:
82
+ action()
83
+
84
+ def handle_normal_action(self, start_state: ProfilerAction, end_state: ProfilerAction) -> list:
85
+ """
86
+ Obtain the action in the normal state
87
+
88
+ Args:
89
+ start_state: The previous state
90
+ end_state: the latter state
91
+
92
+ Returns:
93
+ process_action list
94
+ """
95
+ process_action = []
96
+ initial_state = start_state
97
+
98
+ # Handle special case for ProfilerAction.RECORD_AND_SAVE to ProfilerAction.RECORD_AND_SAVE transition
99
+ if start_state == ProfilerAction.RECORD_AND_SAVE and end_state == ProfilerAction.RECORD_AND_SAVE:
100
+ process_action = [self.prof_interface.stop, self.prof_interface.finalize,
101
+ self._trace_ready, self.prof_interface.init,
102
+ self.prof_interface.start]
103
+ else:
104
+ while start_state != end_state:
105
+ process_action.extend(self.normal_action_map[start_state])
106
+ start_state = ProfilerAction.get_by_value((start_state.value + 1) % len(ProfilerAction))
107
+
108
+ # Handle special cases for NONE to NONE, WARM_UP to WARM_UP, RECORD to RECORD transitions
109
+ if initial_state == start_state and initial_state != ProfilerAction.RECORD_AND_SAVE:
110
+ process_action = []
111
+
112
+ return process_action
113
+
114
+ def init_normal_action_map(self) -> dict:
115
+ """
116
+ Generate a normal action map
117
+
118
+ Returns:
119
+ normal_action_map map
120
+ """
121
+ return {
122
+ ProfilerAction.NONE: [self.prof_interface.init],
123
+ ProfilerAction.WARM_UP: [self.prof_interface.start],
124
+ ProfilerAction.RECORD: [],
125
+ ProfilerAction.RECORD_AND_SAVE: [
126
+ self.prof_interface.stop,
127
+ self.prof_interface.finalize,
128
+ self._trace_ready,
129
+ self.prof_interface.clear
130
+ ]
131
+ }
132
+
133
+ def init_abnormal_action_map(self) -> dict:
134
+ """
135
+ Generate a abnormal action map
136
+
137
+ Returns:
138
+ abnormal_action_map map
139
+ """
140
+ return {
141
+ (ProfilerAction.WARM_UP, ProfilerAction.NONE): [
142
+ partial(logger.warning, "Incorrect schedule: WARMUP followed by NONE"),
143
+ self.prof_interface.start,
144
+ self.prof_interface.stop,
145
+ self.prof_interface.finalize,
146
+ self.prof_interface.clear
147
+ ],
148
+ (ProfilerAction.RECORD, ProfilerAction.NONE): [
149
+ partial(logger.warning, "Incorrect schedule: RECORD followed by NONE"),
150
+ self.prof_interface.stop,
151
+ self.prof_interface.finalize,
152
+ self.prof_interface.clear
153
+ ],
154
+ (ProfilerAction.RECORD, ProfilerAction.WARM_UP): [
155
+ partial(logger.warning, "Incorrect schedule: RECORD followed by WARMUP"),
156
+ self.prof_interface.stop,
157
+ self.prof_interface.finalize,
158
+ self.prof_interface.clear
159
+ ],
160
+ # used for exit action
161
+ (ProfilerAction.WARM_UP, None): [
162
+ partial(logger.warning,
163
+ "Incorrect schedule: Stop profiler while current state is WARMUP "
164
+ "which will result in empty parsed data."),
165
+ self.prof_interface.finalize,
166
+ self.prof_interface.clear,
167
+ self.prof_interface.delete_dir
168
+ ],
169
+ (ProfilerAction.RECORD, None): [
170
+ partial(logger.warning,
171
+ "Incorrect schedule: Stop profiler while current state is RECORD "
172
+ "which may result in incomplete parsed data."),
173
+ self.prof_interface.stop,
174
+ self.prof_interface.finalize,
175
+ self._trace_ready,
176
+ self.prof_interface.clear
177
+ ],
178
+ (ProfilerAction.RECORD_AND_SAVE, None): [
179
+ partial(logger.warning,
180
+ "Stop profiler while current state is RECORD_AND_SAVE, "
181
+ "perhaps the scheduling cycle has not yet completed."),
182
+ self.prof_interface.stop,
183
+ self.prof_interface.finalize,
184
+ self._trace_ready,
185
+ self.prof_interface.clear
186
+ ]
187
+ }
@@ -0,0 +1,114 @@
1
+ # Copyright 2020-2024 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
+ """ProfilerInterface"""
16
+ from typing import Set
17
+
18
+ from mindspore import log as logger
19
+ from mindspore.common.api import _pynative_executor
20
+ from mindspore.profiler.common.registry import PROFILERS
21
+ from mindspore.profiler.platform.base_profiler import BaseProfiler
22
+ from mindspore.profiler.common.profiler_context import ProfilerContext
23
+ from mindspore.profiler.common.profiler_path_manager import ProfilerPathManager
24
+
25
+
26
+ class ProfilerInterface:
27
+ """
28
+ Profiler interface
29
+ """
30
+
31
+ cpu_profiler: BaseProfiler = None
32
+ device_profiler: BaseProfiler = None
33
+ platform_profilers_set: Set[BaseProfiler] = set()
34
+ is_initialized = False
35
+
36
+ @classmethod
37
+ def init(cls):
38
+ """ProfilerInterface init"""
39
+ if cls.is_initialized:
40
+ return
41
+
42
+ ProfilerPathManager().set_ascend_ms_dir()
43
+ ProfilerPathManager().create_profiler_paths()
44
+ platforms = ProfilerContext().device_target_set
45
+ for device_target in platforms:
46
+ cls.platform_profilers_set.add(PROFILERS.modules.get(device_target)())
47
+
48
+ cls.is_initialized = True
49
+ logger.info("ProfilerInterface init")
50
+
51
+ @classmethod
52
+ def start(cls):
53
+ """ProfilerInterface start"""
54
+ if not cls.is_initialized:
55
+ logger.warning("ProfilerInterface start failed, profiler has not been initialized.")
56
+ return
57
+
58
+ for profiler in cls.platform_profilers_set:
59
+ profiler.start()
60
+
61
+ logger.info("ProfilerInterface start")
62
+
63
+ @classmethod
64
+ def stop(cls):
65
+ """ProfilerInterface stop"""
66
+ if not cls.is_initialized:
67
+ logger.warning("ProfilerInterface stop failed, profiler has not been initialized.")
68
+ return
69
+
70
+ _pynative_executor.sync()
71
+ for profiler in cls.platform_profilers_set:
72
+ profiler.stop()
73
+
74
+ logger.info("ProfilerInterface stop")
75
+
76
+ @classmethod
77
+ def analyse(cls):
78
+ """ProfilerInterface analyse"""
79
+ if not cls.is_initialized:
80
+ logger.warning("ProfilerInterface analyse failed, profiler has not been initialized.")
81
+ return
82
+
83
+ for profiler in cls.platform_profilers_set:
84
+ profiler.analyse()
85
+
86
+ logger.info("ProfilerInterface analyse")
87
+
88
+ @classmethod
89
+ def finalize(cls):
90
+ """ProfilerInterface finalize"""
91
+ if not cls.is_initialized:
92
+ logger.warning("ProfilerInterface finalize failed, profiler has not been initialized.")
93
+ return
94
+
95
+ for profiler in cls.platform_profilers_set:
96
+ profiler.finalize()
97
+ profiler = None
98
+
99
+ logger.info("ProfilerInterface finalize")
100
+
101
+ @classmethod
102
+ def clear(cls):
103
+ """ProfilerInterface clear"""
104
+ if not cls.is_initialized:
105
+ logger.warning("ProfilerInterface clear failed, profiler has not been initialized.")
106
+ return
107
+ cls.platform_profilers_set.clear()
108
+ cls.is_initialized = False
109
+ logger.info("ProfilerInterface clear")
110
+
111
+ @classmethod
112
+ def delete_dir(cls):
113
+ """ProfilerInterface delete dir"""
114
+ logger.info("ProfilerInterface delete dir")
@@ -0,0 +1,208 @@
1
+ # Copyright 2020-2023 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
+ """Profiler Schedule"""
16
+ from enum import Enum
17
+
18
+ from mindspore import log as logger
19
+
20
+ __all__ = ["ProfilerAction", "Schedule"]
21
+
22
+
23
+ class ProfilerAction(Enum):
24
+ """
25
+ Enum class representing different actions that can be performed by the profiler.
26
+
27
+ Each member of the enum represents a specific profiling action, which can be used
28
+ to control the behavior of the profiler at different stages of execution.
29
+
30
+ Attributes:
31
+ NONE (ProfilerAction): No profiling action.
32
+ WARM_UP (ProfilerAction): Warm-up phase of profiling.
33
+ RECORD (ProfilerAction): Record phase of profiling.
34
+ RECORD_AND_SAVE (ProfilerAction): Record and save phase of profiling.
35
+ """
36
+ NONE = 0
37
+ WARM_UP = 1
38
+ RECORD = 2
39
+ RECORD_AND_SAVE = 3
40
+
41
+ @staticmethod
42
+ def get_by_value(value):
43
+ """
44
+ Retrieves a ProfilerAction enum member by its value.
45
+
46
+ Args:
47
+ value (int): The value of the ProfilerAction enum member to retrieve.
48
+
49
+ Returns:
50
+ ProfilerAction, The enum member corresponding to the given value, or None if not found.
51
+ """
52
+ value_map = {action.value: action for action in ProfilerAction}
53
+ return value_map.get(value, None)
54
+
55
+
56
+ class Schedule:
57
+ r"""
58
+ This class use to get the actions of each step.
59
+ The schedule is as follows:
60
+
61
+ .. code-block::
62
+
63
+ (NONE) (NONE) (NONE) (WARM_UP) (RECORD) (RECORD) (RECORD_AND_SAVE) None
64
+ START------->skip_first------->wait-------->warmup-------->active........active.........active----------->stop
65
+ | |
66
+ | repeat_1 |
67
+ ---------------------------------------------------------------
68
+
69
+ The profiler will skip the first ``skip_first`` steps, then wait for ``wait`` steps,
70
+ then do the warmup for the next ``warmup`` steps, then do the active recording for the next
71
+ ``active`` steps and then repeat the cycle starting with ``wait`` steps. The optional number
72
+ of cycles is specified with the ``repeat`` parameter, the zero value means that
73
+ the cycles will continue until the profiling is finished.
74
+
75
+ Keyword Args:
76
+ wait (int): The number of steps to wait before starting the warm-up phase.
77
+ active (int): The number of steps to record data during the active phase.
78
+ warmup (int, optional): The number of steps to perform the warm-up phase. Default: ``0``.
79
+ repeat (int, optional): The number of times to repeat the cycle. Default: ``0``.
80
+ skip_first (int, optional): The number of steps to skip at the beginning. Default: ``0``.
81
+
82
+ Raises:
83
+ ValueError: When the parameter step is less than 0.
84
+
85
+ Supported Platforms:
86
+ ``Ascend``
87
+
88
+ Examples:
89
+ >>> import numpy as np
90
+ >>> import mindspore as ms
91
+ >>> import mindspore.dataset as ds
92
+ >>> from mindspore import context, nn, Profiler
93
+ >>> from mindspore.profiler import schedule, tensor_board_trace_handler
94
+ >>>
95
+ >>> class Net(nn.Cell):
96
+ ... def __init__(self):
97
+ ... super(Net, self).__init__()
98
+ ... self.fc = nn.Dense(2, 2)
99
+ ...
100
+ ... def construct(self, x):
101
+ ... return self.fc(x)
102
+ >>>
103
+ >>> def generator_net():
104
+ ... for _ in range(2):
105
+ ... yield np.ones([2, 2]).astype(np.float32), np.ones([2]).astype(np.int32)
106
+ >>>
107
+ >>> def train(test_net):
108
+ ... optimizer = nn.Momentum(test_net.trainable_params(), 1, 0.9)
109
+ ... loss = nn.SoftmaxCrossEntropyWithLogits(sparse=True)
110
+ ... data = ds.GeneratorDataset(generator_net(), ["data", "label"])
111
+ ... model = ms.train.Model(test_net, loss, optimizer)
112
+ ... model.train(1, data)
113
+ >>>
114
+ >>> if __name__ == '__main__':
115
+ ... context.set_context(mode=ms.PYNATIVE_MODE, device_target="Ascend")
116
+ ...
117
+ ... net = Net()
118
+ ... STEP_NUM = 15
119
+ ...
120
+ ... with Profiler(schedule=schedule(wait=1, warmup=1, active=2, repeat=1, skip_first=2),
121
+ ... on_trace_ready=tensor_board_trace_handler) as prof:
122
+ ... for i in range(STEP_NUM):
123
+ ... train(net)
124
+ ... prof.step()
125
+ """
126
+
127
+ def __init__(self, *, wait: int, active: int, warmup: int = 0, repeat: int = 0, skip_first: int = 0) -> None:
128
+ self.wait = wait
129
+ self.active = active
130
+ self.warmup = warmup
131
+ self.repeat = repeat
132
+ self.skip_first = skip_first
133
+ self._check_params()
134
+
135
+ def __call__(self, step: int) -> ProfilerAction:
136
+ """
137
+ Obtain the action of the specified step from the schedule.
138
+
139
+ Args:
140
+ step (int): step num.
141
+
142
+ Returns:
143
+ ProfilerAction, The action corresponding to a step.
144
+ """
145
+ if step < 0:
146
+ raise ValueError("Invalid parameter step, which must be not less than 0.")
147
+ if step < self.skip_first:
148
+ return ProfilerAction.NONE
149
+
150
+ step -= self.skip_first
151
+
152
+ num_steps = self.wait + self.warmup + self.active
153
+ if 0 < self.repeat <= step / num_steps:
154
+ return ProfilerAction.NONE
155
+
156
+ mod_step = step % num_steps
157
+ if mod_step < self.wait:
158
+ return ProfilerAction.NONE
159
+ if mod_step < self.wait + self.warmup:
160
+ return ProfilerAction.WARM_UP
161
+ return ProfilerAction.RECORD if mod_step < num_steps - 1 else ProfilerAction.RECORD_AND_SAVE
162
+
163
+ def _check_params(self):
164
+ """
165
+ Verify all parameters in the schedule,
166
+ and set them to default values if the parameters are not compliant.
167
+ """
168
+ if not isinstance(self.wait, int) or self.wait < 0:
169
+ logger.warning("Invalid parameter wait, reset it to 0.")
170
+ self.wait = 0
171
+ if not isinstance(self.warmup, int) or self.warmup < 0:
172
+ logger.warning("Invalid parameter warmup, reset it to 0.")
173
+ self.warmup = 0
174
+ if not isinstance(self.active, int) or self.active <= 0:
175
+ logger.warning("Invalid parameter active, reset it to 1.")
176
+ self.active = 1
177
+ if not isinstance(self.repeat, int) or self.repeat < 0:
178
+ logger.warning("Invalid parameter repeat, reset it to 0.")
179
+ self.repeat = 0
180
+ if not isinstance(self.skip_first, int) or self.skip_first < 0:
181
+ logger.warning("Invalid parameter skip_first, reset it to 0.")
182
+ self.skip_first = 0
183
+ if self.warmup == 0:
184
+ logger.warning("Profiler won't be using warmup, this can skew profiler results")
185
+
186
+ def to_dict(self):
187
+ """
188
+ Convert schedule to a dict.
189
+
190
+ Returns:
191
+ dict, the parameters of schedule and their values.
192
+ """
193
+ return {'wait': self.wait, 'active': self.active, 'warmup': self.warmup,
194
+ 'repeat': self.repeat, 'skip_first': self.skip_first}
195
+
196
+
197
+ def _default_schedule_fn(_: int) -> ProfilerAction:
198
+ """
199
+ Default profiler behavior - immediately starts recording the events,
200
+ keeps doing it on every profiler step.
201
+
202
+ Args:
203
+ _ (int): step num.
204
+
205
+ Returns:
206
+ ProfilerAction, The RECORD action.
207
+ """
208
+ return ProfilerAction.RECORD
@@ -331,8 +331,7 @@ class SymbolTree:
331
331
  Nodes in `new_nodes` will be inserted into SymbolTree sequentially, and then `old_node` will be deleted.
332
332
 
333
333
  Note:
334
- - Replace support one-to-one replacement or one-to-multi replacement. If you need multi-to-multi
335
- replacement, please refer to `PatternEngine`.
334
+ - Replace only support one-to-one replacement or one-to-multi replacement.
336
335
  - Caller should maintain the topological relationship between each node in the `new_nodes` , as well as
337
336
  the topological relationship between nodes in the `new_nodes` and nodes in the original tree.
338
337
 
@@ -25,6 +25,7 @@ from abc import abstractmethod, ABCMeta
25
25
  from packaging import version
26
26
  import numpy as np
27
27
  from mindspore import log as logger
28
+ from mindspore.log import vlog_print
28
29
  from mindspore._c_expression import MSContext, ms_ctx_param
29
30
  from ..version import __version__
30
31
 
@@ -286,12 +287,6 @@ class AscendEnvChecker(EnvChecker):
286
287
 
287
288
  def check_custom_version(self):
288
289
  """custom op version check"""
289
- custom_ascendc_soc_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
290
- "../lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel",
291
- MSContext.get_instance().get_ascend_soc_version())
292
- if not os.path.exists(custom_ascendc_soc_dir):
293
- logger.debug(f"The path {custom_ascendc_soc_dir} of the custom ascend c operator does not exist.")
294
- return False
295
290
 
296
291
  if not Path(self.compiler_version).is_file():
297
292
  return True
@@ -516,3 +511,4 @@ def _add_cuda_path():
516
511
  _set_pb_env()
517
512
  check_version_and_env_config()
518
513
  _add_cuda_path()
514
+ vlog_print("1", "ME", __file__, sys._getframe().f_lineno, "Initialization MindSpore.")
@@ -0,0 +1,37 @@
1
+ # Copyright 2024 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
+
16
+ """
17
+ The runtime interface.
18
+ """
19
+
20
+ from mindspore.runtime.executor import launch_blocking, dispatch_threads_num, set_cpu_affinity
21
+ from mindspore.runtime.memory import set_memory, memory_stats, memory_reserved, max_memory_reserved, empty_cache,\
22
+ reset_peak_memory_stats, memory_summary, memory_allocated,\
23
+ max_memory_allocated, reset_max_memory_reserved, reset_max_memory_allocated
24
+ from mindspore.runtime.stream import Stream, synchronize, set_cur_stream, current_stream, \
25
+ default_stream, communication_stream, StreamCtx
26
+ from mindspore.runtime.event import Event
27
+ from .executor import launch_blocking
28
+
29
+ __all__ = [
30
+ "launch_blocking", "dispatch_threads_num", "set_cpu_affinity",
31
+ "Stream", "communication_stream", "synchronize", "set_cur_stream", "current_stream", "default_stream", "StreamCtx",
32
+ "set_memory", "memory_stats", "memory_reserved", "max_memory_reserved", "empty_cache", "reset_peak_memory_stats",
33
+ "memory_summary", "memory_allocated", "max_memory_allocated", "reset_max_memory_reserved",
34
+ "reset_max_memory_allocated", "Event"
35
+ ]
36
+
37
+ __all__.sort()
@@ -0,0 +1,27 @@
1
+ # Copyright 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
+
16
+ """Runtime inner interfaces."""
17
+
18
+ from mindspore import log as logger
19
+ import mindspore as ms
20
+
21
+
22
+ def _is_supported():
23
+ device_target = ms.context.get_context("device_target")
24
+ if device_target == 'CPU':
25
+ logger.error(f"CPU device is not supported. Please use correct device")
26
+ return False
27
+ return True