mindspore 2.4.10__cp39-cp39-win_amd64.whl → 2.6.0__cp39-cp39-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 (579) hide show
  1. mindspore/.commit_id +1 -1
  2. mindspore/__init__.py +13 -6
  3. mindspore/_c_dataengine.cp39-win_amd64.pyd +0 -0
  4. mindspore/_c_expression.cp39-win_amd64.pyd +0 -0
  5. mindspore/_c_mindrecord.cp39-win_amd64.pyd +0 -0
  6. mindspore/_check_jit_forbidden_api.py +3 -0
  7. mindspore/_checkparam.py +3 -38
  8. mindspore/_deprecated/__init__.py +17 -0
  9. mindspore/_deprecated/jit.py +198 -0
  10. mindspore/_extends/builtin_operations.py +1 -1
  11. mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
  12. mindspore/_extends/parse/__init__.py +6 -7
  13. mindspore/_extends/parse/compile_config.py +83 -0
  14. mindspore/_extends/parse/deprecated/__init__.py +0 -0
  15. mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +394 -0
  16. mindspore/_extends/parse/jit_fallback_modules/__init__.py +0 -0
  17. mindspore/_extends/parse/jit_fallback_modules/check_utils.py +123 -0
  18. mindspore/_extends/parse/jit_fallback_modules/third_party_modules.py +50 -0
  19. mindspore/_extends/parse/parser.py +47 -198
  20. mindspore/_extends/parse/resources.py +1 -5
  21. mindspore/_extends/parse/standard_method.py +229 -99
  22. mindspore/_extends/pijit/__init__.py +2 -2
  23. mindspore/_extends/pijit/pijit_func_white_list.py +17 -12
  24. mindspore/_extends/pijit/tensor_func_list.py +27 -0
  25. mindspore/_extends/utils.py +1 -1
  26. mindspore/amp.py +11 -5
  27. mindspore/avcodec-59.dll +0 -0
  28. mindspore/avdevice-59.dll +0 -0
  29. mindspore/avfilter-8.dll +0 -0
  30. mindspore/avformat-59.dll +0 -0
  31. mindspore/avutil-57.dll +0 -0
  32. mindspore/boost/__init__.py +2 -2
  33. mindspore/boost/base.py +3 -7
  34. mindspore/boost/boost_cell_wrapper.py +138 -43
  35. mindspore/common/__init__.py +6 -3
  36. mindspore/common/_grad_function.py +56 -0
  37. mindspore/common/_pijit_context.py +14 -5
  38. mindspore/common/_register_for_tensor.py +1 -2
  39. mindspore/common/_stub_tensor.py +30 -14
  40. mindspore/common/_tensor_cpp_method.py +17 -0
  41. mindspore/common/_tensor_docs.py +4760 -0
  42. mindspore/common/api.py +480 -372
  43. mindspore/common/auto_dynamic_shape.py +41 -44
  44. mindspore/common/dtype.py +39 -36
  45. mindspore/common/dump.py +9 -6
  46. mindspore/common/file_system.py +9 -1
  47. mindspore/common/generator.py +5 -0
  48. mindspore/common/hook_handle.py +6 -2
  49. mindspore/common/initializer.py +13 -10
  50. mindspore/common/jit_begin_end.py +94 -0
  51. mindspore/common/jit_config.py +6 -1
  52. mindspore/common/jit_context.py +76 -0
  53. mindspore/common/jit_trace.py +378 -0
  54. mindspore/common/lazy_inline.py +9 -3
  55. mindspore/common/mindir_util.py +10 -2
  56. mindspore/common/mutable.py +5 -4
  57. mindspore/common/parameter.py +135 -52
  58. mindspore/common/seed.py +2 -2
  59. mindspore/common/sparse_tensor.py +23 -17
  60. mindspore/common/tensor.py +975 -1981
  61. mindspore/communication/__init__.py +7 -5
  62. mindspore/communication/_comm_helper.py +52 -2
  63. mindspore/communication/comm_func.py +240 -181
  64. mindspore/communication/management.py +95 -26
  65. mindspore/context.py +324 -573
  66. mindspore/dataset/__init__.py +65 -37
  67. mindspore/dataset/audio/__init__.py +2 -8
  68. mindspore/dataset/audio/transforms.py +3 -17
  69. mindspore/dataset/callback/ds_callback.py +2 -1
  70. mindspore/dataset/core/config.py +87 -6
  71. mindspore/dataset/engine/cache_admin.py +3 -3
  72. mindspore/dataset/engine/cache_client.py +6 -5
  73. mindspore/dataset/engine/datasets.py +292 -267
  74. mindspore/dataset/engine/datasets_audio.py +22 -8
  75. mindspore/dataset/engine/datasets_standard_format.py +46 -27
  76. mindspore/dataset/engine/datasets_text.py +78 -48
  77. mindspore/dataset/engine/datasets_user_defined.py +183 -117
  78. mindspore/dataset/engine/datasets_vision.py +120 -44
  79. mindspore/dataset/engine/iterators.py +283 -63
  80. mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +1 -1
  81. mindspore/dataset/engine/obs/util.py +8 -0
  82. mindspore/dataset/engine/queue.py +40 -0
  83. mindspore/dataset/engine/samplers.py +289 -43
  84. mindspore/dataset/engine/serializer_deserializer.py +3 -2
  85. mindspore/dataset/engine/validators.py +53 -11
  86. mindspore/dataset/text/__init__.py +7 -6
  87. mindspore/dataset/text/transforms.py +6 -5
  88. mindspore/dataset/text/utils.py +3 -3
  89. mindspore/dataset/transforms/__init__.py +0 -9
  90. mindspore/dataset/transforms/py_transforms_util.py +17 -0
  91. mindspore/dataset/transforms/transforms.py +31 -14
  92. mindspore/dataset/utils/browse_dataset.py +1 -1
  93. mindspore/dataset/vision/__init__.py +2 -9
  94. mindspore/dataset/vision/transforms.py +202 -158
  95. mindspore/dataset/vision/utils.py +7 -5
  96. mindspore/dataset/vision/validators.py +1 -2
  97. mindspore/device_context/__init__.py +21 -0
  98. mindspore/device_context/ascend/__init__.py +25 -0
  99. mindspore/device_context/ascend/device.py +72 -0
  100. mindspore/device_context/ascend/op_debug.py +153 -0
  101. mindspore/device_context/ascend/op_precision.py +193 -0
  102. mindspore/device_context/ascend/op_tuning.py +123 -0
  103. mindspore/{ops_generate/gen_constants.py → device_context/cpu/__init__.py} +6 -17
  104. mindspore/device_context/cpu/device.py +62 -0
  105. mindspore/device_context/cpu/op_tuning.py +43 -0
  106. mindspore/device_context/gpu/__init__.py +21 -0
  107. mindspore/device_context/gpu/device.py +70 -0
  108. mindspore/device_context/gpu/op_precision.py +67 -0
  109. mindspore/device_context/gpu/op_tuning.py +175 -0
  110. mindspore/device_manager.py +170 -0
  111. mindspore/dnnl.dll +0 -0
  112. mindspore/experimental/es/embedding_service.py +35 -27
  113. mindspore/experimental/llm_boost/__init__.py +1 -0
  114. mindspore/experimental/llm_boost/ascend_native/__init__.py +22 -0
  115. mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +209 -0
  116. mindspore/experimental/llm_boost/ascend_native/llm_boost.py +52 -0
  117. mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
  118. mindspore/experimental/llm_boost/atb/llama_boost.py +6 -1
  119. mindspore/experimental/llm_boost/register.py +1 -0
  120. mindspore/experimental/map_parameter.py +4 -4
  121. mindspore/experimental/optim/adadelta.py +6 -6
  122. mindspore/experimental/optim/adagrad.py +4 -4
  123. mindspore/experimental/optim/adam.py +7 -0
  124. mindspore/experimental/optim/adamax.py +4 -4
  125. mindspore/experimental/optim/adamw.py +4 -0
  126. mindspore/experimental/optim/asgd.py +1 -1
  127. mindspore/experimental/optim/lr_scheduler.py +73 -46
  128. mindspore/experimental/optim/radam.py +34 -31
  129. mindspore/experimental/optim/rprop.py +1 -1
  130. mindspore/experimental/optim/sgd.py +1 -1
  131. mindspore/hal/contiguous_tensors_handle.py +6 -10
  132. mindspore/hal/device.py +55 -53
  133. mindspore/hal/event.py +52 -52
  134. mindspore/hal/memory.py +179 -120
  135. mindspore/hal/stream.py +150 -109
  136. mindspore/include/api/context.h +0 -1
  137. mindspore/include/dataset/constants.h +7 -4
  138. mindspore/include/dataset/execute.h +2 -2
  139. mindspore/jpeg62.dll +0 -0
  140. mindspore/log.py +50 -0
  141. mindspore/mindrecord/__init__.py +21 -8
  142. mindspore/mindrecord/config.py +17 -316
  143. mindspore/mindrecord/filereader.py +1 -9
  144. mindspore/mindrecord/filewriter.py +5 -15
  145. mindspore/mindrecord/mindpage.py +1 -9
  146. mindspore/mindspore_backend_common.dll +0 -0
  147. mindspore/mindspore_backend_manager.dll +0 -0
  148. mindspore/mindspore_common.dll +0 -0
  149. mindspore/mindspore_core.dll +0 -0
  150. mindspore/mindspore_dump.dll +0 -0
  151. mindspore/mindspore_frontend.dll +0 -0
  152. mindspore/mindspore_glog.dll +0 -0
  153. mindspore/mindspore_memory_pool.dll +0 -0
  154. mindspore/mindspore_ms_backend.dll +0 -0
  155. mindspore/mindspore_ops.dll +0 -0
  156. mindspore/{mindspore_backend.dll → mindspore_ops_host.dll} +0 -0
  157. mindspore/mindspore_ops_kernel_common.dll +0 -0
  158. mindspore/mindspore_profiler.dll +0 -0
  159. mindspore/mindspore_pyboost.dll +0 -0
  160. mindspore/mindspore_pynative.dll +0 -0
  161. mindspore/mindspore_res_manager.dll +0 -0
  162. mindspore/mindspore_runtime_pipeline.dll +0 -0
  163. mindspore/mint/__init__.py +798 -761
  164. mindspore/mint/distributed/__init__.py +70 -4
  165. mindspore/mint/distributed/distributed.py +2679 -44
  166. mindspore/mint/linalg/__init__.py +8 -0
  167. mindspore/mint/nn/__init__.py +743 -22
  168. mindspore/mint/nn/functional.py +716 -23
  169. mindspore/mint/nn/layer/__init__.py +21 -4
  170. mindspore/mint/nn/layer/_functions.py +334 -0
  171. mindspore/mint/nn/layer/activation.py +276 -1
  172. mindspore/mint/nn/layer/basic.py +123 -0
  173. mindspore/mint/nn/layer/conv.py +933 -0
  174. mindspore/mint/nn/layer/normalization.py +223 -28
  175. mindspore/mint/nn/layer/padding.py +797 -0
  176. mindspore/mint/nn/layer/pooling.py +235 -0
  177. mindspore/mint/optim/__init__.py +3 -1
  178. mindspore/mint/optim/adam.py +223 -0
  179. mindspore/mint/optim/adamw.py +26 -19
  180. mindspore/mint/optim/sgd.py +171 -0
  181. mindspore/mint/special/__init__.py +2 -1
  182. mindspore/multiprocessing/__init__.py +5 -0
  183. mindspore/nn/__init__.py +4 -1
  184. mindspore/nn/cell.py +1373 -192
  185. mindspore/nn/dynamic_lr.py +2 -1
  186. mindspore/nn/layer/activation.py +29 -27
  187. mindspore/nn/layer/basic.py +51 -35
  188. mindspore/nn/layer/channel_shuffle.py +3 -3
  189. mindspore/nn/layer/container.py +1 -1
  190. mindspore/nn/layer/conv.py +53 -42
  191. mindspore/nn/layer/embedding.py +12 -11
  192. mindspore/nn/layer/normalization.py +56 -49
  193. mindspore/nn/layer/padding.py +4 -3
  194. mindspore/nn/layer/pooling.py +120 -42
  195. mindspore/nn/layer/rnn_cells.py +1 -1
  196. mindspore/nn/layer/rnns.py +2 -1
  197. mindspore/nn/layer/timedistributed.py +5 -5
  198. mindspore/nn/layer/transformer.py +59 -36
  199. mindspore/nn/learning_rate_schedule.py +8 -4
  200. mindspore/nn/loss/loss.py +58 -55
  201. mindspore/nn/optim/ada_grad.py +7 -5
  202. mindspore/nn/optim/adadelta.py +11 -9
  203. mindspore/nn/optim/adafactor.py +1 -1
  204. mindspore/nn/optim/adam.py +19 -15
  205. mindspore/nn/optim/adamax.py +8 -7
  206. mindspore/nn/optim/adasum.py +5 -5
  207. mindspore/nn/optim/asgd.py +3 -1
  208. mindspore/nn/optim/ftrl.py +11 -9
  209. mindspore/nn/optim/lamb.py +1 -1
  210. mindspore/nn/optim/lars.py +1 -4
  211. mindspore/nn/optim/lazyadam.py +12 -10
  212. mindspore/nn/optim/momentum.py +7 -6
  213. mindspore/nn/optim/optimizer.py +3 -3
  214. mindspore/nn/optim/proximal_ada_grad.py +12 -10
  215. mindspore/nn/optim/rmsprop.py +13 -12
  216. mindspore/nn/optim/rprop.py +11 -9
  217. mindspore/nn/optim/sgd.py +9 -6
  218. mindspore/nn/optim/tft_wrapper.py +5 -2
  219. mindspore/nn/optim/thor.py +2 -1
  220. mindspore/nn/probability/bijector/bijector.py +17 -11
  221. mindspore/nn/probability/bijector/gumbel_cdf.py +5 -5
  222. mindspore/nn/probability/bijector/invert.py +2 -2
  223. mindspore/nn/probability/bijector/scalar_affine.py +3 -3
  224. mindspore/nn/probability/bijector/softplus.py +3 -2
  225. mindspore/nn/probability/distribution/beta.py +3 -3
  226. mindspore/nn/probability/distribution/categorical.py +1 -1
  227. mindspore/nn/probability/distribution/cauchy.py +4 -2
  228. mindspore/nn/probability/distribution/exponential.py +6 -7
  229. mindspore/nn/probability/distribution/gamma.py +2 -2
  230. mindspore/nn/probability/distribution/gumbel.py +2 -2
  231. mindspore/nn/probability/distribution/half_normal.py +5 -3
  232. mindspore/nn/probability/distribution/logistic.py +5 -3
  233. mindspore/nn/probability/distribution/poisson.py +1 -1
  234. mindspore/nn/probability/distribution/uniform.py +5 -3
  235. mindspore/nn/reinforcement/_tensors_queue.py +1 -1
  236. mindspore/nn/reinforcement/tensor_array.py +1 -1
  237. mindspore/nn/utils/init.py +13 -11
  238. mindspore/nn/wrap/__init__.py +6 -6
  239. mindspore/nn/wrap/cell_wrapper.py +181 -122
  240. mindspore/nn/wrap/grad_reducer.py +45 -36
  241. mindspore/nn/wrap/loss_scale.py +6 -7
  242. mindspore/numpy/array_creations.py +63 -65
  243. mindspore/numpy/array_ops.py +149 -144
  244. mindspore/numpy/logic_ops.py +41 -42
  245. mindspore/numpy/math_ops.py +361 -359
  246. mindspore/numpy/utils.py +17 -18
  247. mindspore/numpy/utils_const.py +5 -6
  248. mindspore/opencv_core452.dll +0 -0
  249. mindspore/opencv_imgcodecs452.dll +0 -0
  250. mindspore/opencv_imgproc452.dll +0 -0
  251. mindspore/ops/__init__.py +5 -3
  252. mindspore/ops/_grad_experimental/grad_comm_ops.py +112 -16
  253. mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -2
  254. mindspore/ops/_grad_experimental/grad_inner_ops.py +9 -0
  255. mindspore/ops/_grad_experimental/grad_math_ops.py +2 -1
  256. mindspore/ops/_grad_experimental/taylor_rule.py +29 -0
  257. mindspore/ops/_op_impl/cpu/__init__.py +1 -0
  258. mindspore/ops/_op_impl/cpu/raise_op.py +28 -0
  259. mindspore/ops/_register_for_op.py +0 -11
  260. mindspore/{ops_generate → ops/_utils}/arg_dtype_cast.py +123 -4
  261. mindspore/{ops_generate → ops/_utils}/arg_handler.py +3 -65
  262. mindspore/ops/_vmap/vmap_array_ops.py +52 -25
  263. mindspore/ops/_vmap/vmap_base.py +0 -2
  264. mindspore/ops/_vmap/vmap_grad_nn_ops.py +21 -14
  265. mindspore/ops/_vmap/vmap_math_ops.py +15 -16
  266. mindspore/ops/_vmap/vmap_nn_ops.py +29 -42
  267. mindspore/ops/auto_generate/__init__.py +4 -3
  268. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +258 -46
  269. mindspore/ops/auto_generate/gen_extend_func.py +757 -185
  270. mindspore/ops/auto_generate/gen_ops_def.py +4197 -2243
  271. mindspore/ops/auto_generate/gen_ops_prim.py +16976 -6055
  272. mindspore/ops/auto_generate/pyboost_inner_prim.py +221 -87
  273. mindspore/ops/composite/__init__.py +2 -1
  274. mindspore/ops/composite/base.py +20 -25
  275. mindspore/ops/composite/math_ops.py +6 -16
  276. mindspore/ops/composite/multitype_ops/__init__.py +5 -2
  277. mindspore/ops/composite/multitype_ops/_compile_utils.py +228 -30
  278. mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -2
  279. mindspore/ops/composite/multitype_ops/add_impl.py +2 -1
  280. mindspore/ops/composite/multitype_ops/bitwise_and_impl.py +2 -1
  281. mindspore/ops/composite/multitype_ops/bitwise_or_impl.py +2 -1
  282. mindspore/ops/composite/multitype_ops/bitwise_xor_impl.py +2 -1
  283. mindspore/ops/composite/multitype_ops/div_impl.py +6 -4
  284. mindspore/ops/composite/multitype_ops/equal_impl.py +4 -3
  285. mindspore/ops/composite/multitype_ops/floordiv_impl.py +2 -1
  286. mindspore/ops/composite/multitype_ops/getitem_impl.py +3 -2
  287. mindspore/ops/composite/multitype_ops/greater_equal_impl.py +4 -3
  288. mindspore/ops/composite/multitype_ops/greater_impl.py +4 -3
  289. mindspore/ops/composite/multitype_ops/in_impl.py +2 -1
  290. mindspore/ops/composite/multitype_ops/invert_impl.py +50 -0
  291. mindspore/ops/composite/multitype_ops/left_shift_impl.py +2 -1
  292. mindspore/ops/composite/multitype_ops/less_equal_impl.py +4 -3
  293. mindspore/ops/composite/multitype_ops/less_impl.py +4 -3
  294. mindspore/ops/composite/multitype_ops/logic_not_impl.py +3 -2
  295. mindspore/ops/composite/multitype_ops/logical_and_impl.py +2 -1
  296. mindspore/ops/composite/multitype_ops/logical_or_impl.py +2 -1
  297. mindspore/ops/composite/multitype_ops/mod_impl.py +2 -1
  298. mindspore/ops/composite/multitype_ops/mul_impl.py +3 -2
  299. mindspore/ops/composite/multitype_ops/negative_impl.py +2 -1
  300. mindspore/ops/composite/multitype_ops/not_equal_impl.py +2 -1
  301. mindspore/ops/composite/multitype_ops/not_in_impl.py +2 -1
  302. mindspore/ops/composite/multitype_ops/ones_like_impl.py +18 -0
  303. mindspore/ops/composite/multitype_ops/pow_impl.py +2 -30
  304. mindspore/ops/composite/multitype_ops/right_shift_impl.py +2 -1
  305. mindspore/ops/composite/multitype_ops/setitem_impl.py +2 -1
  306. mindspore/ops/composite/multitype_ops/sub_impl.py +2 -1
  307. mindspore/ops/function/__init__.py +40 -2
  308. mindspore/ops/function/_add_attr_func.py +58 -0
  309. mindspore/ops/function/array_func.py +2089 -2403
  310. mindspore/ops/function/clip_func.py +80 -23
  311. mindspore/ops/function/debug_func.py +57 -57
  312. mindspore/ops/function/grad/__init__.py +1 -0
  313. mindspore/ops/function/grad/grad_func.py +104 -71
  314. mindspore/ops/function/image_func.py +2 -2
  315. mindspore/ops/function/linalg_func.py +47 -78
  316. mindspore/ops/function/math_func.py +4351 -3813
  317. mindspore/ops/function/nn_func.py +1712 -637
  318. mindspore/ops/function/other_func.py +159 -1
  319. mindspore/ops/function/parameter_func.py +18 -84
  320. mindspore/ops/function/random_func.py +452 -387
  321. mindspore/ops/function/reshard_func.py +4 -70
  322. mindspore/ops/function/sparse_func.py +3 -3
  323. mindspore/ops/function/sparse_unary_func.py +6 -6
  324. mindspore/ops/function/spectral_func.py +25 -58
  325. mindspore/ops/function/vmap_func.py +26 -18
  326. mindspore/ops/functional.py +23 -7
  327. mindspore/ops/functional_overload.py +1548 -0
  328. mindspore/ops/op_info_register.py +32 -244
  329. mindspore/ops/operations/__init__.py +23 -15
  330. mindspore/ops/operations/_custom_ops_utils.py +235 -0
  331. mindspore/ops/operations/_embedding_cache_ops.py +4 -4
  332. mindspore/ops/operations/_grad_ops.py +2 -43
  333. mindspore/ops/operations/_infer_ops.py +2 -1
  334. mindspore/ops/operations/_inner_ops.py +43 -84
  335. mindspore/ops/operations/_ms_kernel.py +4 -10
  336. mindspore/ops/operations/_rl_inner_ops.py +1 -1
  337. mindspore/ops/operations/_scalar_ops.py +3 -2
  338. mindspore/ops/operations/_sequence_ops.py +1 -1
  339. mindspore/ops/operations/_tensor_array.py +1 -1
  340. mindspore/ops/operations/array_ops.py +81 -324
  341. mindspore/ops/operations/comm_ops.py +154 -108
  342. mindspore/ops/operations/custom_ops.py +298 -87
  343. mindspore/ops/operations/debug_ops.py +157 -59
  344. mindspore/ops/operations/inner_ops.py +7 -5
  345. mindspore/ops/operations/linalg_ops.py +1 -57
  346. mindspore/ops/operations/manually_defined/_inner.py +1 -1
  347. mindspore/ops/operations/manually_defined/ops_def.py +928 -180
  348. mindspore/ops/operations/math_ops.py +32 -234
  349. mindspore/ops/operations/nn_ops.py +212 -531
  350. mindspore/ops/operations/other_ops.py +62 -9
  351. mindspore/ops/operations/random_ops.py +13 -7
  352. mindspore/ops/operations/reshard_ops.py +1 -1
  353. mindspore/ops/operations/sparse_ops.py +2 -2
  354. mindspore/ops/primitive.py +66 -53
  355. mindspore/ops/tensor_method.py +1895 -0
  356. mindspore/ops_generate/__init__.py +0 -5
  357. mindspore/ops_generate/aclnn/__init__.py +0 -0
  358. mindspore/ops_generate/aclnn/aclnn_kernel_register_auto_cc_generator.py +135 -0
  359. mindspore/ops_generate/aclnn/gen_aclnn_implement.py +257 -0
  360. mindspore/ops_generate/api/__init__.py +0 -0
  361. mindspore/ops_generate/api/add_tensor_docs_generator.py +56 -0
  362. mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +105 -0
  363. mindspore/ops_generate/api/functional_map_cpp_generator.py +504 -0
  364. mindspore/ops_generate/api/functional_overload_py_generator.py +112 -0
  365. mindspore/ops_generate/api/functions_cc_generator.py +237 -0
  366. mindspore/ops_generate/api/gen_api.py +103 -0
  367. mindspore/ops_generate/api/op_api_proto.py +235 -0
  368. mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +461 -0
  369. mindspore/ops_generate/common/__init__.py +0 -0
  370. mindspore/ops_generate/common/base_generator.py +11 -0
  371. mindspore/ops_generate/common/gen_constants.py +91 -0
  372. mindspore/ops_generate/common/gen_utils.py +348 -0
  373. mindspore/ops_generate/common/op_proto.py +473 -0
  374. mindspore/ops_generate/common/template.py +523 -0
  375. mindspore/ops_generate/gen_ops.py +22 -1069
  376. mindspore/ops_generate/op_def/__init__.py +0 -0
  377. mindspore/ops_generate/op_def/gen_op_def.py +90 -0
  378. mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +191 -0
  379. mindspore/ops_generate/op_def/ops_def_cc_generator.py +296 -0
  380. mindspore/ops_generate/op_def/ops_def_h_generator.py +74 -0
  381. mindspore/ops_generate/op_def/ops_name_h_generator.py +83 -0
  382. mindspore/ops_generate/op_def/ops_primitive_h_generator.py +125 -0
  383. mindspore/ops_generate/op_def_py/__init__.py +0 -0
  384. mindspore/ops_generate/op_def_py/gen_op_def_py.py +47 -0
  385. mindspore/ops_generate/op_def_py/op_def_py_generator.py +132 -0
  386. mindspore/ops_generate/op_def_py/op_prim_py_generator.py +489 -0
  387. mindspore/ops_generate/pyboost/__init__.py +0 -0
  388. mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +139 -0
  389. mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +93 -0
  390. mindspore/ops_generate/pyboost/gen_pyboost_func.py +175 -0
  391. mindspore/ops_generate/pyboost/op_template_parser.py +517 -0
  392. mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +407 -0
  393. mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +100 -0
  394. mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +148 -0
  395. mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +155 -0
  396. mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +132 -0
  397. mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +272 -0
  398. mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +938 -0
  399. mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +357 -0
  400. mindspore/ops_generate/{pyboost_utils.py → pyboost/pyboost_utils.py} +179 -36
  401. mindspore/ops_generate/resources/__init__.py +0 -0
  402. mindspore/ops_generate/resources/resource_list.py +30 -0
  403. mindspore/ops_generate/resources/resource_loader.py +36 -0
  404. mindspore/ops_generate/resources/resource_manager.py +64 -0
  405. mindspore/ops_generate/resources/yaml_loader.py +88 -0
  406. mindspore/ops_generate/tensor_py_cc_generator.py +122 -0
  407. mindspore/parallel/__init__.py +7 -3
  408. mindspore/parallel/_auto_parallel_context.py +159 -40
  409. mindspore/parallel/_cell_wrapper.py +132 -15
  410. mindspore/parallel/_parallel_serialization.py +107 -5
  411. mindspore/parallel/_ps_context.py +1 -1
  412. mindspore/parallel/_recovery_context.py +7 -2
  413. mindspore/parallel/_tensor.py +142 -18
  414. mindspore/parallel/_utils.py +199 -23
  415. mindspore/parallel/algo_parameter_config.py +4 -4
  416. mindspore/parallel/auto_parallel.py +732 -0
  417. mindspore/parallel/checkpoint_convert.py +159 -0
  418. mindspore/parallel/checkpoint_transform.py +700 -35
  419. mindspore/parallel/cluster/process_entity/_api.py +276 -50
  420. mindspore/parallel/cluster/process_entity/_utils.py +41 -6
  421. mindspore/parallel/cluster/run.py +21 -4
  422. mindspore/parallel/function/__init__.py +24 -0
  423. mindspore/parallel/function/reshard_func.py +258 -0
  424. mindspore/parallel/nn/__init__.py +25 -0
  425. mindspore/parallel/nn/parallel_cell_wrapper.py +263 -0
  426. mindspore/parallel/nn/parallel_grad_reducer.py +169 -0
  427. mindspore/parallel/parameter_broadcast.py +25 -14
  428. mindspore/parallel/shard.py +137 -59
  429. mindspore/parallel/transform_safetensors.py +364 -305
  430. mindspore/profiler/__init__.py +22 -5
  431. mindspore/profiler/analysis/__init__.py +0 -0
  432. mindspore/profiler/analysis/parser/__init__.py +0 -0
  433. mindspore/profiler/analysis/parser/ascend_cann_parser.py +170 -0
  434. mindspore/profiler/analysis/parser/base_parser.py +158 -0
  435. mindspore/profiler/analysis/parser/framework_cann_relation_parser.py +45 -0
  436. mindspore/profiler/analysis/parser/ms_framework_parser.py +142 -0
  437. mindspore/profiler/analysis/parser/ms_minddata_parser.py +145 -0
  438. mindspore/profiler/analysis/parser/timeline_assembly_factory/__init__.py +0 -0
  439. mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +264 -0
  440. mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +40 -0
  441. mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +109 -0
  442. mindspore/profiler/analysis/parser/timeline_creator/__init__.py +0 -0
  443. mindspore/profiler/analysis/parser/timeline_creator/base_timeline_creator.py +44 -0
  444. mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +90 -0
  445. mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +76 -0
  446. mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +103 -0
  447. mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +134 -0
  448. mindspore/profiler/analysis/parser/timeline_event/__init__.py +0 -0
  449. mindspore/profiler/analysis/parser/timeline_event/base_event.py +233 -0
  450. mindspore/profiler/analysis/parser/timeline_event/cpu_op_event.py +47 -0
  451. mindspore/profiler/analysis/parser/timeline_event/flow_event.py +36 -0
  452. mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +415 -0
  453. mindspore/profiler/analysis/parser/timeline_event/msprof_event.py +73 -0
  454. mindspore/profiler/analysis/parser/timeline_event/scope_layer_event.py +53 -0
  455. mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +146 -0
  456. mindspore/profiler/analysis/task_manager.py +131 -0
  457. mindspore/profiler/analysis/time_converter.py +84 -0
  458. mindspore/profiler/analysis/viewer/__init__.py +0 -0
  459. mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +372 -0
  460. mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +87 -0
  461. mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +250 -0
  462. mindspore/profiler/analysis/viewer/ascend_memory_viewer.py +320 -0
  463. mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +327 -0
  464. mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +376 -0
  465. mindspore/profiler/analysis/viewer/ascend_timeline_viewer.py +58 -0
  466. mindspore/profiler/analysis/viewer/base_viewer.py +26 -0
  467. mindspore/profiler/analysis/viewer/ms_dataset_viewer.py +96 -0
  468. mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +581 -0
  469. mindspore/profiler/analysis/work_flow.py +73 -0
  470. mindspore/profiler/common/ascend_msprof_exporter.py +139 -0
  471. mindspore/profiler/common/command_executor.py +90 -0
  472. mindspore/profiler/common/constant.py +186 -3
  473. mindspore/profiler/common/file_manager.py +208 -0
  474. mindspore/profiler/common/log.py +130 -0
  475. mindspore/profiler/common/msprof_cmd_tool.py +221 -0
  476. mindspore/profiler/common/path_manager.py +395 -0
  477. mindspore/profiler/common/process_bar.py +168 -0
  478. mindspore/profiler/common/process_pool.py +9 -3
  479. mindspore/profiler/common/profiler_context.py +500 -0
  480. mindspore/profiler/common/profiler_info.py +304 -0
  481. mindspore/profiler/common/profiler_meta_data.py +74 -0
  482. mindspore/profiler/common/profiler_output_path.py +284 -0
  483. mindspore/profiler/common/profiler_parameters.py +251 -0
  484. mindspore/profiler/common/profiler_path_manager.py +179 -0
  485. mindspore/profiler/common/record_function.py +76 -0
  486. mindspore/profiler/common/tlv_decoder.py +76 -0
  487. mindspore/profiler/common/util.py +75 -2
  488. mindspore/profiler/dynamic_profiler.py +341 -75
  489. mindspore/profiler/envprofiler.py +163 -0
  490. mindspore/profiler/experimental_config.py +197 -0
  491. mindspore/profiler/mstx.py +242 -0
  492. mindspore/profiler/platform/__init__.py +21 -0
  493. mindspore/profiler/platform/base_profiler.py +40 -0
  494. mindspore/profiler/platform/cpu_profiler.py +124 -0
  495. mindspore/profiler/platform/gpu_profiler.py +74 -0
  496. mindspore/profiler/platform/npu_profiler.py +335 -0
  497. mindspore/profiler/profiler.py +1073 -90
  498. mindspore/profiler/profiler_action_controller.py +187 -0
  499. mindspore/profiler/profiler_interface.py +118 -0
  500. mindspore/profiler/schedule.py +243 -0
  501. mindspore/rewrite/api/node.py +15 -13
  502. mindspore/rewrite/api/symbol_tree.py +2 -3
  503. mindspore/run_check/_check_version.py +27 -20
  504. mindspore/run_check/run_check.py +1 -1
  505. mindspore/runtime/__init__.py +37 -0
  506. mindspore/runtime/device.py +27 -0
  507. mindspore/runtime/event.py +209 -0
  508. mindspore/runtime/executor.py +177 -0
  509. mindspore/runtime/memory.py +416 -0
  510. mindspore/runtime/stream.py +460 -0
  511. mindspore/runtime/thread_bind_core.py +401 -0
  512. mindspore/safeguard/rewrite_obfuscation.py +12 -9
  513. mindspore/swresample-4.dll +0 -0
  514. mindspore/swscale-6.dll +0 -0
  515. mindspore/tinyxml2.dll +0 -0
  516. mindspore/train/__init__.py +8 -8
  517. mindspore/train/_utils.py +96 -27
  518. mindspore/train/amp.py +9 -5
  519. mindspore/train/callback/__init__.py +2 -2
  520. mindspore/train/callback/_callback.py +2 -16
  521. mindspore/train/callback/_checkpoint.py +53 -55
  522. mindspore/train/callback/_cluster_monitor.py +14 -18
  523. mindspore/train/callback/_early_stop.py +1 -1
  524. mindspore/train/callback/_flops_collector.py +103 -68
  525. mindspore/train/callback/_history.py +8 -5
  526. mindspore/train/callback/_lambda_callback.py +2 -2
  527. mindspore/train/callback/_landscape.py +0 -3
  528. mindspore/train/callback/_loss_monitor.py +2 -1
  529. mindspore/train/callback/_on_request_exit.py +6 -5
  530. mindspore/train/callback/_reduce_lr_on_plateau.py +11 -6
  531. mindspore/train/callback/_summary_collector.py +52 -19
  532. mindspore/train/callback/_time_monitor.py +2 -1
  533. mindspore/train/callback/{_tft_register.py → _train_fault_tolerance.py} +228 -108
  534. mindspore/train/data_sink.py +25 -2
  535. mindspore/train/dataset_helper.py +15 -16
  536. mindspore/train/loss_scale_manager.py +8 -7
  537. mindspore/train/metrics/accuracy.py +3 -3
  538. mindspore/train/metrics/confusion_matrix.py +9 -9
  539. mindspore/train/metrics/error.py +3 -3
  540. mindspore/train/metrics/hausdorff_distance.py +4 -4
  541. mindspore/train/metrics/mean_surface_distance.py +3 -3
  542. mindspore/train/metrics/metric.py +0 -12
  543. mindspore/train/metrics/occlusion_sensitivity.py +4 -2
  544. mindspore/train/metrics/precision.py +11 -10
  545. mindspore/train/metrics/recall.py +9 -9
  546. mindspore/train/metrics/root_mean_square_surface_distance.py +2 -2
  547. mindspore/train/mind_ir_pb2.py +174 -46
  548. mindspore/train/model.py +269 -136
  549. mindspore/train/serialization.py +622 -978
  550. mindspore/train/summary/_summary_adapter.py +2 -2
  551. mindspore/train/summary/summary_record.py +2 -3
  552. mindspore/train/train_thor/model_thor.py +1 -1
  553. mindspore/turbojpeg.dll +0 -0
  554. mindspore/utils/__init__.py +6 -3
  555. mindspore/utils/dryrun.py +140 -0
  556. mindspore/utils/hooks.py +81 -0
  557. mindspore/utils/runtime_execution_order_check.py +552 -0
  558. mindspore/utils/utils.py +138 -4
  559. mindspore/version.py +1 -1
  560. {mindspore-2.4.10.dist-info → mindspore-2.6.0.dist-info}/METADATA +3 -3
  561. {mindspore-2.4.10.dist-info → mindspore-2.6.0.dist-info}/RECORD +564 -395
  562. {mindspore-2.4.10.dist-info → mindspore-2.6.0.dist-info}/entry_points.txt +1 -1
  563. mindspore/_install_custom.py +0 -43
  564. mindspore/common/_register_for_adapter.py +0 -74
  565. mindspore/common/_tensor_overload.py +0 -139
  566. mindspore/mindspore_np_dtype.dll +0 -0
  567. mindspore/ops/auto_generate/gen_arg_dtype_cast.py +0 -252
  568. mindspore/ops/auto_generate/gen_arg_handler.py +0 -197
  569. mindspore/ops/operations/_opaque_predicate_registry.py +0 -41
  570. mindspore/ops_generate/gen_aclnn_implement.py +0 -263
  571. mindspore/ops_generate/gen_ops_inner_prim.py +0 -131
  572. mindspore/ops_generate/gen_pyboost_func.py +0 -1052
  573. mindspore/ops_generate/gen_utils.py +0 -209
  574. mindspore/ops_generate/op_proto.py +0 -145
  575. mindspore/ops_generate/template.py +0 -261
  576. mindspore/profiler/envprofiling.py +0 -254
  577. mindspore/profiler/profiling.py +0 -1926
  578. {mindspore-2.4.10.dist-info → mindspore-2.6.0.dist-info}/WHEEL +0 -0
  579. {mindspore-2.4.10.dist-info → mindspore-2.6.0.dist-info}/top_level.txt +0 -0
