mindspore 2.6.0__cp311-cp311-win_amd64.whl → 2.7.0rc1__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 (403) 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.cp311-win_amd64.pyd +0 -0
  6. mindspore/_c_expression.cp311-win_amd64.pyd +0 -0
  7. mindspore/_c_mindrecord.cp311-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 +36 -61
  15. mindspore/_extends/parse/resources.py +39 -0
  16. mindspore/_extends/parse/standard_method.py +32 -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 +76 -15
  37. mindspore/common/api.py +193 -112
  38. mindspore/common/dtype.py +21 -11
  39. mindspore/common/dump.py +10 -15
  40. mindspore/common/generator.py +2 -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 +48 -83
  49. mindspore/communication/_comm_helper.py +46 -4
  50. mindspore/communication/management.py +79 -7
  51. mindspore/context.py +38 -23
  52. mindspore/dataset/core/config.py +3 -3
  53. mindspore/dataset/engine/datasets.py +20 -7
  54. mindspore/dataset/engine/datasets_user_defined.py +32 -2
  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 -5
  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 +1 -0
  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 +4 -44
  116. mindspore/mint/distributed/__init__.py +1 -0
  117. mindspore/mint/distributed/distributed.py +208 -5
  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 +122 -98
  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 +325 -499
  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 +86 -85
  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 +1 -1
  157. mindspore/nn/optim/adasum.py +2 -2
  158. mindspore/nn/optim/optimizer.py +1 -1
  159. mindspore/nn/optim/thor.py +2 -2
  160. mindspore/nn/probability/distribution/exponential.py +2 -1
  161. mindspore/nn/probability/distribution/poisson.py +2 -1
  162. mindspore/nn/sparse/sparse.py +3 -3
  163. mindspore/nn/wrap/cell_wrapper.py +34 -37
  164. mindspore/nn/wrap/grad_reducer.py +37 -37
  165. mindspore/nn/wrap/loss_scale.py +72 -74
  166. mindspore/numpy/array_creations.py +5 -5
  167. mindspore/numpy/fft.py +1 -1
  168. mindspore/numpy/math_ops.py +1 -1
  169. mindspore/opencv_core452.dll +0 -0
  170. mindspore/opencv_imgcodecs452.dll +0 -0
  171. mindspore/opencv_imgproc452.dll +0 -0
  172. mindspore/ops/_grad_experimental/grad_comm_ops.py +51 -13
  173. mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -0
  174. mindspore/ops/_vmap/vmap_array_ops.py +6 -13
  175. mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
  176. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +17 -8
  177. mindspore/ops/auto_generate/gen_extend_func.py +1 -51
  178. mindspore/ops/auto_generate/gen_ops_def.py +463 -257
  179. mindspore/ops/auto_generate/gen_ops_prim.py +1127 -885
  180. mindspore/ops/auto_generate/pyboost_inner_prim.py +31 -1
  181. mindspore/ops/composite/__init__.py +10 -0
  182. mindspore/ops/composite/base.py +8 -4
  183. mindspore/ops/composite/multitype_ops/__init__.py +12 -1
  184. mindspore/ops/composite/multitype_ops/_compile_utils.py +132 -108
  185. mindspore/ops/composite/multitype_ops/add_impl.py +70 -2
  186. mindspore/ops/composite/multitype_ops/div_impl.py +49 -0
  187. mindspore/ops/composite/multitype_ops/floordiv_impl.py +29 -0
  188. mindspore/ops/composite/multitype_ops/getitem_impl.py +11 -0
  189. mindspore/ops/composite/multitype_ops/mod_impl.py +5 -3
  190. mindspore/ops/composite/multitype_ops/mul_impl.py +49 -0
  191. mindspore/ops/composite/multitype_ops/setitem_impl.py +57 -0
  192. mindspore/ops/composite/multitype_ops/sub_impl.py +34 -0
  193. mindspore/ops/composite/multitype_ops/zeros_like_impl.py +14 -0
  194. mindspore/ops/function/__init__.py +3 -1
  195. mindspore/ops/function/_add_attr_func.py +11 -6
  196. mindspore/ops/function/array_func.py +7 -94
  197. mindspore/ops/function/debug_func.py +4 -3
  198. mindspore/ops/function/grad/grad_func.py +1 -1
  199. mindspore/ops/function/math_func.py +21 -367
  200. mindspore/ops/function/nn_func.py +26 -41
  201. mindspore/ops/function/other_func.py +4 -1
  202. mindspore/ops/function/random_func.py +31 -4
  203. mindspore/ops/functional.py +0 -2
  204. mindspore/ops/functional_overload.py +463 -6
  205. mindspore/ops/op_info_register.py +21 -0
  206. mindspore/ops/operations/__init__.py +5 -2
  207. mindspore/ops/operations/_custom_ops_utils.py +675 -8
  208. mindspore/ops/operations/_inner_ops.py +3 -6
  209. mindspore/ops/operations/_sequence_ops.py +1 -1
  210. mindspore/ops/operations/comm_ops.py +185 -26
  211. mindspore/ops/operations/custom_ops.py +235 -172
  212. mindspore/ops/operations/debug_ops.py +55 -4
  213. mindspore/ops/operations/image_ops.py +13 -13
  214. mindspore/ops/operations/manually_defined/ops_def.py +15 -16
  215. mindspore/ops/operations/math_ops.py +3 -4
  216. mindspore/ops/operations/nn_ops.py +5 -6
  217. mindspore/ops/primitive.py +6 -10
  218. mindspore/ops/tensor_method.py +36 -4
  219. mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +1 -1
  220. mindspore/ops_generate/api/functional_map_cpp_generator.py +10 -9
  221. mindspore/ops_generate/api/functions_cc_generator.py +58 -10
  222. mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +1 -1
  223. mindspore/ops_generate/common/base_generator.py +14 -0
  224. mindspore/ops_generate/common/gen_constants.py +7 -2
  225. mindspore/ops_generate/common/gen_utils.py +0 -19
  226. mindspore/ops_generate/common/op_proto.py +11 -4
  227. mindspore/ops_generate/common/template.py +88 -11
  228. mindspore/ops_generate/gen_ops.py +1 -1
  229. mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +4 -4
  230. mindspore/ops_generate/op_def/ops_name_h_generator.py +0 -3
  231. mindspore/ops_generate/op_def/ops_primitive_h_generator.py +0 -4
  232. mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -2
  233. mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +49 -8
  234. mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +2 -2
  235. mindspore/ops_generate/pyboost/gen_pyboost_func.py +31 -0
  236. mindspore/ops_generate/pyboost/op_template_parser.py +98 -72
  237. mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +70 -273
  238. mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +14 -6
  239. mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +316 -0
  240. mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +1 -1
  241. mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +5 -3
  242. mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +1 -1
  243. mindspore/ops_generate/pyboost/pyboost_internal_functions_cpp_generator.py +76 -0
  244. mindspore/ops_generate/pyboost/pyboost_internal_functions_h_generator.py +76 -0
  245. mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +125 -0
  246. mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +4 -3
  247. mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +348 -61
  248. mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +1 -1
  249. mindspore/ops_generate/pyboost/pyboost_utils.py +118 -9
  250. mindspore/ops_generate/tensor_py_cc_generator.py +1 -24
  251. mindspore/parallel/_auto_parallel_context.py +4 -2
  252. mindspore/parallel/_cell_wrapper.py +106 -40
  253. mindspore/parallel/_parallel_serialization.py +1 -1
  254. mindspore/parallel/_ps_context.py +4 -6
  255. mindspore/parallel/_tensor.py +167 -12
  256. mindspore/parallel/_transformer/moe.py +1 -1
  257. mindspore/parallel/_transformer/transformer.py +13 -8
  258. mindspore/parallel/auto_parallel.py +12 -5
  259. mindspore/parallel/checkpoint_convert.py +3 -3
  260. mindspore/parallel/checkpoint_transform.py +3 -1
  261. mindspore/parallel/cluster/process_entity/_api.py +84 -48
  262. mindspore/parallel/cluster/process_entity/_utils.py +95 -7
  263. mindspore/parallel/cluster/run.py +43 -4
  264. mindspore/parallel/function/__init__.py +8 -1
  265. mindspore/parallel/function/reshard_func.py +1 -1
  266. mindspore/parallel/nn/__init__.py +15 -2
  267. mindspore/parallel/nn/parallel_cell_wrapper.py +9 -10
  268. mindspore/parallel/nn/parallel_grad_reducer.py +7 -6
  269. mindspore/parallel/shard.py +2 -2
  270. mindspore/parallel/transform_safetensors.py +462 -174
  271. mindspore/pgodb140.dll +0 -0
  272. mindspore/pgort140.dll +0 -0
  273. mindspore/profiler/__init__.py +2 -1
  274. mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +7 -7
  275. mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +3 -0
  276. mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +3 -0
  277. mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +3 -3
  278. mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +3 -3
  279. mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +4 -4
  280. mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +3 -3
  281. mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +4 -1
  282. mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +2 -1
  283. mindspore/profiler/analysis/task_manager.py +1 -1
  284. mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +5 -1
  285. mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +2 -1
  286. mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +42 -22
  287. mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +3 -2
  288. mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +9 -5
  289. mindspore/profiler/analysis/viewer/ms_operator_details_viewer.py +132 -0
  290. mindspore/profiler/common/constant.py +16 -0
  291. mindspore/profiler/common/profiler_context.py +25 -27
  292. mindspore/profiler/common/profiler_info.py +0 -16
  293. mindspore/profiler/common/profiler_op_analyse.py +235 -0
  294. mindspore/profiler/common/profiler_output_path.py +23 -8
  295. mindspore/profiler/common/profiler_parameters.py +128 -35
  296. mindspore/profiler/dynamic_profile/__init__.py +0 -0
  297. mindspore/profiler/dynamic_profile/dynamic_monitor_proxy.py +39 -0
  298. mindspore/profiler/dynamic_profile/dynamic_profiler_config_context.py +666 -0
  299. mindspore/profiler/dynamic_profile/dynamic_profiler_utils.py +62 -0
  300. mindspore/profiler/dynamic_profiler.py +305 -314
  301. mindspore/profiler/envprofiler.py +12 -7
  302. mindspore/profiler/experimental_config.py +96 -6
  303. mindspore/profiler/mstx.py +33 -12
  304. mindspore/profiler/platform/__init__.py +2 -3
  305. mindspore/profiler/platform/npu_profiler.py +29 -19
  306. mindspore/profiler/profiler.py +35 -19
  307. mindspore/profiler/profiler_action_controller.py +64 -76
  308. mindspore/profiler/schedule.py +10 -4
  309. mindspore/rewrite/common/config.py +1 -0
  310. mindspore/rewrite/common/namer.py +1 -0
  311. mindspore/rewrite/common/namespace.py +1 -0
  312. mindspore/rewrite/node/node.py +31 -11
  313. mindspore/rewrite/parsers/assign_parser.py +1 -1
  314. mindspore/rewrite/symbol_tree/symbol_tree.py +1 -1
  315. mindspore/run_check/_check_version.py +7 -10
  316. mindspore/runtime/__init__.py +5 -5
  317. mindspore/runtime/event.py +10 -4
  318. mindspore/runtime/executor.py +60 -45
  319. mindspore/runtime/memory.py +21 -30
  320. mindspore/runtime/thread_bind_core.py +298 -164
  321. mindspore/safeguard/rewrite_obfuscation.py +12 -13
  322. mindspore/swresample-4.dll +0 -0
  323. mindspore/swscale-6.dll +0 -0
  324. mindspore/tbbmalloc.dll +0 -0
  325. mindspore/tinyxml2.dll +0 -0
  326. mindspore/train/_utils.py +6 -2
  327. mindspore/train/amp.py +43 -20
  328. mindspore/train/callback/__init__.py +5 -5
  329. mindspore/train/callback/_checkpoint.py +3 -6
  330. mindspore/train/callback/_flops_collector.py +1 -1
  331. mindspore/train/callback/_landscape.py +0 -1
  332. mindspore/train/callback/_train_fault_tolerance.py +71 -13
  333. mindspore/train/data_sink.py +11 -2
  334. mindspore/train/dataset_helper.py +9 -0
  335. mindspore/train/model.py +51 -33
  336. mindspore/train/serialization.py +133 -111
  337. mindspore/train/summary/summary_record.py +13 -2
  338. mindspore/turbojpeg.dll +0 -0
  339. mindspore/utils/__init__.py +3 -2
  340. mindspore/utils/dryrun.py +0 -6
  341. mindspore/utils/runtime_execution_order_check.py +162 -78
  342. mindspore/utils/sdc_detect.py +68 -0
  343. mindspore/utils/utils.py +6 -9
  344. mindspore/vcmeta.dll +0 -0
  345. mindspore/vcruntime140.dll +0 -0
  346. mindspore/vcruntime140_1.dll +0 -0
  347. mindspore/version.py +1 -1
  348. {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/METADATA +5 -4
  349. {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/RECORD +352 -390
  350. mindspore/_deprecated/jit.py +0 -198
  351. mindspore/experimental/es/__init__.py +0 -22
  352. mindspore/experimental/es/embedding_service.py +0 -891
  353. mindspore/experimental/es/embedding_service_layer.py +0 -581
  354. mindspore/profiler/parser/__init__.py +0 -14
  355. mindspore/profiler/parser/aicpu_data_parser.py +0 -272
  356. mindspore/profiler/parser/ascend_analysis/__init__.py +0 -14
  357. mindspore/profiler/parser/ascend_analysis/constant.py +0 -71
  358. mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -180
  359. mindspore/profiler/parser/ascend_analysis/function_event.py +0 -185
  360. mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +0 -136
  361. mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +0 -131
  362. mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +0 -104
  363. mindspore/profiler/parser/ascend_analysis/path_manager.py +0 -313
  364. mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +0 -123
  365. mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +0 -86
  366. mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +0 -75
  367. mindspore/profiler/parser/ascend_cluster_generator.py +0 -116
  368. mindspore/profiler/parser/ascend_communicate_generator.py +0 -314
  369. mindspore/profiler/parser/ascend_flops_generator.py +0 -116
  370. mindspore/profiler/parser/ascend_fpbp_generator.py +0 -82
  371. mindspore/profiler/parser/ascend_hccl_generator.py +0 -271
  372. mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
  373. mindspore/profiler/parser/ascend_memory_generator.py +0 -185
  374. mindspore/profiler/parser/ascend_msprof_exporter.py +0 -282
  375. mindspore/profiler/parser/ascend_msprof_generator.py +0 -187
  376. mindspore/profiler/parser/ascend_op_generator.py +0 -334
  377. mindspore/profiler/parser/ascend_steptrace_generator.py +0 -94
  378. mindspore/profiler/parser/ascend_timeline_generator.py +0 -545
  379. mindspore/profiler/parser/base_timeline_generator.py +0 -483
  380. mindspore/profiler/parser/container.py +0 -229
  381. mindspore/profiler/parser/cpu_gpu_timeline_generator.py +0 -697
  382. mindspore/profiler/parser/flops_parser.py +0 -531
  383. mindspore/profiler/parser/framework_enum.py +0 -111
  384. mindspore/profiler/parser/framework_parser.py +0 -464
  385. mindspore/profiler/parser/framework_struct.py +0 -61
  386. mindspore/profiler/parser/gpu_analysis/__init__.py +0 -14
  387. mindspore/profiler/parser/gpu_analysis/function_event.py +0 -44
  388. mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +0 -89
  389. mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +0 -72
  390. mindspore/profiler/parser/hccl_parser.py +0 -573
  391. mindspore/profiler/parser/hwts_log_parser.py +0 -122
  392. mindspore/profiler/parser/integrator.py +0 -526
  393. mindspore/profiler/parser/memory_usage_parser.py +0 -277
  394. mindspore/profiler/parser/minddata_analyzer.py +0 -800
  395. mindspore/profiler/parser/minddata_parser.py +0 -186
  396. mindspore/profiler/parser/minddata_pipeline_parser.py +0 -299
  397. mindspore/profiler/parser/op_intermediate_parser.py +0 -149
  398. mindspore/profiler/parser/optime_parser.py +0 -250
  399. mindspore/profiler/parser/profiler_info.py +0 -213
  400. mindspore/profiler/parser/step_trace_parser.py +0 -666
  401. {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/WHEEL +0 -0
  402. {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/entry_points.txt +0 -0
  403. {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/top_level.txt +0 -0
@@ -71,7 +71,7 @@ class PyboostOverloadFunctionsGenerator(BaseGenerator):
71
71
  '${arg_handler_processor}\n'
72
72
  'MS_LOG(INFO) << "Call Tensor${class_name}";\n'
73
73
  'auto res = ${pyboost_base_func_name}_OP(${prim_name}, parse_args.src_types_, ${convert_args});\n'
74
- 'trace::Capture(parse_args.arg_list_, "${class_name}", &res);\n'
74
+ 'trace::Capture(parse_args.arg_list_, mindspore::prim::kPrim${class_name}, &res);\n'
75
75
  'return res;\n'
76
76
  )
77
77
  self.callback_python_template = Template(
@@ -68,7 +68,7 @@ def get_index(index: int):
68
68
  return "kIndex" + str(index)
69
69
 
70
70
 
71
- def get_convert_type_str(dtype: str, optional):
71
+ def get_convert_type_str(dtype: str, optional, use_basic_type=False):
72
72
  """
73
73
  Convert type
74
74
  """
@@ -106,16 +106,30 @@ def get_convert_type_str(dtype: str, optional):
106
106
  'list[bool]': 'ToBoolListOptional<py::list>',
107
107
  'list[tensor]': 'ToTensorListOptional<py::list>',
108
108
  }
109
+ basic_optional_type_convert = {
110
+ 'tuple[int]': "ToBasicIntVectorOptional",
111
+ 'list[int]': "ToBasicIntVectorOptional",
112
+ 'int': "ToBasicIntOptional",
113
+ }
114
+ basic_type_convert = {
115
+ 'tuple[int]': "ToBasicIntVector",
116
+ 'list[int]': "ToBasicIntVector",
117
+ 'int': "ToBasicInt",
118
+ }
109
119
  if optional:
120
+ if use_basic_type and dtype in basic_optional_type_convert:
121
+ return basic_optional_type_convert[dtype]
110
122
  if dtype in optional_type_convert:
111
123
  return optional_type_convert[dtype]
112
124
  raise TypeError(f"""Unsupported convert optional type {dtype} for args.""")
125
+ if use_basic_type and dtype in basic_type_convert:
126
+ return basic_type_convert[dtype]
113
127
  if dtype in native_type_convert:
114
128
  return native_type_convert[dtype]
115
129
  raise TypeError(f"""Unsupported convert type {dtype} for args.""")
116
130
 
117
131
 
118
- def get_input_args_type_str(dtype: str, optional):
132
+ def get_input_args_type_str(dtype: str, optional, use_basic_type=False):
119
133
  """
120
134
  Convert type
121
135
  """
@@ -153,17 +167,52 @@ def get_input_args_type_str(dtype: str, optional):
153
167
  'list[bool]': 'std::optional<ValueTuplePtr>',
154
168
  'list[tensor]': 'std::optional<ValueTuplePtr>',
155
169
  }
170
+ basic_optional_type_convert = {
171
+ 'tuple[int]': "std::optional<std::vector<int64_t>>",
172
+ 'list[int]': "std::optional<std::vector<int64_t>>",
173
+ 'int': "std::optional<int64_t>",
174
+ }
175
+ basic_type_convert = {
176
+ 'tuple[int]': "std::vector<int64_t>",
177
+ 'list[int]': "std::vector<int64_t>",
178
+ 'int': "int64_t",
179
+ }
156
180
  if optional:
181
+ if use_basic_type and dtype in basic_optional_type_convert:
182
+ return basic_optional_type_convert[dtype]
157
183
  if dtype in optional_type:
158
184
  return optional_type[dtype]
159
185
  raise TypeError(f"""Unknown optional type {dtype} for args.""")
186
+ if use_basic_type and dtype in basic_type_convert:
187
+ return basic_type_convert[dtype]
160
188
  if dtype in native_type:
161
189
  return native_type[dtype]
162
190
  raise TypeError(f"""Unknown type {dtype} for args.""")
163
191
 
164
192
 
193
+ def basic_type_convert_str(dtype: str, optional):
194
+ """
195
+ Convert type
196
+ """
197
+ optional_type = {
198
+ 'tuple[int]': "ToBasicIntVectorOptional",
199
+ 'list[int]': "ToBasicIntVectorOptional",
200
+ 'int': "ToBasicIntOptional",
201
+ }
202
+ native_type = {
203
+ 'tuple[int]': "ToBasicIntVector",
204
+ 'list[int]': "ToBasicIntVector",
205
+ 'int': "ToBasicInt",
206
+ }
207
+ if optional:
208
+ if dtype in optional_type:
209
+ return optional_type[dtype]
210
+ if dtype in native_type:
211
+ return native_type[dtype]
212
+ return ""
213
+
165
214
 
166
- def get_value_convert_type_str(dtype: str, optional):
215
+ def get_value_convert_type_str(dtype: str, optional, use_basic_type=False):
167
216
  """
168
217
  Convert type
169
218
  """
@@ -193,10 +242,24 @@ def get_value_convert_type_str(dtype: str, optional):
193
242
  'tuple[bool]': 'ToValueTupleOptional',
194
243
  'tuple[tensor]': 'ToValueTupleOptional',
195
244
  }
245
+ basic_optional_type_convert = {
246
+ 'tuple[int]': "ToBasicIntVectorOptional",
247
+ 'list[int]': "ToBasicIntVectorOptional",
248
+ 'int': "ToBasicIntOptional",
249
+ }
250
+ basic_type_convert = {
251
+ 'tuple[int]': "ToBasicIntVector",
252
+ 'list[int]': "ToBasicIntVector",
253
+ 'int': "ToBasicInt",
254
+ }
196
255
  if optional:
256
+ if use_basic_type and dtype in basic_optional_type_convert:
257
+ return basic_optional_type_convert[dtype]
197
258
  if dtype in optional_type_convert:
198
259
  return optional_type_convert[dtype]
199
260
  raise TypeError(f"""Unsupported convert optional type {dtype} for args.""")
261
+ if use_basic_type and dtype in basic_type_convert:
262
+ return basic_type_convert[dtype]
200
263
  if dtype in native_type_convert:
201
264
  return native_type_convert[dtype]
202
265
  raise TypeError(f"""Unsupported convert type {dtype} for args.""")
@@ -212,7 +275,7 @@ def tuple_input_to_cpp_type(dtype: str):
212
275
  'tuple[int]': 'int64_t',
213
276
  'tuple[float]': 'float',
214
277
  'tuple[bool]': 'bool',
215
- 'tuple[str]': 'string',
278
+ 'tuple[str]': 'std::string',
216
279
  'tuple[tensor]': 'mindspore::tensor::TensorPtr',
217
280
  'list[int]': 'int64_t',
218
281
  'list[float]': 'float',
@@ -227,12 +290,44 @@ def number_input_to_cpp_type(dtype: str):
227
290
  'int': 'int64_t',
228
291
  'float': 'float',
229
292
  'bool': 'bool',
230
- 'str': 'string'
293
+ 'str': 'std::string'
231
294
  }
232
295
  return types_map.get(dtype)
233
296
 
234
297
 
235
- def get_input_dtype(dtype: str, optional):
298
+ def input_dtype_to_cpp_type(dtype: str, optional):
299
+ """
300
+ Map input dtype to cpp dtype
301
+ """
302
+ type_convert = {
303
+ 'int': 'int64_t',
304
+ 'float': 'float',
305
+ 'bool': 'bool',
306
+ 'number': 'mindspore::ScalarPtr',
307
+ 'str': 'std::string',
308
+ 'tensor': 'mindspore::tensor::TensorPtr',
309
+ 'tuple[int]': 'std::vector<int64_t>',
310
+ 'tuple[float]': 'std::vector<float>',
311
+ 'tuple[bool]': 'std::vector<bool>',
312
+ 'tuple[tensor]': 'std::vector<mindspore::tensor::TensorPtr>',
313
+ 'list[int]': 'std::vector<int64_t>',
314
+ 'list[float]': 'std::vector<float>',
315
+ 'list[bool]': 'std::vector<bool>',
316
+ 'list[tensor]': 'std::vector<mindspore::tensor::TensorPtr>',
317
+ }
318
+ optional_tensor_type_convert = {
319
+ 'tensor': 'std::optional<mindspore::tensor::TensorPtr>',
320
+ 'tuple[tensor]': 'std::vector<mindspore::tensor::TensorPtr>',
321
+ 'list[tensor]': 'std::vector<mindspore::tensor::TensorPtr>'
322
+ }
323
+ if optional and dtype in optional_tensor_type_convert:
324
+ return optional_tensor_type_convert[dtype]
325
+ if dtype in type_convert:
326
+ return type_convert[dtype]
327
+ raise TypeError(f"""Unsupported dtype {dtype} for args.""")
328
+
329
+
330
+ def get_input_dtype(dtype: str, optional, use_basic_type=False):
236
331
  """
237
332
  Convert type
238
333
  """
@@ -244,7 +339,7 @@ def get_input_dtype(dtype: str, optional):
244
339
  'bool': 'mindspore::BoolImmPtr',
245
340
  'number': 'mindspore::ScalarPtr',
246
341
  'str': 'mindspore::StringImmPtr',
247
- 'tensor': 'mindspore::tensor::BaseTensorPtr',
342
+ 'tensor': 'mindspore::tensor::TensorPtr',
248
343
  'tuple[int]': value_tuple,
249
344
  'tuple[float]': value_tuple,
250
345
  'tuple[bool]': value_tuple,
@@ -261,16 +356,30 @@ def get_input_dtype(dtype: str, optional):
261
356
  'bool': 'std::optional<mindspore::BoolImmPtr>',
262
357
  'number': 'std::optional<mindspore::ScalarPtr>',
263
358
  'str': 'std::optional<mindspore::StringImmPtr>',
264
- 'tensor': 'std::optional<mindspore::tensor::BaseTensorPtr>',
359
+ 'tensor': 'std::optional<mindspore::tensor::TensorPtr>',
265
360
  'tuple[int]': value_tuple_optional,
266
361
  'tuple[float]': value_tuple_optional,
267
362
  'tuple[bool]': value_tuple_optional,
268
363
  'tuple[tensor]': value_tuple_optional,
269
364
  }