mindspore/context.py CHANGED
@@ -26,7 +26,7 @@ from collections import namedtuple
26
26
  from types import FunctionType
27
27
 
28
28
  from mindspore import log as logger
29
- from mindspore._c_expression import MSContext, ms_ctx_param
29
+ from mindspore._c_expression import MSContext, ms_ctx_param, CollectiveManager
30
30
  from mindspore import _checkparam as Validator
31
31
  from mindspore._checkparam import args_type_check
32
32
  from mindspore.parallel._auto_parallel_context import _set_auto_parallel_context, _get_auto_parallel_context, \
@@ -254,9 +254,9 @@ class _Context:
254
254
 
255
255
  def set_exec_order(self, exec_order):
256
256
  """
257
- The execution order mode, support "bfs", "dfs", "gpto".
257
+ The execution order mode, support "bfs", "dfs".
258
258
  """
259
- exec_order_modes = ["bfs", "dfs", "gpto"]
259
+ exec_order_modes = ["bfs", "dfs"]
260
260
  if exec_order not in exec_order_modes:
261
261
  raise ValueError(f"For 'context.set_context', the argument 'exec_order' must be one of "
262
262
  f"{exec_order_modes}, but got {exec_order}.")
@@ -289,6 +289,11 @@ class _Context:
289
289
  if deterministic not in deterministic_options:
290
290
  raise ValueError(f"For 'context.set_context', the argument 'deterministic' must be one of "
291
291
  f"{deterministic_options}, but got {deterministic}.")
292
+
293
+ # Must wait for all async created groups to be initialized so that
294
+ # deterministic feature could be consistent between all processes.
295
+ CollectiveManager.get_instance().wait_all_comm_init()
296
+
292
297
  self.set_param(ms_ctx_param.deterministic, deterministic)
293
298
 
294
299
  hccl_deterministic = os.getenv("HCCL_DETERMINISTIC")
@@ -330,8 +335,8 @@ class _Context:
330
335
  default not enabled, only supports ``"oom"`` currently.
331
336
  ``"oom"``: Detect memory out of bounds.
332
337
  - ge_options (dict): Global or session CANN options.
333
- - exception_dump (str): Enable exception dump for Ascend operators. ``"0"`` , ``"1"`` and ``"2"``.
334
- Default: ``"2"`` .
338
+ - exception_dump (str): Has been deprecated since MindSpore 2.6. Please use
339
+ api :func:`mindspore.device_context.ascend.op_debug.aclinit_config` instead.
335
340
  - parallel_speed_up_json_path(Union[str, None]): The path to the parallel speed up json file.
336
341
  If its value is None or '', it does not take effect. Default None.
337
342
  - host_scheduling_max_threshold(int): The host scheduling max threshold.
@@ -365,7 +370,7 @@ class _Context:
365
370
  'atomic_clean_policy': self._get_ascend_config_setter('atomic_clean_policy', str),
366
371
  'matmul_allow_hf32': self._get_ascend_config_setter('matmul_allow_hf32', lambda v: "1" if v else "0"),
367
372
  'conv_allow_hf32': self._get_ascend_config_setter('conv_allow_hf32', lambda v: "1" if v else "0"),
368
- 'exception_dump': self._get_ascend_config_setter('exception_dump'),
373
+ 'exception_dump': lambda x: x,
369
374
  'op_debug_option': self._set_op_debug_option,
370
375
  'op_precision_mode': self._set_op_precision_mode,
371
376
  'ge_options': self._set_ge_options,
@@ -378,11 +383,24 @@ class _Context:
378
383
  'hccl_watchdog': self._set_hccl_watchdog,
379
384
  'topo_order': self._set_topo_order
380
385
  }
386
+ invalid_context_dict = {
387
+ 'exception_dump': {'version': '2.6', 'interface': 'device_context.ascend.op_debug.aclinit_config()'}
388
+ }
381
389
  ascend_cfg_set = tuple(ascend_cfg_modes.keys())
382
390
  for ascend_key, ascend_value in ascend_config.items():
383
391
  if ascend_key not in ascend_cfg_set:
384
392
  raise ValueError(f"For 'context.set_context', the key of argument 'ascend_config' must be one of "
385
393
  f"{ascend_cfg_set}, but got {ascend_key}.")
394
+ if ascend_key in invalid_context_dict:
395
+ key = invalid_context_dict.get(ascend_key)
396
+ deprecated_version, new_interface = key.get('version'), key.get('interface')
397
+ log = (
398
+ f"For 'ascend_config', the parameter '{ascend_key}' has been removed"
399
+ f" since MindSpore {deprecated_version} version."
400
+ )
401
+ if new_interface:
402
+ log += f" Please use the {new_interface} instead."
403
+ raise ValueError(log)
386
404
  supported_modes = ascend_cfg_modes.get(ascend_key)
387
405
  if isinstance(supported_modes, list) and ascend_value not in supported_modes:
388
406
  raise ValueError(f"For 'ascend_config', the value of argument {ascend_key} must be one of "
@@ -831,14 +849,22 @@ class _Context:
831
849
  f"'parallel_speed_up_json_path' is correct.")
832
850
  try:
833
851
  valid_option = {"recompute_comm_overlap": (ms_ctx_param.recompute_comm_overlap, bool),
852
+ "recomputation_communication_overlap": (ms_ctx_param.recompute_comm_overlap, bool),
834
853
  "matmul_grad_comm_overlap": (ms_ctx_param.matmul_grad_comm_overlap, bool),
854
+ "grad_matmul_communication_overlap": (ms_ctx_param.matmul_grad_comm_overlap, bool),
835
855
  "enable_task_opt": (ms_ctx_param.enable_task_opt, bool),
856
+ "enable_communication_fusion": (ms_ctx_param.enable_task_opt, bool),
836
857
  "enable_grad_comm_opt": (ms_ctx_param.enable_grad_comm_opt, bool),
858
+ "grad_computation_allreduce_overlap": (ms_ctx_param.enable_grad_comm_opt, bool),
837
859
  "recompute_allgather_overlap_fagrad":
838
860
  (ms_ctx_param.recompute_allgather_overlap_fagrad, bool),
861
+ "grad_fa_allgather_overlap":
862
+ (ms_ctx_param.recompute_allgather_overlap_fagrad, bool),
839
863
  "interleaved_matmul_comm": (ms_ctx_param.interleaved_matmul_comm, bool),
840
864
  "bias_add_comm_swap": (ms_ctx_param.bias_add_comm_swap, bool),
865
+ "allreduce_and_biasadd_swap": (ms_ctx_param.bias_add_comm_swap, bool),
841
866
  "enable_opt_shard_comm_opt": (ms_ctx_param.enable_opt_shard_comm_opt, bool),
867
+ "computation_allgather_overlap": (ms_ctx_param.enable_opt_shard_comm_opt, bool),
842
868
  "enable_begin_end_inline_opt": (ms_ctx_param.enable_begin_end_inline_opt, bool),
843
869
  "enable_concat_eliminate_opt": (ms_ctx_param.enable_concat_eliminate_opt, bool),
844
870
  "interleaved_layernorm_comm": (ms_ctx_param.interleaved_layernorm_comm, bool),
@@ -846,13 +872,29 @@ class _Context:
846
872
  (ms_ctx_param.enable_allreduce_slice_to_reducescatter, bool),
847
873
  "enable_interleave_split_concat_branch":
848
874
  (ms_ctx_param.enable_interleave_split_concat_branch, bool),
875
+ "enable_interleave_parallel_branch":
876
+ (ms_ctx_param.enable_interleave_parallel_branch, bool),
849
877
  "enable_offloading_packed_experts": (ms_ctx_param.enable_offloading_packed_experts, bool),
850
878
  "compute_communicate_fusion_level":
851
879
  (ms_ctx_param.compute_communicate_fusion_level, int),
880
+ "computation_communication_fusion_level":
881
+ (ms_ctx_param.compute_communicate_fusion_level, int),
852
882
  "enable_flash_attention_load_balance":
853
883
  (ms_ctx_param.enable_flash_attention_load_balance, bool),
884
+ "pp_1f1b_overlap":
885
+ (ms_ctx_param.pp_1f1b_overlap, str),
854
886
  "dataset_broadcast_opt_level":
855
887
  (ms_ctx_param.dataset_broadcast_opt_level, int)}
888
+ name_replace = {
889
+ "recompute_comm_overlap": "recomputation_communication_overlap",
890
+ "matmul_grad_comm_overlap": "grad_matmul_communication_overlap",
891
+ "recompute_allgather_overlap_fagrad": "grad_fa_allgather_overlap",
892
+ "enable_task_opt": "enable_communication_fusion",
893
+ "enable_grad_comm_opt": "grad_computation_allreduce_overlap",
894
+ "enable_opt_shard_comm_opt": "computation_allgather_overlap",
895
+ "compute_communicate_fusion_level": "computation_communication_fusion_level",
896
+ "dataset_broadcast_opt_level": "dataset_broadcast_opt_level",
897
+ "bias_add_comm_swap": "allreduce_and_biasadd_swap"}
856
898
  with open(speedup_config_real_path, 'r') as f:
857
899
  speedup_config = json.load(f)
858
900
  for key, value in speedup_config.items():
@@ -860,10 +902,22 @@ class _Context:
860
902
  raise TypeError("key {} is not a str".format(key))
861
903
  if key not in valid_option:
862
904
  raise ValueError("key {} should be one of {}.".format(key, valid_option.keys()))
905
+ if key in name_replace:
906
+ logger.warning(f"For 'context.set_context', '{key}' parameter is deprecated, "
907
+ "and will be removed in the next version, "
908
+ f"Please use '{name_replace.get(key)}' instead.")
863
909
  set_func, valid_type = valid_option.get(key)
864
910
  if not isinstance(value, valid_type):
865
911
  raise TypeError(f"The value type of {key} must be {valid_type}, "
866
912
  f"but got value is {value} and type is {type(value)}.")
913
+ if key == "pp_1f1b_overlap":
914
+ values = value.split(",")
915
+ for v in values:
916
+ if v not in ['AlltoAll', 'AlltoAllV', 'MorphAllGather',
917
+ 'AllGather', 'ReduceScatter', 'MorphReduceScatter']:
918
+ raise ValueError("{} 's value should be subset of ['AlltoAll', 'AlltoAllV',"
919
+ " 'MorphAllGather', 'AllGather', 'ReduceScatter',"
920
+ " 'MorphReduceScatter'].".format(key))
867
921
  self.set_param(set_func, value)
868
922
  except (TypeError, ValueError) as exo:
869
923
  raise ValueError(str(exo) + "\nFor 'context.set_context', "
@@ -906,15 +960,11 @@ def _context():
906
960
  comm_fusion=dict, strategy_ckpt_config=dict, force_fp32_communication=bool)
907
961
  def set_auto_parallel_context(**kwargs):
908
962
  r"""
909
- Set auto parallel context, only data parallel supported on CPU.
963
+ Set auto parallel context, this api will be deprecated and removed in future versions, please use the api
964
+ :class:`mindspore.parallel.auto_parallel.AutoParallel` instead.
910
965
 
911
966
  Note:
912
- Attribute name is required for setting attributes.
913
- If a program has tasks on different parallel modes, before setting a new parallel mode for the
914
- next task, interface :func:`mindspore.reset_auto_parallel_context` should be called to reset
915
- the configuration.
916
- Setting or changing parallel modes must be called before creating any Initializer, otherwise,
917
- it may have RuntimeError when compiling the network.
967
+ CPU only support data parallel.
918
968
 
919
969
  Some configurations are parallel mode specific, see the below table for details:
920
970
 
@@ -936,6 +986,7 @@ def set_auto_parallel_context(**kwargs):
936
986
  \ group_ckpt_save_file
937
987
  \ auto_pipeline
938
988
  \ dump_local_norm
989
+ \ dump_local_norm_path
939
990
  \ dump_device_local_norm
940
991
  =========================== ===========================
941
992
 
@@ -963,13 +1014,15 @@ def set_auto_parallel_context(**kwargs):
963
1014
  - auto_parallel: Achieving parallelism automatically.
964
1015
  search_mode (str): There are three kinds of shard strategy search modes: ``"recursive_programming"`` ,
965
1016
  ``"sharding_propagation"`` and ``"dynamic_programming"`` (Not recommended).
1017
+ Only works in ``"auto_parallel"`` mode.
966
1018
  Default: ``"recursive_programming"`` .
967
1019
 
968
1020
  - recursive_programming: Recursive programming search mode. In order to obtain optimal performance,
969
1021
  it is recommended that users set the batch size to be greater than or equal to the product of
970
1022
  the number of devices and the number of multi-copy parallelism.
971
1023
 
972
- - sharding_propagation: Propagate shardings from configured ops to non-configured ops.
1024
+ - sharding_propagation: Propagate shardings from configured ops to non-configured ops. Dynamic
1025
+ shapes are not supported currently.
973
1026
 
974
1027
  - dynamic_programming: Dynamic programming search mode.
975
1028
  auto_parallel_search_mode (str): This is the old version of 'search_mode'. Here, remaining this attribute is
@@ -992,7 +1045,9 @@ def set_auto_parallel_context(**kwargs):
992
1045
  dataset_strategy="data_parallel" is equal to full_batch=False, dataset_strategy="full_batch" is
993
1046
  equal to full_batch=True. For execution mode is 'GRAPH_MODE' and dataset load into net by model
994
1047
  parallel strategy likes ds_stra ((1, 8), (1, 8)), it requires using
995
- set_auto_parallel_context(dataset_strategy=ds_stra).
1048
+ set_auto_parallel_context(dataset_strategy=ds_stra). The dataset sharding strategy is not
1049
+ affected by the currently configured parallel mode. parallel strategy also supports tuple of
1050
+ Layout.
996
1051
  enable_parallel_optimizer (bool): This is a developing feature, which shards the weight update computation for
997
1052
  data parallel training in the benefit of time and memory saving. Currently, auto and semi auto
998
1053
  parallel mode support all optimizers in both Ascend and GPU. Data parallel mode only supports
@@ -1016,14 +1071,17 @@ def set_auto_parallel_context(**kwargs):
1016
1071
 
1017
1072
  - pipeline_interleave(bool): Indicates whether to enable the interleaved execution mode.
1018
1073
  - pipeline_scheduler(str): Indicates the scheduling mode for pipeline parallelism. Only support
1019
- ``gpipe/1f1b``.
1074
+ ``gpipe/1f1b/seqpipe/seqvpp/seqsmartvpp``. When applying seqsmartvpp, the pipeline parallel
1075
+ must be an even number.
1020
1076
  parallel_optimizer_config (dict): A dict contains the keys and values for setting the parallel optimizer
1021
1077
  configure. The configure provides more detailed behavior control about parallel training
1022
1078
  when parallel optimizer is enabled. The configure will be effective when we use
1023
1079
  mindspore.set_auto_parallel_context(enable_parallel_optimizer=True).
1024
1080
  It supports the following keys.
1025
1081
 
1026
- - gradient_accumulation_shard(bool): If ``true`` , the accumulation gradient parameters will be
1082
+ - gradient_accumulation_shard(bool): Please using optimizer_level: ``level2`` to replace
1083
+ this config.
1084
+ If ``true`` , the accumulation gradient parameters will be
1027
1085
  sharded across the data parallel devices. This will
1028
1086
  introduce additional communication(ReduceScatter) at
1029
1087
  each step when accumulate the gradients, but saves a
@@ -1034,7 +1092,8 @@ def set_auto_parallel_context(**kwargs):
1034
1092
 
1035
1093
  - parallel_optimizer_threshold(int): Set the threshold of parallel optimizer. When parallel
1036
1094
  optimizer is enabled, parameters with size smaller than this threshold will not be sharded
1037
- across the devices. Parameter size = shape[0] \* ... \* shape[n] \* size(dtype). Non-negative.
1095
+ across the devices. Parameter size is calculated as:
1096
+ shape[0] \* ... \* shape[n] \* size(dtype). Non-negative.
1038
1097
  Unit: KB. Default: ``64`` .
1039
1098
 
1040
1099
  - optimizer_weight_shard_size(int): Set the optimizer weight shard group size, if you want to
@@ -1045,6 +1104,17 @@ def set_auto_parallel_context(**kwargs):
1045
1104
  communication group size will not take effect. Default value is ``-1`` , which means the
1046
1105
  optimizer weight shard group size will be the size of data parallel group of each parameter.
1047
1106
 
1107
+ - optimizer_level(str, optional): optimizer_level configuration is used to specify
1108
+ the splitting level for optimizer sharding. It is important to note that the implementation
1109
+ of optimizer sharding in static graph is inconsistent with dynamic graph like megatron,
1110
+ but the memory optimization effect is the same. When optimizer_level= ``level1`` ,
1111
+ splitting is performed on weights and optimizer state. When optimizer_level= ``level2`` ,
1112
+ splitting is performed on weights, optimizer state, and gradients.
1113
+ When optimizer_level= ``level3`` , splitting is performed on weights, optimizer state,
1114
+ gradients, additionally, before the backward pass, the weights are further applied with
1115
+ allgather communication to release the memory used by the forward pass allgather.
1116
+ It must be one of [``level1``, ``level2``, ``level3``]. Default: ``level1``.
1117
+
1048
1118
  comm_fusion (dict): A dict contains the types and configurations for setting the communication fusion. each
1049
1119
  communication fusion config has two keys: "mode" and "config".
1050
1120
  It supports following communication fusion types and configurations:
@@ -1091,6 +1161,8 @@ def set_auto_parallel_context(**kwargs):
1091
1161
  dump_local_norm (bool): Whether to dump local_norm value, when the `parallel_mode` is set to
1092
1162
  ``semi_auto_parallel`` or ``auto_parallel``.
1093
1163
  Default: ``False`` .
1164
+ dump_local_norm_path (str): The path to save dump files of local_norm value.
1165
+ Default: ``''`` .
1094
1166
  dump_device_local_norm (bool): Whether to dump device_local_norm value, when the `parallel_mode` is set to
1095
1167
  ``semi_auto_parallel`` or ``auto_parallel``.
1096
1168
  Default: ``False`` .
@@ -1117,7 +1189,7 @@ def set_auto_parallel_context(**kwargs):
1117
1189
  >>> ms.set_auto_parallel_context(pipeline_stages=2)
1118
1190
  >>> ms.set_auto_parallel_context(pipeline_stages=2, pipeline_result_broadcast=True)
1119
1191
  >>> parallel_config = {"gradient_accumulation_shard": True, "parallel_optimizer_threshold": 24,
1120
- ... "optimizer_weight_shard_size": 2}
1192
+ ... "optimizer_weight_shard_size": 2, "optimizer_level": "level3"}
1121
1193
  >>> ms.set_auto_parallel_context(parallel_optimizer_config=parallel_config, enable_parallel_optimizer=True)
1122
1194
  >>> config = {"allreduce": {"mode": "size", "config": 32}, "allgather": {"mode": "size", "config": 32}}
1123
1195
  >>> ms.set_auto_parallel_context(comm_fusion=config)
@@ -1129,7 +1201,8 @@ def set_auto_parallel_context(**kwargs):
1129
1201
 
1130
1202
  def get_auto_parallel_context(attr_key):
1131
1203
  """
1132
- Get auto parallel context attribute value according to the key.
1204
+ Get auto parallel context attribute value according to the key, this api will be deprecated and removed in future
1205
+ versions.
1133
1206
 
1134
1207
  Args:
1135
1208
  attr_key (str): The key of the attribute.
@@ -1150,7 +1223,8 @@ def get_auto_parallel_context(attr_key):
1150
1223
 
1151
1224
  def reset_auto_parallel_context():
1152
1225
  """
1153
- Reset auto parallel context attributes to the default values.
1226
+ Reset auto parallel context attributes to the default values, this api will be deprecated and removed in future
1227
+ versions, please use the api :class:`mindspore.parallel.auto_parallel.AutoParallel` instead.
1154
1228
 
1155
1229
  - device_num: 1.
1156
1230
  - global_rank: 0.
@@ -1171,6 +1245,7 @@ def reset_auto_parallel_context():
1171
1245
  - fusion_threshold: 64.
1172
1246
  - auto_pipeline: False.
1173
1247
  - dump_local_norm: False.
1248
+ - dump_local_norm_path: ''.
1174
1249
  - dump_device_local_norm: False.
1175
1250
 
1176
1251
  Examples:
@@ -1184,7 +1259,8 @@ def reset_auto_parallel_context():
1184
1259
  @args_type_check(offload_config=dict)
1185
1260
  def set_offload_context(offload_config):
1186
1261
  r"""
1187
- Configure heterogeneous training detailed parameters to adjust the offload strategy.
1262
+ Configure heterogeneous training detailed parameters to adjust the offload strategy, this api will be deprecated
1263
+ and removed in future versions.
1188
1264
 
1189
1265
  Note:
1190
1266
  The offload configuration is only used if the memory offload feature is enabled
@@ -1224,8 +1300,10 @@ def set_offload_context(offload_config):
1224
1300
 
1225
1301
  def get_offload_context():