365
+ basic_optional_type_convert = {
366
+ 'tuple[int]': "std::optional<std::vector<int64_t>>",
367
+ 'list[int]': "std::optional<std::vector<int64_t>>",
368
+ 'int': "std::optional<int64_t>",
369
+ }
370
+ basic_type_convert = {
371
+ 'tuple[int]': "std::vector<int64_t>",
372
+ 'list[int]': "std::vector<int64_t>",
373
+ 'int': "int64_t",
374
+ }
270
375
  if optional:
376
+ if use_basic_type and dtype in basic_optional_type_convert:
377
+ return basic_optional_type_convert[dtype]
271
378
  if dtype in optional_type_convert:
272
379
  return optional_type_convert[dtype]
273
380
  raise TypeError(f"""Unsupported convert optional type {dtype} for args.""")
381
+ if use_basic_type and dtype in basic_type_convert:
382
+ return basic_type_convert[dtype]
274
383
  if dtype in type_convert:
275
384
  return type_convert[dtype]
276
385
  raise TypeError(f"""Unsupported convert type {dtype} for args.""")
@@ -343,7 +452,7 @@ def get_tuple_input_convert(arg_name, arg_type):
343
452
  """
344
453
  cpp_type = tuple_input_to_cpp_type(arg_type)
345
454
  if cpp_type == "mindspore::tensor::TensorPtr":
346
- cpp_type = "mindspore::tensor::BaseTensorPtr"
455
+ cpp_type = "mindspore::tensor::TensorPtr"
347
456
  return f"std::vector<{cpp_type}> {arg_name}_vector = ConvertValueTupleToVector<{cpp_type}>({arg_name});\n"
348
457
 
349
458
 
@@ -37,15 +37,6 @@ class TensorPyCppGenerator(BaseGenerator):
37
37
  '{"${snake_api_name}"'
38
38
  ', (PyCFunction)TensorMethod${pascal_api_name}_CPyWrapper, METH_VARARGS | METH_KEYWORDS},'
39
39
  )
40
- self.stubtensor_api_def_template = Template(
41
- 'py::cpp_function TensorMethod${snake_api_name}_wrapper(\n'
42
- ' [](const py::object& self, const py::args& args, const py::kwargs& kwargs) {\n'
43
- ' return TensorMethod${pascal_api_name}(self, args, kwargs);\n'
44
- ' },\n'
45
- ' py::is_method(stubTensorClass)\n'
46
- ');\n'
47
- 'stubTensorClass.attr("${snake_api_name}") = TensorMethod${snake_api_name}_wrapper;'
48
- )
49
40
 
50
41
  def generate(self, work_path, tensor_method_protos, alias_func_mapping):
51
42
  """