1226
1302
  """
1227
- Gets the offload configuration parameters. Configure through interface mindspore.set_offload_context().
1228
- If the user is not set, the default configuration is obtained.
1303
+ Gets the offload configuration parameters, this api will be deprecated and removed in future versions.
1304
+
1305
+ Configure through interface mindspore.set_offload_context(). If the user is not set, the default configuration is
1306
+ obtained.
1229
1307
 
1230
1308
  Returns:
1231
1309
  Dict, heterogeneous training offload detailed configuration parameters.
@@ -1240,8 +1318,6 @@ def get_offload_context():
1240
1318
  def _check_target_specific_cfgs(device, arg_key):
1241
1319
  """Checking whether a config is suitable for a specified device"""
1242
1320
  device_cfgs = {
1243
- 'enable_graph_kernel': ['Ascend', 'GPU', 'CPU'],
1244
- 'graph_kernel_flags': ['Ascend', 'GPU', 'CPU'],
1245
1321
  'enable_reduce_precision': ['Ascend'],
1246
1322
  'print_file_path': ['Ascend'],
1247
1323
  'variable_memory_max_size': ['Ascend'],
@@ -1266,7 +1342,7 @@ def _check_target_specific_cfgs(device, arg_key):
1266
1342
  def _check_ascend_device_context_initialized(device_target, settings):
1267
1343
  if device_target == 'Ascend' and is_initialized(device_target):
1268
1344
  for key, _ in settings.items():
1269
- if key in ('ascend_config', 'deterministic', 'jit_compile', 'exception_dump', 'device_id'):
1345
+ if key in ('ascend_config', 'deterministic', 'jit_compile', 'device_id'):
1270
1346
  logger.warning(f"For 'context.set_context' in Ascend backend, the backend is already initialized, "
1271
1347
  "please set it before the definition of any Tensor and Parameter, and the "
1272
1348
  "instantiation and execution of any operation and net, otherwise the settings may not "
@@ -1280,9 +1356,64 @@ def _check_key(key):
1280
1356
  raise ValueError(f"Please set '{key}' through parameter ascend_config")
1281
1357
 
1282
1358
 
1359
+ def _check_context_deprecated(key):
1360
+ """Checking whether a context key will be deprecated."""
1361
+ deprecated_context_dict = {'save_graphs': 'env MS_DEV_SAVE_GRAPHS',
1362
+ 'save_graphs_path': 'env MS_DEV_SAVE_GRAPHS_PATH',
1363
+ 'precompile_only': 'env MS_DEV_PRECOMPILE_ONLY',
1364
+ 'check_bprop': '',
1365
+ 'max_call_depth': 'api mindspore.set_recursion_limit()',
1366
+ 'grad_for_scalar': 'tensor derivative',
1367
+ 'enable_compile_cache': 'env MS_COMPILER_CACHE_ENABLE',
1368
+ 'enable_cache_path': 'env MS_COMPILER_CACHE_PATH',
1369
+ 'debug_level': '',
1370
+ 'device_target': 'api mindspore.set_device()',
1371
+ 'device_id': 'api mindspore.set_device()',
1372
+ 'deterministic': 'api mindspore.set_deterministic()',
1373
+ 'inter_op_parallel_num': 'api mindspore.runtime.dispatch_threads_num()',
1374
+ 'pynative_synchronize': 'api mindspore.runtime.launch_blocking()',
1375
+ 'max_device_memory': 'api mindspore.runtime.set_memory()',
1376
+ 'variable_memory_max_size': 'api mindspore.runtime.set_memory()',
1377
+ 'mempool_block_size': 'api mindspore.runtime.set_memory()',
1378
+ 'memory_optimize_level': 'api mindspore.runtime.set_memory()',
1379
+ 'ascend_config': '''api mindspore.device_context.ascend.op_precision.precision_mode(),
1380
+ mindspore.device_context.ascend.op_precision.op_precision_mode(),
1381
+ mindspore.device_context.ascend.op_precision.matmul_allow_hf32(),
1382
+ mindspore.device_context.ascend.op_precision.conv_allow_hf32(),
1383
+ mindspore.device_context.ascend.op_tuning.op_compile()''',
1384
+ 'aoe_tune_mode': 'api mindspore.device_context.ascend.op_tuning.aoe_tune_mode()',
1385
+ 'aoe_config': 'api mindspore.device_context.ascend.op_tuning.aoe_job_type()',
1386
+ 'op_timeout': 'api mindspore.device_context.ascend.op_debug.execute_timeout()',
1387
+ 'op_debug_option': 'api mindspore.device_context.ascend.op_debug.debug_option()',
1388
+ 'gpu_config': '''api mindspore.device_context.gpu.op_precision.conv_allow_tf32(),
1389
+ mindspore.device_context.gpu.op_precision.matmul_allow_tf32(),
1390
+ mindspore.device_context.gpu.op_precision.conv_fprop_algo(),
1391
+ mindspore.device_context.gpu.op_precision.conv_wgrad_algo(),
1392
+ mindspore.device_context.gpu.op_precision.conv_dgrad_algo()''',
1393
+ 'runtime_num_threads': 'api mindspore.device_context.cpu.op_tuning.threads_num()',
1394
+ 'memory_offload': "`device` parameter of `mindspore.Parameter`"}
1395
+ invalid_context_dict = {
1396
+ 'exception_dump': {'version': '2.6', 'interface': 'device_context.ascend.op_debug.aclinit_config()'}
1397
+ }
1398
+ if key in deprecated_context_dict:
1399
+ log = f"For 'context.set_context', the parameter '{key}' will be deprecated and removed in a future version."
1400
+ if deprecated_context_dict.get(key) != '':
1401
+ log += f" Please use the {deprecated_context_dict.get(key)} instead."
1402
+ logger.warning(log)
1403
+ if key in invalid_context_dict:
1404
+ info = invalid_context_dict.get(key)
1405
+ deprecated_version, new_interface = info.get('version'), info.get('interface')
1406
+ log = (
1407
+ f"For 'context.set_context', the parameter '{key}' has been removed"
1408
+ f" since MindSpore {deprecated_version} version."
1409
+ )
1410
+ if new_interface:
1411
+ log += f" Please use the {new_interface} instead."
1412
+ raise ValueError(log)
1413
+
1283
1414
  @args_type_check(mode=int, precompile_only=bool, device_target=str, device_id=int, save_graphs=(bool, int),
1284
- save_graphs_path=str, enable_dump=bool, aoe_tune_mode=str, aoe_config=dict,
1285
- save_dump_path=str, enable_reduce_precision=bool, variable_memory_max_size=str,
1415
+ save_graphs_path=str, aoe_tune_mode=str, aoe_config=dict,
1416
+ enable_reduce_precision=bool, variable_memory_max_size=str,
1286
1417
  enable_auto_mixed_precision=bool, inter_op_parallel_num=int,
1287
1418
  enable_graph_kernel=bool, reserve_class_name_in_scope=bool, check_bprop=bool,
1288
1419
  max_device_memory=str, print_file_path=str, max_call_depth=int, env_config_path=str,
@@ -1291,542 +1422,142 @@ def _check_key(key):
1291
1422
  op_timeout=int, deterministic=str, ascend_config=dict, jit_syntax_level=int, debug_level=int,
1292
1423
  jit_enable_inplace_ops=bool, gpu_config=dict, jit_config=dict, enable_compile_cache=bool)
1293
1424
  def set_context(**kwargs):
1294
- """
1295
- Set context for running environment.
1296
-
1297
- Context should be configured before running your program. If there is no configuration,
1298
- it will be automatically set according to the device target by default.
1299
-
1300
- Note:
1301
- Attribute name is required for setting attributes.
1302
- The mode is not recommended to be changed after net was initialized because the implementations of some
1303
- operations are different in graph mode and pynative mode. Default: ``PYNATIVE_MODE`` .
1304
-
1305
- Some configurations are device specific, see the below table for details:
1306
-
1307
- +-------------------------+------------------------------+----------------------------+
1308
- | Function Classification | Configuration Parameters | Hardware Platform Support|
1309
- +=========================+==============================+============================+
1310
- | System Configuration | device_id | CPU/GPU/Ascend |
1311
- | +------------------------------+----------------------------+
1312
- | | device_target | CPU/GPU/Ascend |
1313
- | +------------------------------+----------------------------+
1314
- | | max_device_memory | GPU/Ascend |
1315
- | +------------------------------+----------------------------+
1316
- | | variable_memory_max_size | Ascend |
1317
- | +------------------------------+----------------------------+
1318
- | | mempool_block_size | GPU/Ascend |
1319
- | +------------------------------+----------------------------+
1320
- | | op_timeout | Ascend |
1321
- +-------------------------+------------------------------+----------------------------+
1322
- | Debug Configuration | save_graphs | CPU/GPU/Ascend |
1323
- | +------------------------------+----------------------------+
1324
- | | save_graphs_path | CPU/GPU/Ascend |
1325
- | +------------------------------+----------------------------+
1326
- | | enable_dump | Ascend |
1327
- | +------------------------------+----------------------------+
1328
- | | save_dump_path | Ascend |
1329
- | +------------------------------+----------------------------+
1330
- | | deterministic | Ascend |
1331
- | +------------------------------+----------------------------+
1332
- | | print_file_path | Ascend |
1333
- | +------------------------------+----------------------------+
1334
- | | env_config_path | CPU/GPU/Ascend |
1335
- | +------------------------------+----------------------------+
1336
- | | precompile_only | CPU/GPU/Ascend |
1337
- | +------------------------------+----------------------------+
1338
- | | reserve_class_name_in_scope | CPU/GPU/Ascend |
1339
- | +------------------------------+----------------------------+
1340
- | | pynative_synchronize | CPU/GPU/Ascend |
1341
- | +------------------------------+----------------------------+
1342
- | | debug_level | CPU/GPU/Ascend |
1343
- +-------------------------+------------------------------+----------------------------+
1344
- | Executive Control | mode | CPU/GPU/Ascend |
1345
- | +------------------------------+----------------------------+
1346
- | | enable_graph_kernel | Ascend/GPU |
1347
- | +------------------------------+----------------------------+
1348
- | | graph_kernel_flags | Ascend/GPU |
1349
- | +------------------------------+----------------------------+
1350
- | | enable_reduce_precision | Ascend |
1351
- | +------------------------------+----------------------------+
1352
- | | aoe_tune_mode | Ascend |
1353
- | +------------------------------+----------------------------+
1354
- | | aoe_config | Ascend |
1355
- | +------------------------------+----------------------------+
1356
- | | check_bprop | CPU/GPU/Ascend |
1357
- | +------------------------------+----------------------------+
1358
- | | max_call_depth | CPU/GPU/Ascend |
1359
- | +------------------------------+----------------------------+
1360
- | | grad_for_scalar | CPU/GPU/Ascend |
1361
- | +------------------------------+----------------------------+
1362
- | | enable_compile_cache | CPU/GPU/Ascend |
1363
- | +------------------------------+----------------------------+
1364
- | | inter_op_parallel_num | CPU/GPU/Ascend |
1365
- | +------------------------------+----------------------------+
1366
- | | runtime_num_threads | CPU/GPU/Ascend |
1367
- | +------------------------------+----------------------------+
1368
- | | compile_cache_path | CPU/GPU/Ascend |
1369
- | +------------------------------+----------------------------+
1370
- | | disable_format_transform | GPU |
1371
- | +------------------------------+----------------------------+
1372
- | | support_binary | CPU/GPU/Ascend |
1373
- | +------------------------------+----------------------------+
1374
- | | memory_optimize_level | CPU/GPU/Ascend |
1375
- | +------------------------------+----------------------------+
1376
- | | memory_offload | GPU/Ascend |
1377
- | +------------------------------+----------------------------+
1378
- | | ascend_config | Ascend |
1379
- | +------------------------------+----------------------------+
1380
- | | jit_syntax_level | CPU/GPU/Ascend |
1381
- | +------------------------------+----------------------------+
1382
- | | gpu_config | GPU |
1383
- | +------------------------------+----------------------------+
1384
- | | jit_config | CPU/GPU/Ascend |
1385
- | +------------------------------+----------------------------+
1386
- | | exec_order | Ascend |
1387
- +-------------------------+------------------------------+----------------------------+
1425
+ r"""
1426
+ Set context for running environment, this interface will be deprecated in future versions, and its
1427
+ parameter-related functionalities will be provided through new APIs.
1388
1428
 
1389
1429
  Args:
1390
- device_id (int): ID of the target device, the value must be in [0, device_num_per_host-1],
1391
- while device_num_per_host should be no more than 4096. Default: ``0`` .
1392
- device_target (str): The target device to run, support "Ascend", "GPU", and "CPU".
1393
- If device target is not set, the version of MindSpore package is used.
1394
- max_device_memory (str): Set the maximum memory available for devices. The format is "xxGB".
1395
- Default: ``" 1024GB"`` . The actual used memory size is the minimum of the available memory of the device
1396
- and max_device_memory. 'max_device_memory' should be set before the program runs. When virtual memory is
1397
- enabled, a too small 'max_device_memory' will cause frequent defragmentation, affecting performance.
1398
- variable_memory_max_size (str): This parameter is deprecated, and will be removed in a future version.
1399
- Please use parameter 'max_device_memory' instead.
1400
- mempool_block_size (str): It takes effect when virtual memory is turned off, set the size of the memory pool
1401
- block for devices. The format is "xxGB". Default: ``"1GB"`` . Minimum size is "1G". The actual used memory
1402
- block size is the minimum of the available memory of the device and mempool_block_size. When there is
1403
- enough memory, the memory will be expanded by this value.
1404
- op_timeout (int): Set the maximum duration of executing an operator in seconds.
1405
- If the execution time exceeds this value, system will terminate the task.
1406
- 0 means endless wait. The defaults for AI Core and AICPU operators vary on different hardware.
1407
- For more information,
1408
- please refer to `Ascend Community document about aclrtSetOpExecuteTimeOut
1409
- <https://www.hiascend.com/document/detail/en/CANNCommunityEdition/600alphaX/infacldevg/aclcppdevg/aclcppdevg_03_0069.html>`_.
1410
- Default: ``900`` .
1411
- save_graphs (bool or int): Whether to save intermediate compilation graphs. Default: ``0`` .
1412
- Available values are:
1413
-
1414
- - False or 0: disable saving of intermediate compilation graphs.
1415
- - 1: some intermediate files will be generated during graph compilation.
1416
- - True or 2: Generate more ir files related to backend process.
1417
- - 3: Generate visualization computing graphs and detailed frontend ir graphs.
1418
-
1419
- When the network structure is complex, setting `save_graphs` attribute to ``2`` or ``3`` may take too long.
1420
- If you need quick problem locating, you can switch to ``1`` first.
1421
-
1422
- When the `save_graphs` attribute is set as ``True`` , ``1`` , ``2`` or ``3`` , attribute of
1423
- `save_graphs_path` is used to set the intermediate compilation graph storage path. By default, the graphs
1424
- are saved in the current directory.
1425
- save_graphs_path (str): Path to save graphs. Default: ``"."``.
1426
- If the specified directory does not exist, the system will automatically create the directory.
1427
- During distributed training, graphs will be saved to the directory of
1428
- `save_graphs_path/rank_${rank_id}/`. `rank_id` is the ID of the current device in the cluster.
1429
- deterministic (str): Whether to enable op run in deterministic mode. The value must be in the
1430
- range of ['ON', 'OFF'], and the default value is ``'OFF'`` .
1431
-
1432
- - "ON": Enable operator deterministic running mode.
1433
- - "OFF": Disable operator deterministic running mode.
1434
-
1435
- When deterministic mode is on, model ops will be deterministic in Ascend. This means that if op run
1436
- multiple times with the same inputs on the same hardware, it will have the exact same outputs each time.
1437
- This is useful for debugging models.
1438
- enable_dump (bool): This parameters is deprecated, and will be deleted in the next version.
1439
- save_dump_path (str): This parameters is deprecated, and will be deleted in the next version.
1440
- print_file_path (str): The path of saving print data. If this parameter is set, print data is saved to
1441
- a file by default, and print_file_path is not set, the screen will be displayed.
1442
- If the saved file already exists, the timestamp suffix will be added to the file. Saving data to a file
1443
- solves the problem of data loss in screen printing when a large amount of data is generated.
1444
- If it is not set, an error will be reported: prompt to set the upper absolute path.
1445
- When print data to file, the total output bytes of single print must be less then 2GB(limited by
1446
- protobuf).
1447
- env_config_path (str): Config path for DFX.
1448
- Through mindspore.set_context(env_config_path="./mindspore_config.json")
1449
-
1450
- configure RDR:
1451
-
1452
- - enable: controls whether the RDR is enabled to collect the key data during training and
1453
- save key data in the fault scenario. When set to ``true`` , the RDR will be turned on.
1454
- When set to ``false`` , the RDR will be turned off.
1455
- - mode: sets the mode of RDR on exporting data. When set to ``1`` , the RDR only exports data
1456
- in the fault scenario. When set to ``2`` , the RDR exports data in the fault scenario and the
1457
- normal end scenario. Default: ``1`` .
1458
- - path: sets the path where RDR saves data. The current path must be absolute.
1459
-
1460
- Memory reuse:
1461
-
1462
- - mem_Reuse: controls whether the memory reuse function is turned on. When set to ``True`` ,
1463
- the memory reuse function is turned on. When set to ``False`` , the memory reuse function is turned off.
1464
-
1465
- precompile_only (bool): Whether to only precompile the network. Default: ``False`` .
1466
- If set to ``True`` , the network will only be compiled, not executed.
1467
- reserve_class_name_in_scope (bool) : Whether to save the network class name in the scope. Default: ``True`` .
1468
- Each node has a scope. A scope of a subnode is the name of its parent node. If reserve_class_name_in_scope
1469
- is set to ``True`` , the class name will be saved after keyword 'net-' in the scope.
1470
- For example:
1471
-
1472
- Default/net-Net1/net-Net2 (reserve_class_name_in_scope=True)
1473
-
1474
- Default/net/net (reserve_class_name_in_scope=False)
1475
-
1430
+ mode (int): GRAPH_MODE(0) or PYNATIVE_MODE(1). Default ``PYNATIVE_MODE`` .
1431
+ device_id (int): ID of the target device. Default ``0`` . This parameter will be deprecated
1432
+ and removed in future versions. Please use the api :func:`mindspore.set_device` instead.
1433
+ device_target (str): The target device to run, support ``"Ascend"``, ``"GPU"``, and ``"CPU"``. This parameter
1434
+ will be deprecated and removed in future versions. Please use the api :func:`mindspore.set_device` instead.
1435
+ deterministic (str): Deterministic computation of operators. Default ``"OFF"`` .
1436
+ This parameter will be deprecated and removed in future versions. Please use the api
1437
+ :func:`mindspore.set_deterministic` instead.
1438
+ max_call_depth (int): The maximum depth of function call. Default ``1000`` .
1439
+ This parameter will be deprecated and removed in a future version. Please use the api
1440
+ :func:`mindspore.set_recursion_limit` instead.
1441
+ variable_memory_max_size (str): This parameter will be deprecated and removed in future versions.
1442
+ Please use the api :func:`mindspore.runtime.set_memory` instead.
1443
+ mempool_block_size (str): Set the size of the memory pool block for devices. Default ``"1GB"`` .
1444
+ This parameter will be deprecated and removed in future versions. Please use
1445
+ the api :func:`mindspore.runtime.set_memory` instead.
1446
+ memory_optimize_level (str): The memory optimize level. Default ``"O0"``.
1447
+ This parameter will be deprecated and removed in future versions. Please use
1448
+ the api :func:`mindspore.runtime.set_memory` instead.
1449
+ max_device_memory (str): Set the maximum memory available for devices.
1450
+ Default ``"1024GB"`` . This parameter will be deprecated and removed in future versions. Please use
1451
+ the api :func:`mindspore.runtime.set_memory` instead.
1476
1452
  pynative_synchronize (bool): Whether to enable synchronous execution of the device in PyNative mode.
1477
- Default: ``False`` . When the value is set to ``False`` , the operator is executed asynchronously on the
1478
- device. When an error occurs in the execution of the operator, the specific error script code location
1479
- cannot be located, when the value is set to ``True`` , the operator is executed synchronously on the
1480
- device. It will reduce the execution performance of the program. At this time, when an error occurs in the
1481
- execution of the operator, the location of the error script code can be located according to the call stack
1482
- of the error.
1483
- mode (int): Running in GRAPH_MODE(0) or PYNATIVE_MODE(1).
1484
- Both modes support all backends. Default: ``PYNATIVE_MODE`` .
1485
- enable_graph_kernel (bool): Whether to enable graph kernel fusion to optimize network execution performance.
1486
- Default: ``False`` .
1487
- Indicates whether to enable image-computing convergence to optimize network execution performance.
1488
- If enable_graph_kernel is set to ``True`` , acceleration can be enabled.
1489
- For details of graph kernel fusion, please check
1490
- `Enabling Graph Kernel Fusion
1491
- <https://www.mindspore.cn/docs/en/master/model_train/optimize/graph_fusion_engine.html>`_.
1492
- graph_kernel_flags (str):
1493
- Optimization options of graph kernel fusion, and the priority is higher when it conflicts
1494
- with enable_graph_kernel. Only for experienced users.
1495
- For example,
1496
-
1497
- .. code-block::
1498
-
1499
- mindspore.set_context(graph_kernel_flags="--opt_level=2 --dump_as_text")
1500
-
1501
- Some general options:
1502
-
1503
- - opt_level: Set the optimization level.
1504
- Default: ``2`` . Graph kernel fusion can be enabled equivalently by setting opt_level greater than 0.
1505
- Available values are:
1506
-
1507
- - 0: disables graph kernel fusion;
1508
- - 1: enables the basic fusion of operators;
1509
- - 2: includes all optimizations of level 1,
1510
- and turns on more optimizations such as CSE, arithmetic simplification and so on;
1511
- - 3: includes all optimizations of level 2, and turns on more optimizations such as SitchingFusion,
1512
- ParallelFusion and so on. Optimizations of this level are radical and unstable in some scenarios.
1513
- Be caution when using this level.
1514
-
1515
- - dump_as_text: dumps detail info as text files. Default: ``False`` .
1516
- - enable_cluster_ops: Add user-specified operator to the set of operators involved in fusion. For example,
1517
- by setting ``--enable_cluster_ops=MatMul``, MatMul operator can be included in the fusion process.
1518
- - enable_pass/disable_pass: Enable/disable user-specified custom fusion passes. See details in
1519
- `Custom Fusion Pass
1520
- <https://www.mindspore.cn/docs/en/master/model_train/custom_program/fusion_pass.html>`_.
1521
-
1522
- enable_reduce_precision (bool): Whether to enable precision reduction.
1523
- If the operator does not support the user-specified precision, the precision will
1524
- be changed automatically. Default: ``True`` .
1525
- aoe_tune_mode (str): AOE tuning mode setting, which is not set by default.
1526
- When set to ``"online"`` , the tuning in online function is turned on.
1527
- When set to ``"offline"`` , ge graph will be save for offline tuning.
1528
- aoe_config (dict): Set the parameters specific to Ascend Optimization Engine. It is not set by default.
1529
-
1530
- - job_type (str): Mode type setting, default value is ``"2"``.
1531
-
1532
- - ``"1"``: subgraph tuning;
1533
- - ``"2"``: operator tuning.
1534
-
1535
- check_bprop (bool): Whether to check back propagation nodes. The checking ensures that the shape and dtype
1536
- of back propagation node outputs is the same as input parameters. Default: ``False`` .
1537
- max_call_depth (int): Specify the maximum depth of function call. Must be positive integer. Default: ``1000`` .
1538
- The max_call_depth parameter needs to be set when the nested call is too deep or the number
1539
- of subgraphs is too large. If max_call_depth is set larger than before, the system max stack depth should be
1540
- set larger too, otherwise a `core dumped` exception may be raised because of system stack overflow.
1541
- grad_for_scalar (bool): Whether to get gradient for scalar. Default: ``False`` .
1542
- When grad_for_scalar is set to ``True`` , the function's scalar input can be derived.
1543
- The default value is ``False`` . Because the back-end does not support scaling operations currently,
1544
- this interface only supports simple operations that can be deduced by the front-end.
1545
- enable_compile_cache (bool): Whether to save or load the cache of the graph compiled by front-end.
1546
- After enable_compile_cache is set to ``True`` , during the first execution, a hardware-independent
1547
- compilation cache is generated and exported to a MINDIR file. When the network is executed again,
1548
- if enable_compile_cache is still set to ``True`` and the network scripts are not changed,
1549
- the compile cache is loaded. Note that only limited automatic detection for the changes of
1550
- python scripts is supported by now, which means that there is a correctness risk. Default: ``False`` .
1551
- Currently, do not support the graph which is larger than 2G after compiled.
1552
- This is an experimental prototype that is subject to change and/or deletion.
1553
- compile_cache_path (str): Path to save the compile cache. Default: ``"."``.
1554
- If the specified directory does not exist, the system will automatically create the directory.
1555
- The cache will be saved to the directory of `compile_cache_path/rank_${rank_id}/`. The `rank_id` is
1556
- the ID of the current device in the cluster.
1557
- inter_op_parallel_num(int): The thread number of op parallel at the same time. Default value is ``0`` ,
1558
- which means use the default num.
1559
- runtime_num_threads(int): The thread pool number of cpu kernel used in runtime,
1560
- which must bigger than or equal to 0. Default value is ``30`` , if you run many processes at
1561
- the same time, you should set the value smaller to avoid thread contention. If set runtime_num_threads to 1,
1562
- the runtime asynchronous pipeline capability cannot be enabled, which may affect performance.
1563
- disable_format_transform (bool): Whether to disable the automatic format transform function from NCHW to NHWC.
1564
- When the network training performance of fp16 is worse than fp32, `disable_format_transform` can be set to
1565
- ``True`` to try to improve training performance. Default: ``False`` .
1566
- support_binary (bool): Whether to support run .pyc or .so in graph mode. If want to support run .so or .pyc
1567
- in graph mode, coulde set 'support_binary' to be ``True`` , and run once .py file. It would save the source
1568
- of the interfaces would be compiled by MindSpore to the interfaces definition .py file that should be
1569
- guaranteed to be writable. Then compile the .py file to the .pyc or .so file, and could run in Graph mode.
1570
- memory_optimize_level (str): The memory optimize level.
1571
- On Ascend hardware platform, default: ``O1``, on other hardware platforms, default: ``O0``.
1572
- The value must be in ['O0', 'O1'].
1573
-
1574
- - O0: priority performance option, disable SOMAS (Safe Optimized Memory Allocation Solver)
1575
- and some other memory optimizations.
1576
- - O1: priority memory option, enable SOMAS and some other memory optimizations.
1577
- memory_offload (str): Whether to enable the memory offload function. When it is enabled, the idle data will be
1578
- temporarily copied to the host side in the case of insufficient device memory. The value must be in the
1579
- range of ['ON', 'OFF'], and the default value is ``'OFF'`` .
1580
-
1581
- - ON: Enable the memory Offload function. On Ascend hardware platform, this parameter does not take effect
1582
- when the graph compilation level is not 'O0'; This parameter does not take effect when
1583
- memory_optimize_level is set 'O1'.
1584
- - OFF: Turn off the memory Offload function.
1585
- ascend_config (dict): Set the parameters specific to Ascend hardware platform. It is not set by default.
1586
- The default value of `precision_mode`, `jit_compile` and
1587
- `atomic_clean_policy` are experimental parameters, may change in the future.
1588
-
1589
- - precision_mode (str): Mixed precision mode setting, and the default value of inference network
1590
- is ``force_fp16`` . The value range is as follows:
1591
-
1592
- - force_fp16: When the operator supports both float16 and float32, select float16 directly.
1593
- - allow_fp32_to_fp16: For cube operators, use the float16. For vector operators,
1594
- prefer to keep the origin dtype, if the operator in model can support float32,
1595
- it will keep original dtype, otherwise it will reduce to float16.
1596
- - allow_mix_precision: Automatic mixing precision, facing the whole network operator, according
1597
- to the built-in optimization strategy, automatically reduces the precision of some operators
1598
- to float16 or bfloat16.
1599
- - must_keep_origin_dtype: Keep the accuracy of the original drawing.
1600
- - force_fp32: When the input of the matrix calculation operator is float16 and the output supports
1601
- float16 and float32, output is forced to float32.
1602
- - allow_fp32_to_bf16: For cube operators, use the bfloat16. For vector operators,
1603
- prefer to keep the origin dtype, if the operator in model can support float32,
1604
- it will keep original dtype, otherwise it will reduce to bfloat16.
1605
- - allow_mix_precision_fp16: Automatic mixing precision, facing the whole network operator, automatically
1606
- reduces the precision of some operators to float16 according to the built-in optimization strategy.
1607
- - allow_mix_precision_bf16: Automatic mixing precision, facing the whole network operator, according to
1608
- the built-in optimization strategy, automatically reduces the precision of some operators to bfloat16.
1609
-
1610
- - jit_compile (bool): Whether to select online compilation. When set to 'True', online compilation is
1611
- prioritized. When set to 'False', compiled operator binary files are prioritized to improve compilation
1612
- performance. The default settings are online compilation for static shape, and compiled operator binary
1613
- files for dynamic shape.
1453
+ Default ``False`` . This parameter will be deprecated and removed in future versions.Please use
1454
+ the api :func:`mindspore.runtime.launch_blocking` instead.
1455
+ compile_cache_path (str): Path to save the compile cache. Default ``"."``.
1456
+ This parameter will be deprecated and removed in a future version. Please use the environment variable
1457
+ `MS_COMPILER_CACHE_PATH` instead.
1458
+ inter_op_parallel_num(int): The thread number of op parallel at the same time.
1459
+ Default ``0`` . This parameter will be deprecated and removed in future versions.
1460
+ Please use the api :func:`mindspore.runtime.dispatch_threads_num` instead.
1461
+ memory_offload (str): Whether to enable the memory offload function. Default ``"OFF"`` .
1462
+ This parameter will be deprecated and removed in future versions. Please use the api
1463
+ :func:`mindspore.nn.Cell.offload` instead.
1464
+ disable_format_transform (bool): Whether to disable the automatic format transform function from NCHW
1465
+ to NHWC. Default ``False`` . This parameter will be deprecated and removed in future versions. Please
1466
+ use the related parameter of :func:`mindspore.jit` instead.
1467
+ jit_syntax_level (int): Set JIT syntax support level. Default ``LAX`` . This parameter is deprecated
1468
+ and removed in future versions. Please use the related parameter of :func:`mindspore.jit` instead.
1469
+ jit_config (dict): Set the global jit config for compile. This parameter is deprecated
1470
+ and removed in future versions. Please use the related parameter of :func:`mindspore.jit` instead.
1471
+ exec_order (str): The sorting method for operator execution. This parameter is deprecated
1472
+ and removed in future versions. Please use the related parameter of :func:`mindspore.jit` instead.
1473
+ op_timeout (int): Set the maximum duration of executing an operator in seconds. Default ``900`` .
1474
+ This parameter will be deprecated and removed in future versions. Please use the
1475
+ api :func:`mindspore.device_context.ascend.op_debug.execute_timeout` instead.
1476
+ aoe_tune_mode (str): AOE tuning mode.
1477
+ This parameter will be deprecated and removed in future versions. Please use the
1478
+ api :func:`mindspore.device_context.ascend.op_tuning.aoe_tune_mode` instead.
1479
+ aoe_config (dict): AOE-specific parameters. This parameter will be deprecated and removed in future
1480
+ versions. Please use the api :func:`mindspore.device_context.ascend.op_tuning.aoe_job_type` instead.
1481
+ runtime_num_threads(int): The thread pool number of cpu kernel used in runtime. Default ``30`` .
1482
+ This parameter will be deprecated and removed in future versions. Please use the
1483
+ api :func:`mindspore.device_context.cpu.op_tuning.threads_num` instead.
1484
+ save_graphs (bool or int): Whether to save intermediate compilation graphs. Default ``0`` .
1485
+ This parameter will be deprecated and removed in a future version. Please use the environment variable
1486
+ `MS_DEV_SAVE_GRAPHS` instead.
1487
+ save_graphs_path (str): Path to save graphs. Default ``"."``.
1488
+ This parameter will be deprecated and removed in a future version. Please use the environment variable
1489
+ `MS_DEV_SAVE_GRAPHS_PATH` instead.
1490
+ precompile_only (bool): Whether to only precompile the network. Default ``False`` .
1491
+ This parameter will be deprecated and removed in a future version. Please use the environment variable
1492
+ `MS_DEV_PRECOMPILE_ONLY` instead.
1493
+ enable_compile_cache (bool): Whether to save or load the compiled cache of the graph.
1494
+ Default ``False`` . This is an experimental prototype that is subject to change and/or deletion.
1495
+ This parameter will be deprecated and removed in a future version. Please use the environment variable
1496
+ `MS_COMPILER_CACHE_ENABLE` instead.
1497
+ ascend_config (dict): Set the parameters specific to Ascend hardware platform.
1498
+
1499
+ - precision_mode (str): Mixed precision mode setting. Default ``"force_fp16"`` .
1500
+ This parameter will be deprecated and removed in future versions. Please use the
1501
+ api :func:`mindspore.device_context.ascend.op_precision.precision_mode` instead.
1502
+ - jit_compile (bool): Whether to select online compilation. This parameter will be deprecated and removed
1503
+ in future versions. Please use the api :func:`mindspore.device_context.ascend.op_tuning.op_compile`
1504
+ instead.
1505
+ - matmul_allow_hf32 (bool): Whether to convert FP32 to HF32 for Matmul operators. Default ``False``.
1506
+ This parameter will be deprecated and removed in future versions. Please use the
1507
+ api :func:`mindspore.device_context.ascend.op_precision.matmul_allow_hf32` instead.
1508
+ - conv_allow_hf32 (bool): Whether to convert FP32 to HF32 for Conv operators. Default ``True``.
1509
+ This parameter will be deprecated and removed in future versions. Please use the
1510
+ api :func:`mindspore.device_context.ascend.op_precision.conv_allow_hf32` instead.
1511
+ - op_precision_mode (str): Path to config file of op precision mode.
1512
+ This parameter will be deprecated and removed in future versions. Please use the
1513
+ api :func:`mindspore.device_context.ascend.op_precision.op_precision_mode` instead.
1514
+ - op_debug_option (str): Enable debugging options for Ascend operators.
1515
+ This parameter will be deprecated and removed in future versions. Please use the
1516
+ api :func:`mindspore.device_context.ascend.op_debug.debug_option` instead.
1517
+ - ge_options (dict): Set options for CANN. This parameter will be deprecated and removed in future versions.
1518
+ Please use the related parameter of :func:`mindspore.jit` instead.
1614
1519
  - atomic_clean_policy (int): The policy for cleaning memory occupied by atomic operators in the network.
1615
- Default: ``1`` .
1616
-
1617
- - 0: The memory occupied by all atomic operators in the network is cleaned centrally.
1618
- - 1: Memory is not cleaned centrally and each atomic operator in the network is cleaned separately.
1619
- When the memory of the network exceeds the limit, you may try this cleaning policy, but it may cause
1620
- performance loss.
1621
- - matmul_allow_hf32 (bool): Whether to convert FP32 to HF32 for Matmul operators. Default value: ``False``.
1622
- This is an experimental prototype that is subject to change and/or deletion.
1623
- For detailed information, please refer to `Ascend community <https://www.hiascend.com/>`_ .
1624
- - conv_allow_hf32 (bool): Whether to convert FP32 to HF32 for Conv operators. Default value: ``True``.
1625
- This is an experimental prototype that is subject to change and/or deletion.
1626
- For detailed information, please refer to `Ascend community <https://www.hiascend.com/>`_ .
1627
- - exception_dump (str): Enable exception dump for Ascend operators, providing the input and output data for
1628
- failing Ascend operators. The value can be ``"0"`` , ``"1"`` and ``"2"``. For ``"0"`` , exception dump is
1629
- turned off; for ``"1"``, all inputs and outputs will be dumped for AICore exception operators;
1630
- for ``"2"``, inputs will be dumped for AICore exception operators, reducing the saved information
1631
- but improving performance. Default: ``"2"`` .
1632
- - op_precision_mode (str): Path to config file of op precision mode. For detailed information, please refer
1633
- to `Ascend community <https://www.hiascend.com/>`_ .
1634
- - op_debug_option (str): Enable debugging options for Ascend operators, default not enabled.
1635
- The value currently only supports being set to ``"oom"``.
1636
-
1637
- - ``"oom"``: When there is a memory out of bounds during the execution of an operator,
1638
- AscendCL will return an error code of ``EZ9999``.
1639
-
1640
- - ge_options (dict): Set options for CANN. The options are divided into two categories: global and session.
1641
- This is an experimental prototype that is subject to change and/or deletion.
1642
- For detailed information, please refer to `Ascend community <https://www.hiascend.com/document/detail/zh/canncommercial/70RC1/inferapplicationdev/graphdevg/atlasgeapi_07_0119.html>`_ .
1643
- The configuration options in `ge_options` may be duplicated with the options in `ascend_config`. If the
1644
- same configuration options are set in both `ascend_config` and `ge_options`, the one set in `ge_options`
1645
- shall prevail.
1646
-
1647
- - global (dict): Set global options.
1648
- - session (dict): Set session options.
1649
-
1650
- - parallel_speed_up_json_path(Union[str, None]): The path to the parallel speed up json file, configuration
1651
- can refer to `parallel_speed_up.json
1652
- <https://gitee.com/mindspore/mindspore/blob/master/config/parallel_speed_up.json>`_ .
1653
- If its value is None or '', it does not take effect. Default None.
1654
-
1655
- - recompute_comm_overlap (bool): Enable overlap between recompute ops and communication ops if True.
1656
- Default: False.
1657
- - matmul_grad_comm_overlap (bool): Enable overlap between dw matmul and
1658
- tensor parallel communication ops if True. Default: False.
1659
- - recompute_allgather_overlap_fagrad (bool): Enable overlap between duplicated allgather by recomputing
1660
- in sequence parallel and flashattentionscoregrad ops if True. Default: False.
1661
- - enable_task_opt (bool): Enable communication fusion to optimize the number of communication operator
1662
- tasks if True.
1663
- Default: False.
1664
- - enable_grad_comm_opt (bool): Enable overlap between dx ops and data parallel communication ops if True.
1665
- Currently, do not support
1666
- `LazyInline <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.lazy_inline.html>`
1667
- Default: False.
1668
- - enable_opt_shard_comm_opt (bool): Enable overlap between forward ops
1669
- and optimizer parallel allgather communication if True. Currently, do not support
1670
- `LazyInline <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.lazy_inline.html>`
1671
- Default: False.
1672
- - compute_communicate_fusion_level (int): Enable the fusion between compute and communicate.
1673
- Default: ``0``. Note: This function must be used with Ascend Training Solution 24.0.RC2 or later.
1674
-
1675
- - 0: Disable fusion.
1676
-
1677
- - 1: Apply fusion to forward nodes.
1678
-
1679
- - 2: Apply fusion to backward nodes.
1680
-
1681
- - 3: Apply fusion to all nodes.
1682
- - dataset_broadcast_opt_level (int): Optimize the scenario that the dataset repeated reading. Only
1683
- support O0/O1 jit level. It doesn't work in O2 mode. Default: ``0``.
1684
-
1685
- - 0: Disable this optimize.
1686
-
1687
- - 1: Optimize dataset reader between pipeline stage.
1688
-
1689
- - 2: Optimize dataset reader within pipeline stage.
1690
-
1691
- - 3: Optimize dataset reader with all scenes.
1692
- - bias_add_comm_swap (bool): Enable node execution order swap communication operators and add operators
1693
- if ``True``. Only 1-dimension bias node is supported. Default: ``False``.
1694
- - enable_allreduce_slice_to_reducescatter (bool): Enable allreduce optimization. In the scenario where
1695
- the batchmatmul model introduces allreduce in parallel, if the subsequent nodes are stridedslice
1696
- operator with model parallel, allreduce will be optimized as reducescatter according to the identified
1697
- patterns. Typical used in MoE module with groupwise alltoall. Default: ``False``.
1698
- - enable_interleave_split_concat_branch (bool): Enable communication computation parallel optimization
1699
- for branches formed by split and concat operators with ``enable_interleave`` attribute. It is typical
1700
- used in MoE parallel scenario. After splitting the input data, each slice of data is processed by the
1701
- MoE module, and then the branch results are concatenated. When the optimization is enable,
1702
- communication and computation will be executed in parallel between branches. Default: ``False``.
1520
+ Default ``1`` represents that memory is not cleaned centrally, ``0`` represents that memory is cleaned
1521
+ centrally. This parameter will be deprecated and removed in future versions. Please
1522
+ use the related parameter of :func:`mindspore.jit` instead.
1523
+ - exception_dump (str): Enable Ascend operator exception dump. Default ``"2"`` . This parameter has been
1524
+ deprecated and removed. Please use the api
1525
+ :func:`mindspore.device_context.ascend.op_debug.aclinit_config` instead.
1703
1526
  - host_scheduling_max_threshold(int): The max threshold to control whether the dynamic shape process is
1704
- used when run the static graph, the default value is 0. When the number of operations in the static graph
1705
- is less than the max threshold, this graph will be executed in dynamic shape process. In large model
1706
- scenarios, this approach can save stream resources. If the number of operations in the static graph is
1707
- greater than the maximum threshold, this graph will be executed in original static process.
1708
-
1709
- jit_syntax_level (int): Set JIT syntax level for graph compiling, triggered by GRAPH_MODE and @jit decorator.
1710
- The value must be ``STRICT`` or ``LAX`` . Default: ``LAX`` . All levels support all backends.
1711
-
1712
- - ``STRICT`` : Only basic syntax is supported, and execution performance is optimal. Can be used for MindIR
1713
- load and export.
1714
- - ``LAX`` : Compatible with all Python syntax as much as possible. However, execution performance may be
1715
- affected and not optimal. Cannot be used for MindIR load and export due to some syntax that may not be
1716
- able to be exported.
1717
-
1718
- debug_level (int): Set config for debugging. Default value: ``RELEASE``.
1719
-
1720
- - ``RELEASE``: Used for normally running, and some debug information will be discard to get a better
1721
- compiling performance.
1722
- - ``DEBUG``: Used for debugging when errors occur, more information will be record in compiling process.
1723
-
1527
+ used when run the static graph. Default ``0`` . This parameter will be deprecated and removed in future
1528
+ versions. Please use the related parameter of :func:`mindspore.jit` instead.
1529
+ - parallel_speed_up_json_path(Union[str, None]): The path to the parallel speed up json file.
1530
+ This parameter will be deprecated and removed in future versions. Please use the
1531
+ api :func:`mindspore.parallel.auto_parallel.AutoParallel.transformer_opt` instead.
1532
+ - hccl_watchdog (bool): Enable a thread to monitor the failure of collective communication.
1533
+ Default ``True`` .
1724
1534
  gpu_config (dict): Set the parameters specific to gpu hardware platform. It is not set by default.
1725
- Currently, only setting `conv_fprop_algo` and `conv_dgrad_algo` and `conv_wgrad_algo` and `conv_allow_tf32`
1726
- and `matmul_allow_tf32` are supported on GPU hardware platform.
1727
-
1728
- - conv_fprop_algo (str): Specifies convolution forward algorithm and the default value is 'normal',
1729
- The value range is as follows:
1730
-
1731
- - normal: Use the heuristic search algorithm.
1732
- - performance: Use the trial search algorithm.
1733
- - implicit_gemm: This algorithm expresses the convolution as a matrix product without actually explicitly
1734
- forming the matrix that holds the input tensor data.
1735
- - implicit_precomp_gemm: This algorithm expresses convolution as a matrix product without actually
1736
- explicitly forming the matrix that holds the input tensor data, but still needs some memory workspace to
1737
- precompute some indices in order to facilitate the implicit construction of the matrix that holds the
1738
- input tensor data.
1739
- - gemm: This algorithm expresses the convolution as an explicit matrix product. A significant memory
1740
- workspace is needed to store the matrix that holds the input tensor data.
1741
- - direct: This algorithm expresses the convolution as a direct convolution (for example, without
1742
- implicitly or explicitly doing a matrix multiplication).
1743
- - fft: This algorithm uses the Fast-Fourier Transform approach to compute the convolution. A significant
1744
- memory workspace is needed to store intermediate results.
1745
- - fft_tiling: This algorithm uses the Fast-Fourier Transform approach but splits the inputs into tiles.
1746
- A significant memory workspace is needed to store intermediate results but less than fft algorithm for
1747
- large size images.
1748
- - winograd: This algorithm uses the Winograd Transform approach to compute the convolution. A reasonably
1749
- sized workspace is needed to store intermediate results.
1750
- - winograd_nonfused: This algorithm uses the Winograd Transform approach to compute the convolution. A
1751
- significant workspace may be needed to store intermediate results.
1752
- - conv_dgrad_algo (str): Specifies convolution data grad algorithm and the default value is 'normal',
1753
- The value range is as follows:
1754
-
1755
- - normal: Use the heuristic search algorithm.
1756
- - performance: Use the trial search algorithm.
1757
- - algo_0: This algorithm expresses the convolution as a sum of matrix products without actually explicitly
1758
- forming the matrix that holds the input tensor data. The sum is done using the atomic add operation,
1759
- thus the results are non-deterministic.
1760
- - algo_1: This algorithm expresses the convolution as a matrix product without actually explicitly forming
1761
- the matrix that holds the input tensor data. The results are deterministic.
1762
- - fft: This algorithm uses a Fast-Fourier Transform approach to compute the convolution. A significant
1763
- memory workspace is needed to store intermediate results. The results are deterministic.
1764
- - fft_tiling: This algorithm uses the Fast-Fourier Transform approach but splits the inputs into tiles.
1765
- A significant memory workspace is needed to store intermediate results but less than fft for large size
1766
- images. The results are deterministic.
1767
- - winograd: This algorithm uses the Winograd Transform approach to compute the convolution. A reasonably
1768
- sized workspace is needed to store intermediate results. The results are deterministic.
1769
- - winograd_nonfused: This algorithm uses the Winograd Transform approach to compute the convolution.
1770
- A significant workspace may be needed to store intermediate results. The results are deterministic.
1771
- - conv_wgrad_algo (str): Specifies convolution filter grad algorithm and the default value is 'normal',
1772
- The value range is as follows:
1773
-
1774
- - normal: Use the heuristic search algorithm.
1775
- - performance: Use the trial search algorithm.
1776
- - algo_0: This algorithm expresses the convolution as a sum of matrix products without actually explicitly
1777
- forming the matrix that holds the input tensor data. The sum is done using the atomic add operation,
1778
- thus the results are non-deterministic.
1779
- - algo_1: This algorithm expresses the convolution as a matrix product without actually explicitly forming
1780
- the matrix that holds the input tensor data. The results are deterministic.
1781
- - fft: This algorithm uses a Fast-Fourier Transform approach to compute the convolution. A significant
1782
- memory workspace is needed to store intermediate results. The results are deterministic.
1783
- - algo_3: This algorithm is similar to algo_0 but uses some small workspace to precompute some indices.
1784
- The results are also non-deterministic.
1785
- - winograd_nonfused: This algorithm uses the Winograd Transform approach to compute the convolution.
1786
- A significant workspace may be needed to store intermediate results. The results are deterministic.
1787
- - fft_tiling: This algorithm uses the Fast-Fourier Transform approach but splits the inputs into tiles.
1788
- A significant memory workspace is needed to store intermediate results but less than fft for large size
1789
- images. The results are deterministic.
1790
- - conv_allow_tf32 (bool): The flag below controls to allow Tensor core TF32 computation on CUDNN and the
1791
- default value is ``True``.
1792
- - matmul_allow_tf32 (bool): The flag below controls to allow Tensor core TF32 computation on CUBLAS and the
1793
- default value is ``False``.
1794
-
1795
- jit_config (dict): Set the global jit config for compile, take effect in network defined in Cell or jit
1796
- decorators. It is not set by default.
1797
- The setting in context is the global jit config, while JitConfig is the local network's jit config.
1798
- When both exist simultaneously, the global jit config will not overwrite the local network's jit config.
1799
-
1800
- - jit_level (str): Used to control the compilation optimization level. Default: ``""`` , The framework
1801
- automatically selects the execution method based on product, Atlas training product is O2, and all other
1802
- products are O0. In addition, The option of the dynamic shape must be O0 or O1, O2 is not supported.
1803
- The value range is as follows:
1804
-
1805
- - ``"O0"``: Except for optimizations that may affect functionality, all other optimizations are turned
1806
- off, adopt KernelByKernel execution mode.
1807
- - ``"O1"``: Using commonly used optimizations and automatic operator fusion optimizations,
1808
- adopt KernelByKernel execution mode. This optimization level is experimental and is being improved.
1809
- - ``"O2"``: Ultimate performance optimization, adopt Sink execution mode.
1810
-
1811
- - infer_boost (str): Used to control the infer mode. Default: ``"off"`` . The value range is as follows:
1812
-
1813
- - ``"on"``: Enable infer mode, get better infer performance.
1814
- - ``"off"``: Disable infer mode, use forward to infer, performance is not good.
1815
-
1816
- exec_order (str): Set the sorting method for operator execution in GRAPH_MODE Currently, only three sorting
1817
- methods are supported: bfs and gpto, and the default method is bfs.
1818
-
1819
- - ``"bfs"``: The default sorting method, breadth priority, good communication masking, relatively good
1820
- performance.
1821
- - ``"dfs"``: An optional sorting method, depth-first sorting. The performance is relatively worse than that
1822
- of bfs execution order, but it occupies less memory. It is recommended to try dfs in scenarios where other
1823
- execution orders run out of memory (OOM).
1824
- - ``"gpto"``: An optional sorting method. This method combines multiple execution orders and selects a
1825
- method with relatively good performance. There may be some performance gains in scenarios with multiple
1826
- replicas running in parallel.
1827
1535
 
1828
- Raises:
1829
- ValueError: If input key is not an attribute in context.
1536
+ - conv_fprop_algo (str): Specifies convolution forward algorithm. Default ``"normal"`` .
1537
+ This parameter will be deprecated and removed in future versions. Please use the
1538
+ api :func:`mindspore.device_context.gpu.op_tuning.conv_fprop_algo` instead.
1539
+ - conv_dgrad_algo (str): Specifies convolution data grad algorithm. Default ``"normal"`` .
1540
+ This parameter will be deprecated and removed in future versions. Please use the
1541
+ api :func:`mindspore.device_context.gpu.op_tuning.conv_dgrad_algo` instead.
1542
+ - conv_wgrad_algo (str): Specifies convolution filter grad algorithm. Default ``"normal"`` .
1543
+ This parameter will be deprecated and removed in future versions. Please use the
1544
+ api :func:`mindspore.device_context.gpu.op_tuning.conv_wgrad_algo` instead.
1545
+ - conv_allow_tf32 (bool): Controls to allow Tensor core TF32 computation on CUDNN.
1546
+ Default ``True``.
1547
+ This parameter will be deprecated and removed in future versions. Please use the
1548
+ api :func:`mindspore.device_context.gpu.op_precision.conv_allow_tf32` instead.
1549
+ - matmul_allow_tf32 (bool): Controls to allow Tensor core TF32 computation on CUBLAS.
1550
+ Default ``False``.
1551
+ This parameter will be deprecated and removed in future versions. Please use the
1552
+ api :func:`mindspore.device_context.gpu.op_precision.matmul_allow_tf32` instead.
1553
+ print_file_path (str): This parameter will be deprecated and removed in future versions.
1554
+ env_config_path (str): This parameter will be deprecated and removed in future versions.
1555
+ debug_level (int): This parameter will be deprecated and removed in future versions.
1556
+ reserve_class_name_in_scope (bool): This parameter will be deprecated and removed in future versions.
1557
+ check_bprop (bool): This parameter will be deprecated and removed in future versions.
1558
+ enable_reduce_precision (bool): This parameter will be deprecated and removed in a future versions.
1559
+ grad_for_scalar (bool): This parameter will be deprecated and removed in future versions.
1560
+ support_binary (bool): Whether to support run .pyc or .so in graph mode.
1830
1561
 
1831
1562
  Examples:
1832
1563
  >>> import mindspore as ms
@@ -1836,8 +1567,6 @@ def set_context(**kwargs):
1836
1567
  >>> ms.set_context(device_id=0)
1837
1568
  >>> ms.set_context(save_graphs=True, save_graphs_path="./model.ms")
1838
1569
  >>> ms.set_context(enable_reduce_precision=True)
1839
- >>> ms.set_context(enable_graph_kernel=True)
1840
- >>> ms.set_context(graph_kernel_flags="--opt_level=2 --dump_as_text")
1841
1570
  >>> ms.set_context(reserve_class_name_in_scope=True)
1842
1571
  >>> ms.set_context(variable_memory_max_size="6GB")
1843
1572
  >>> ms.set_context(aoe_tune_mode="online")
@@ -1867,7 +1596,7 @@ def set_context(**kwargs):
1867
1596
  >>> ms.set_context(gpu_config={"conv_fprop_algo": "performance", "conv_allow_tf32": True,
1868
1597
  ... "matmul_allow_tf32": True})
1869
1598
  >>> ms.set_context(jit_config={"jit_level": "O0"})
1870
- >>> ms.set_context(exec_order="gpto")
1599
+ >>> ms.set_context(exec_order="bfs")
1871
1600
  """
1872
1601
  ctx = _context()
1873
1602
  # set device target first
@@ -1877,14 +1606,22 @@ def set_context(**kwargs):
1877
1606
  _check_ascend_device_context_initialized(device, kwargs)
1878
1607
 
1879
1608
  for key, value in kwargs.items():
1609
+ _check_context_deprecated(key)
1880
1610
  if key in ('enable_sparse', 'auto_tune_mode'):
1881
1611
  logger.warning(f"For 'context.set_context', '{key}' parameter is deprecated, "
1882
1612
  "and will be removed in the next version.")
1883
1613
  continue
1884
- if key in ('enable_auto_mixed_precision', 'enable_dump', 'save_dump_path'):
1614
+ if key in ('enable_auto_mixed_precision',):
1885
1615
  logger.warning(f"For 'context.set_context', '{key}' parameter is deprecated. "
1886
1616
  "For details, please see the interface parameter API comments")
1887
1617
  continue
1618
+ if key == "print_file_path":
1619
+ logger.warning(f"For 'context.set_context', '{key}' parameter is deprecated due to changes in the behavior"
1620
+ f" of the print operator. Recommend not using this parameter and"
1621
+ f" directly viewing the screen output.")
1622
+ if key in ('reserve_class_name_in_scope', 'env_config_path'):
1623
+ logger.warning(f"For 'context.set_context', '{key}' parameter is deprecated, "
1624
+ "and will be removed in the next version.")
1888
1625
  _check_key(key)
1889
1626
  if key == 'save_graphs':
1890
1627
  if value is True:
@@ -1903,6 +1640,14 @@ def set_context(**kwargs):
1903
1640
  setattr(ctx, key, value)
1904
1641
  ctx.set_param(ms_ctx_param.__members__[key], int(value))
1905
1642
  continue
1643
+ if key == 'enable_graph_kernel':
1644
+ logger.warning(f"For 'context.set_context', '{key}' parameter is deprecated, "
1645
+ "and will be removed in the next version. "
1646
+ "Please use jit_config={'jit_level': 'O1'} instead.")
1647
+ if key == 'graph_kernel_flags':
1648
+ logger.warning(f"For 'context.set_context', '{key}' parameter is deprecated, "
1649
+ "and will be removed in the next version. "
1650
+ "Please use environ variable 'MS_DEV_GRAPH_KERNEL_FLAGS' instead.")
1906
1651
  if not _check_target_specific_cfgs(device, key):
1907
1652
  continue
1908
1653
  if key in ctx.setters:
@@ -1920,8 +1665,11 @@ def set_context(**kwargs):
1920
1665
 
1921
1666
 
1922
1667
  def get_context(attr_key):
1668
+
1923
1669
  """
1924
- Get context attribute value according to the input key.
1670
+ Get context attribute value according to the input key, this api will be deprecated and removed in future versions,
1671
+ please use :func:`mindspore.get_current_device` instead.
1672
+
1925
1673
  If some attributes are not set, they will be automatically obtained.
1926
1674
 
1927
1675
  Args:
@@ -1998,7 +1746,7 @@ class ParallelMode:
1998
1746
  @args_type_check(enable_ps=bool)
1999
1747
  def set_ps_context(**kwargs):
2000
1748
  """
2001
- Set parameter server training mode context.
1749
+ Set parameter server training mode context, this api will be deprecated and removed in future versions.
2002
1750
 
2003
1751
  Note:
2004
1752
  Parameter server mode is only supported in graph mode.
@@ -2019,7 +1767,7 @@ def set_ps_context(**kwargs):
2019
1767
  enable_ps (bool): Whether to enable parameter server training mode.
2020
1768
  Only after enable_ps is set True, the environment variables will be effective.
2021
1769
  Default: ``False`` .
2022
- config_file_path (string): Configuration file path used by recovery, parameter server training mode only
1770
+ config_file_path (str): Configuration file path used by recovery, parameter server training mode only
2023
1771
  supports Server disaster recovery currently. Default: ``''`` .
2024
1772
  scheduler_manage_port (int): Scheduler manage port used to scale out/in. Default: ``11202`` .
2025
1773
  enable_ssl (bool): Set PS SSL mode enabled or disabled. Default: ``False`` .
@@ -2038,19 +1786,21 @@ def set_ps_context(**kwargs):
2038
1786
 
2039
1787
  def get_ps_context(attr_key):
2040
1788
  """
2041
- Get parameter server training mode context attribute value according to the key.
1789
+ Get parameter server training mode context attribute value according to the key, this api will be deprecated and
1790
+ removed in future versions.
2042
1791
 
2043
1792
  Args:
2044
1793
  attr_key (str): The key of the attribute:
2045
1794
 
2046
- - enable_ps (bool): Whether to enable parameter server training mode. Default: ``False`` .
2047
- - config_file_path (string): Configuration file path used by recovery, parameter server training mode only
1795
+ - enable_ps (bool, optional): Whether to enable parameter server training mode. Default: ``False`` .
1796
+ - config_file_path (str, optional): Configuration file path used by recovery,
1797
+ parameter server training mode only
2048
1798
  supports Server disaster recovery currently. Default: ``''`` .
2049
- - scheduler_manage_port (int): Scheduler manage port used to scale out/in. Default: ``11202`` .
2050
- - enable_ssl (bool): Set PS SSL mode enabled or disabled. Default: ``False`` .
2051
- - client_password (str): Password to decrypt the secret key stored in the client certificate.
1799
+ - scheduler_manage_port (int, optional): Scheduler manage port used to scale out/in. Default: ``11202`` .
1800
+ - enable_ssl (bool, optional): Set PS SSL mode enabled or disabled. Default: ``False`` .
1801
+ - client_password (str, optional): Password to decrypt the secret key stored in the client certificate.
2052
1802
  Default: ``''`` .
2053
- - server_password (str): Password to decrypt the secret key stored in the server certificate.
1803
+ - server_password (str, optional): Password to decrypt the secret key stored in the server certificate.
2054
1804
  Default: ``''`` .
2055
1805
 
2056
1806
  Returns:
@@ -2068,7 +1818,8 @@ def get_ps_context(attr_key):
2068
1818
 
2069
1819
  def reset_ps_context():
2070
1820
  """
2071
- Reset parameter server training mode context attributes to the default values.
1821
+ Reset parameter server training mode context attributes to the default values, this api will be deprecated and
1822
+ removed in future versions.
2072
1823
 
2073
1824
  Meaning of each field and its default value refer to :func:`mindspore.set_ps_context`.
2074
1825