@@ -61,7 +52,6 @@ class TensorPyCppGenerator(BaseGenerator):
61
52
  """
62
53
  wrapper_defs = []
63
54
  tensor_api_defs = []
64
- stubtensor_api_defs = []
65
55
  for api_name, _ in tensor_method_protos.items():
66
56
  pascal_api_name = pyboost_utils.format_func_api_name(api_name)
67
57
  snake_api_name = api_name
@@ -72,12 +62,6 @@ class TensorPyCppGenerator(BaseGenerator):
72
62
  pascal_api_name=pascal_api_name
73
63
  )
74
64
  )
75
- stubtensor_api_defs.append(
76
- self.stubtensor_api_def_template.replace(
77
- snake_api_name=snake_api_name,
78
- pascal_api_name=pascal_api_name
79
- )
80
- )
81
65
  if api_name in alias_func_mapping:
82
66
  alias_api_names = alias_func_mapping[api_name]
83
67
  for alias_api_name in alias_api_names:
@@ -88,19 +72,12 @@ class TensorPyCppGenerator(BaseGenerator):
88
72
  pascal_api_name=pascal_api_name
89
73
  )
90
74
  )
91
- stubtensor_api_defs.append(
92
- self.stubtensor_api_def_template.replace(
93
- snake_api_name=snake_api_name,
94
- pascal_api_name=pascal_api_name
95
- )
96
- )
97
75
 
98
76
  # delete the ' \' for the last wrapper macro definition
99
77
  wrapper_defs[-1] = wrapper_defs[-1][:-2]
100
78
 
101
79
  file_str = self.TENSOR_PY_CC_TEMPLATE.replace(
102
- tensor_api_defs=tensor_api_defs,
103
- stubtensor_api_defs=stubtensor_api_defs
80
+ tensor_api_defs=tensor_api_defs
104
81
  )
105
82
  save_file(
106
83
  os.path.join(work_path, K.TENSOR_PY_CC_PATH),
@@ -999,8 +999,10 @@ class _AutoParallelContext:
999
999
  _PipelineScheduler.PIPELINE_SEQPIPE,
1000
1000
  _PipelineScheduler.PIPELINE_SEQVPP,
1001
1001
  _PipelineScheduler.PIPELINE_SEQSMARTVPP])
1002
- if not pipeline_config[pp_interleave] and pipeline_config[pp_scheduler] != _PipelineScheduler.PIPELINE_1F1B:
1003
- raise ValueError(f"When pipeline_interleave is False, {pp_scheduler} is not supported")
1002
+ scheduler_val = pipeline_config[pp_scheduler]
1003
+ if not pipeline_config[pp_interleave] and scheduler_val != _PipelineScheduler.PIPELINE_1F1B:
1004
+ raise TypeError(f"When pipeline_interleave is False, {scheduler_val!r} is not supported, "
1005
+ "only '1f1b' is allowed.")
1004
1006
 
1005
1007
  self._context_handle.set_pipeline_scheduler(pipeline_config[pp_scheduler])
1006
1008
 
@@ -26,7 +26,7 @@ from mindspore.ops.operations.comm_ops import AllGather
26
26
  from mindspore.communication import GlobalComm, get_rank
27
27
  from mindspore.common import jit
28
28
  from mindspore.communication import create_group, destroy_group, get_group_size
29
- from mindspore.communication._comm_helper import _get_group_map
29
+ from mindspore.communication._comm_helper import _get_group_map, _remove_group_info
30
30
  from mindspore.train._utils import get_parameter_redundancy, remove_param_redundancy
31
31
  from mindspore.parallel.shard import Layout
32
32
 
@@ -119,20 +119,18 @@ def destroy_allgather_cell():
119
119
 
120
120
  def _chang_parallel_context(origin_dataset_strategy):
121
121
  """Change the original parallel state."""
122
- if context.get_context("mode") == context.GRAPH_MODE:
123
- context.set_auto_parallel_context(parallel_mode="hybrid_parallel")
124
- if origin_dataset_strategy != "data_parallel":
125
- context.set_auto_parallel_context(dataset_strategy="data_parallel")
122
+ context.set_auto_parallel_context(parallel_mode="hybrid_parallel")
123
+ if origin_dataset_strategy != "data_parallel":
124
+ context.set_auto_parallel_context(dataset_strategy="data_parallel")
126
125
 
127
126
 
128
127
  def _restore_parallel_context(origin_parallel_mode, origin_dataset_strategy):
129
128
  """Restore the original parallel state."""
130
- if context.get_context("mode") == context.GRAPH_MODE:
131
- context.set_auto_parallel_context(parallel_mode=origin_parallel_mode)
132
- if origin_dataset_strategy != "data_parallel":
133
- if origin_dataset_strategy is not None and isinstance(origin_dataset_strategy, list):
134
- origin_dataset_strategy = tuple(tuple(ds_item) for ds_item in origin_dataset_strategy)
135
- context.set_auto_parallel_context(dataset_strategy=origin_dataset_strategy)
129
+ context.set_auto_parallel_context(parallel_mode=origin_parallel_mode)
130
+ if origin_dataset_strategy != "data_parallel":
131
+ if origin_dataset_strategy is not None and isinstance(origin_dataset_strategy, list):
132
+ origin_dataset_strategy = tuple(tuple(ds_item) for ds_item in origin_dataset_strategy)
133
+ context.set_auto_parallel_context(dataset_strategy=origin_dataset_strategy)
136
134
 
137
135
 
138
136
  def _get_group_name(group_map, group):
@@ -166,11 +164,92 @@ def _remove_param_not_load(param_name, param_not_load):
166
164
  param_not_load.remove(param_name)
167
165
 
168
166
 
169
- def _single_parameter_broadcast(net, layout, param_not_load=None):
167
+ def _get_param_index_in_group(total_param_loaded, group, param):
168
+ """Get param_index in group."""
169
+ param_rank_index = []
170
+ for rank_id in group:
171
+ if rank_id < len(total_param_loaded):
172
+ if param in total_param_loaded[rank_id]:
173
+ param_rank_index.append(rank_id)
174
+ else:
175
+ raise ValueError("rank_id should be smaller than total rank num")
176
+ return param_rank_index
177
+
178
+
179
+ def _communicate_allreduce(allreduce_input, group_map, group):
180
+ """Communicate allreduce input."""
181
+ if not allreduce_input:
182
+ return
183
+ from mindspore import Tensor
184
+ group_name, is_manual_communication_group = _get_group_name(group_map, group)
185
+ if is_manual_communication_group:
186
+ create_group(group_name, list(group))
187
+ communicator = SingleCommunicator(group_name)
188
+ for real_param in allreduce_input:
189
+ real_param.set_data(communicator(Tensor(real_param)), real_param.sliced)
190
+ if is_manual_communication_group:
191
+ destroy_group(group_name)
192
+ _remove_group_info(group_name)
193
+
194
+
195
+ def _create_allreduce_input(params, group, net_param_dict, total_param_loaded, param_not_load, cur_rank):
196
+ """Creates allreduce input."""
197
+ from mindspore import Tensor
198
+ allreduce_input = []
199
+ for param in params:
200
+ if param not in net_param_dict:
201
+ continue
202
+ if param.startswith("accu_grads") or param.endswith("expert_load"):
203
+ continue
204
+ param_rank_index = _get_param_index_in_group(total_param_loaded, group, param)
205
+ if not param_rank_index:
206
+ continue
207
+ elif len(param_rank_index) == 1:
208
+ real_param = net_param_dict[param]
209
+ _remove_param_not_load(real_param.name, param_not_load)
210
+ if cur_rank != param_rank_index[0]:
211
+ real_param.set_data(Tensor(np.zeros(real_param.shape), dtype=real_param.dtype), real_param.sliced)
212
+ allreduce_input.append(real_param)
213
+ elif len(param_rank_index) > 1:
214
+ raise ValueError(f"For param {param} in group {group} should be in one rank, but in {param_rank_index}.")
215
+ return allreduce_input
216
+
217
+
218
+ def _get_sorted_group_map():
219
+ """Get the world group map."""
220
+ group_map = _get_group_map()
221
+ if group_map:
222
+ group_map = {key: group_map[key] for key in sorted(group_map.keys())}
223
+ return group_map
224
+
225
+
226
+ def _check_total_param_loaded(total_param_loaded):
227
+ """Check total_param_loaded."""
228
+ flag = True
229
+ for rank_id, param_loaded in enumerate(total_param_loaded):
230
+ if rank_id not in param_loaded:
231
+ flag = False
232
+ logger.warning("The order of loaded parameters on each card obtained by all_gather_object is incorrect,"
233
+ "and the parameter broadcast will reorder them.")
234
+ break
235
+ if not flag:
236
+ new_total_param_loaded = [None] * len(total_param_loaded)
237
+ for _, param_loaded in enumerate(total_param_loaded):
238
+ for param in param_loaded:
239
+ if isinstance(param, int):
240
+ new_total_param_loaded[param] = param_loaded
241
+ break
242
+ return new_total_param_loaded
243
+ return total_param_loaded
244
+
245
+
246
+ def _single_parameter_broadcast(net, layout, param_not_load=None, param_loaded=None):
170
247
  """
171
248
  Broadcast single parameter to other rank in data parallel dimension.
172
249
  """
173
- from mindspore import Tensor
250
+ logger.info("Start loading the parameter broadcast for removing redundant parameters.")
251
+ from mindspore.runtime import synchronize
252
+ from mindspore.mint.distributed import all_gather_object
174
253
  origin_parallel_mode = context.get_auto_parallel_context("parallel_mode")
175
254
  origin_dataset_strategy = context.get_auto_parallel_context("dataset_strategy")
176
255
  cur_rank = get_rank()
@@ -188,33 +267,20 @@ def _single_parameter_broadcast(net, layout, param_not_load=None):
188
267
  return
189
268
  net_param_dict = net.parameters_dict()
190
269
  _chang_parallel_context(origin_dataset_strategy)
191
- group_map = _get_group_map()
192
- if group_map:
193
- group_map = {key: group_map[key] for key in sorted(group_map.keys())}
270
+ param_loaded.add(cur_rank)
271
+ total_num = get_group_size()
272
+ total_param_loaded = [None] * total_num
273
+ synchronize()
274
+ all_gather_object(total_param_loaded, param_loaded)
275
+ total_param_loaded = _check_total_param_loaded(total_param_loaded)
276
+ group_map = _get_sorted_group_map()
194
277
  for group, params in param_redundancy_reversed.items():
195
- group_name, is_manual_communication_group = _get_group_name(group_map, group)
196
- allreduce_input = []
197
- for param in params:
198
- if param not in net_param_dict:
199
- continue
200
- if param.startswith("accu_grads") or param.endswith("expert_load"):
201
- continue
202
- real_param = net_param_dict[param]
203
- _remove_param_not_load(real_param.name, param_not_load)
204
- if param not in single_params[cur_rank]:
205
- real_param.set_data(Tensor(np.zeros(real_param.shape), dtype=real_param.dtype), real_param.sliced)
206
- allreduce_input.append(real_param)
207
- if not allreduce_input:
208
- continue
209
- if is_manual_communication_group:
210
- create_group(group_name, list(group))
211
- allreduce_input.sort(key=lambda param: (str(param.shape), str(param.dtype)))
212
- communicator = SingleCommunicator(group_name)
213
- for real_param in allreduce_input:
214
- real_param.set_data(communicator(Tensor(real_param)), real_param.sliced)
215
- if is_manual_communication_group:
216
- destroy_group(group_name)
278
+ allreduce_input = _create_allreduce_input(params, group, net_param_dict, total_param_loaded, param_not_load,
279
+ cur_rank)
280
+ _communicate_allreduce(allreduce_input, group_map, group)
217
281
  _restore_parallel_context(origin_parallel_mode, origin_dataset_strategy)
282
+ synchronize()
283
+ logger.info("End loading the parameter broadcast for removing redundant parameters.")
218
284
 
219
285
 
220
286
  def _insert_virtual_pp_dim(layout):
@@ -272,8 +338,8 @@ class CommTensorDataForPP(Cell):
272
338
  global ALLREDUCE_GROUP_LIST
273
339
  current_rank_stage_id = self._current_rank_id // self._from_dev_num_in_stage
274
340
  end_stage = self._from_dev_num_in_stage * (current_rank_stage_id + 1)
275
- rank_pos_in_stage = [rank_id for rank_id in range(self._from_dev_num_in_stage * current_rank_stage_id,
276
- end_stage)].index(self._current_rank_id)
341
+ start_stage = self._from_dev_num_in_stage * current_rank_stage_id
342
+ rank_pos_in_stage = list(range(start_stage, end_stage)).index(self._current_rank_id)
277
343
  root_idx = self._from_rank_id[rank_pos_in_stage]
278
344
  all_reduce_rank_list = [self._from_rank_id[rank_pos_in_stage]]
279
345
  while rank_pos_in_stage < len(self._diff_rank_id):
@@ -278,7 +278,7 @@ def _extract_pipeline_stage_num(strategy_file):
278
278
  pipeline_stage_set.update(layout[6])
279
279
  pipeline_stage_num = len(pipeline_stage_set)
280
280
  if list(pipeline_stage_set) != list(range(pipeline_stage_num)):
281
- raise ValueError("The strategy file for pipeline parallel dose not contains all stages.")
281
+ raise ValueError("The strategy file for pipeline parallel does not contains all stages.")
282
282
  return pipeline_stage_num
283
283
 
284
284
 
@@ -65,7 +65,6 @@ _set_ps_context_func_map = {
65
65
  "enable_ssl": ps_context().set_enable_ssl,
66
66
  "client_password": ps_context().set_client_password,
67
67
  "server_password": ps_context().set_server_password,
68
- "scheduler_manage_port": ps_context().set_scheduler_manage_port,
69
68
  "config_file_path": ps_context().set_config_file_path,
70
69
  }
71
70
 
@@ -78,12 +77,10 @@ _get_ps_context_func_map = {
78
77
  "scheduler_ip": ps_context().scheduler_ip,
79
78
  "scheduler_port": ps_context().scheduler_port,
80
79
  "enable_ssl": ps_context().enable_ssl,
81
- "client_password": ps_context().client_password,
82
- "server_password": ps_context().server_password,
83
- "scheduler_manage_port": ps_context().scheduler_manage_port,
84
80
  "config_file_path": ps_context().config_file_path,
85
81
  }
86
82
 
83
+
87
84
  def _get_ps_mode_rank():
88
85
  ps_rank = ps_context().ps_rank_id()
89
86
  if ps_rank == -1:
@@ -116,8 +113,9 @@ def _set_ps_context(**kwargs):
116
113
  Only after enable_ps is set True, the environment variables will be effective.
117
114
  Default: ``False``.
118
115
  config_file_path (str): Configuration file path used by recovery. Default: ''.
119
- scheduler_manage_port (int): scheduler manage port used to scale out/in. Default: 11202.
120
116
  enable_ssl (bool): Set PS SSL mode enabled or disabled. Default: ``False``.
117
+ There might be risk when this is set to False.
118
+ It is user's responsibility to ensure the network environment is safe.
121
119
  client_password (str): Password to decrypt the secret key stored in the client certificate. Default: ''.
122
120
  server_password (str): Password to decrypt the secret key stored in the server certificate. Default: ''.
123
121
 
@@ -126,7 +124,7 @@ def _set_ps_context(**kwargs):
126
124
 
127
125
  Examples:
128
126
  >>> import mindspore as ms
129
- >>> ms.set_ps_context(enable_ps=True, enable_ssl=True, client_password='123456', server_password='123456')
127
+ >>> ms.set_ps_context(enable_ps=True, enable_ssl=True, client_password='', server_password='')
130
128
  """
131
129
  for key, value in kwargs.items():
132
130
  if key not in _set_ps_context_func_map: