mindspore 2.4.10__cp310-cp310-win_amd64.whl → 2.6.0rc1__cp310-cp310-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mindspore might be problematic. Click here for more details.
- mindspore/.commit_id +1 -1
- mindspore/Microsoft.VisualStudio.Telemetry.dll +0 -0
- mindspore/Newtonsoft.Json.dll +0 -0
- mindspore/__init__.py +13 -6
- mindspore/_c_dataengine.cp310-win_amd64.pyd +0 -0
- mindspore/_c_expression.cp310-win_amd64.pyd +0 -0
- mindspore/_c_mindrecord.cp310-win_amd64.pyd +0 -0
- mindspore/_check_jit_forbidden_api.py +3 -0
- mindspore/_checkparam.py +3 -38
- mindspore/_deprecated/__init__.py +17 -0
- mindspore/_deprecated/jit.py +198 -0
- mindspore/_extends/builtin_operations.py +1 -1
- mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
- mindspore/_extends/parse/__init__.py +6 -7
- mindspore/_extends/parse/compile_config.py +83 -0
- mindspore/_extends/parse/deprecated/__init__.py +0 -0
- mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +394 -0
- mindspore/_extends/parse/jit_fallback_modules/__init__.py +0 -0
- mindspore/_extends/parse/jit_fallback_modules/check_utils.py +123 -0
- mindspore/_extends/parse/jit_fallback_modules/third_party_modules.py +50 -0
- mindspore/_extends/parse/parser.py +46 -197
- mindspore/_extends/parse/resources.py +1 -5
- mindspore/_extends/parse/standard_method.py +217 -98
- mindspore/_extends/pijit/__init__.py +2 -2
- mindspore/_extends/pijit/pijit_func_white_list.py +17 -12
- mindspore/_extends/pijit/tensor_func_list.py +27 -0
- mindspore/_extends/utils.py +1 -1
- mindspore/amp.py +11 -5
- mindspore/atlprov.dll +0 -0
- mindspore/avcodec-59.dll +0 -0
- mindspore/avdevice-59.dll +0 -0
- mindspore/avfilter-8.dll +0 -0
- mindspore/avformat-59.dll +0 -0
- mindspore/avutil-57.dll +0 -0
- mindspore/boost/__init__.py +2 -2
- mindspore/boost/base.py +3 -7
- mindspore/boost/boost_cell_wrapper.py +138 -43
- mindspore/c1.dll +0 -0
- mindspore/c1xx.dll +0 -0
- mindspore/c2.dll +0 -0
- mindspore/common/__init__.py +6 -3
- mindspore/common/_grad_function.py +56 -0
- mindspore/common/_pijit_context.py +14 -5
- mindspore/common/_register_for_tensor.py +1 -2
- mindspore/common/_stub_tensor.py +30 -14
- mindspore/common/_tensor_cpp_method.py +17 -0
- mindspore/common/_tensor_docs.py +4760 -0
- mindspore/common/api.py +435 -371
- mindspore/common/auto_dynamic_shape.py +41 -44
- mindspore/common/dtype.py +39 -36
- mindspore/common/dump.py +9 -6
- mindspore/common/file_system.py +9 -1
- mindspore/common/generator.py +2 -0
- mindspore/common/hook_handle.py +6 -2
- mindspore/common/initializer.py +13 -10
- mindspore/common/jit_begin_end.py +94 -0
- mindspore/common/jit_config.py +6 -1
- mindspore/common/jit_context.py +76 -0
- mindspore/common/jit_trace.py +378 -0
- mindspore/common/lazy_inline.py +9 -3
- mindspore/common/mindir_util.py +10 -2
- mindspore/common/mutable.py +5 -4
- mindspore/common/parameter.py +135 -52
- mindspore/common/seed.py +2 -2
- mindspore/common/sparse_tensor.py +23 -17
- mindspore/common/tensor.py +951 -1992
- mindspore/communication/__init__.py +7 -5
- mindspore/communication/_comm_helper.py +52 -2
- mindspore/communication/comm_func.py +240 -181
- mindspore/communication/management.py +95 -26
- mindspore/context.py +314 -566
- mindspore/dataset/__init__.py +65 -37
- mindspore/dataset/audio/__init__.py +2 -8
- mindspore/dataset/audio/transforms.py +3 -17
- mindspore/dataset/callback/ds_callback.py +2 -1
- mindspore/dataset/core/config.py +87 -6
- mindspore/dataset/engine/cache_admin.py +3 -3
- mindspore/dataset/engine/cache_client.py +6 -5
- mindspore/dataset/engine/datasets.py +292 -267
- mindspore/dataset/engine/datasets_audio.py +22 -8
- mindspore/dataset/engine/datasets_standard_format.py +46 -27
- mindspore/dataset/engine/datasets_text.py +78 -48
- mindspore/dataset/engine/datasets_user_defined.py +182 -116
- mindspore/dataset/engine/datasets_vision.py +120 -44
- mindspore/dataset/engine/iterators.py +283 -63
- mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +1 -1
- mindspore/dataset/engine/obs/util.py +8 -0
- mindspore/dataset/engine/queue.py +40 -0
- mindspore/dataset/engine/samplers.py +289 -43
- mindspore/dataset/engine/serializer_deserializer.py +3 -2
- mindspore/dataset/engine/validators.py +53 -11
- mindspore/dataset/text/__init__.py +7 -6
- mindspore/dataset/text/transforms.py +6 -5
- mindspore/dataset/text/utils.py +3 -3
- mindspore/dataset/transforms/__init__.py +0 -9
- mindspore/dataset/transforms/py_transforms_util.py +17 -0
- mindspore/dataset/transforms/transforms.py +31 -14
- mindspore/dataset/utils/browse_dataset.py +1 -1
- mindspore/dataset/vision/__init__.py +2 -9
- mindspore/dataset/vision/transforms.py +202 -158
- mindspore/dataset/vision/utils.py +7 -5
- mindspore/dataset/vision/validators.py +1 -2
- mindspore/device_context/__init__.py +21 -0
- mindspore/device_context/ascend/__init__.py +25 -0
- mindspore/device_context/ascend/device.py +72 -0
- mindspore/device_context/ascend/op_debug.py +153 -0
- mindspore/device_context/ascend/op_precision.py +193 -0
- mindspore/device_context/ascend/op_tuning.py +123 -0
- mindspore/{ops_generate/gen_constants.py → device_context/cpu/__init__.py} +6 -17
- mindspore/device_context/cpu/device.py +62 -0
- mindspore/device_context/cpu/op_tuning.py +43 -0
- mindspore/device_context/gpu/__init__.py +21 -0
- mindspore/device_context/gpu/device.py +70 -0
- mindspore/device_context/gpu/op_precision.py +67 -0
- mindspore/device_context/gpu/op_tuning.py +175 -0
- mindspore/device_manager.py +170 -0
- mindspore/dnnl.dll +0 -0
- mindspore/dpcmi.dll +0 -0
- mindspore/experimental/es/embedding_service.py +35 -27
- mindspore/experimental/llm_boost/__init__.py +1 -0
- mindspore/experimental/llm_boost/ascend_native/__init__.py +22 -0
- mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +211 -0
- mindspore/experimental/llm_boost/ascend_native/llm_boost.py +52 -0
- mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
- mindspore/experimental/llm_boost/atb/llama_boost.py +6 -1
- mindspore/experimental/llm_boost/register.py +1 -0
- mindspore/experimental/map_parameter.py +4 -4
- mindspore/experimental/optim/adadelta.py +6 -6
- mindspore/experimental/optim/adagrad.py +4 -4
- mindspore/experimental/optim/adam.py +7 -0
- mindspore/experimental/optim/adamax.py +4 -4
- mindspore/experimental/optim/adamw.py +4 -0
- mindspore/experimental/optim/asgd.py +1 -1
- mindspore/experimental/optim/lr_scheduler.py +73 -46
- mindspore/experimental/optim/radam.py +34 -31
- mindspore/experimental/optim/rprop.py +1 -1
- mindspore/experimental/optim/sgd.py +1 -1
- mindspore/hal/contiguous_tensors_handle.py +6 -10
- mindspore/hal/device.py +55 -53
- mindspore/hal/event.py +52 -52
- mindspore/hal/memory.py +157 -117
- mindspore/hal/stream.py +150 -109
- mindspore/include/api/context.h +0 -1
- mindspore/include/dataset/constants.h +7 -4
- mindspore/include/dataset/execute.h +2 -2
- mindspore/jpeg62.dll +0 -0
- mindspore/log.py +50 -0
- mindspore/mindrecord/__init__.py +21 -8
- mindspore/mindrecord/config.py +17 -316
- mindspore/mindrecord/filereader.py +1 -9
- mindspore/mindrecord/filewriter.py +5 -15
- mindspore/mindrecord/mindpage.py +1 -9
- mindspore/mindspore_backend_common.dll +0 -0
- mindspore/mindspore_backend_manager.dll +0 -0
- mindspore/mindspore_common.dll +0 -0
- mindspore/mindspore_core.dll +0 -0
- mindspore/mindspore_dump.dll +0 -0
- mindspore/mindspore_frontend.dll +0 -0
- mindspore/mindspore_glog.dll +0 -0
- mindspore/mindspore_memory_pool.dll +0 -0
- mindspore/mindspore_ms_backend.dll +0 -0
- mindspore/mindspore_ops.dll +0 -0
- mindspore/{mindspore_backend.dll → mindspore_ops_host.dll} +0 -0
- mindspore/mindspore_ops_kernel_common.dll +0 -0
- mindspore/mindspore_profiler.dll +0 -0
- mindspore/mindspore_pyboost.dll +0 -0
- mindspore/mindspore_pynative.dll +0 -0
- mindspore/mindspore_res_manager.dll +0 -0
- mindspore/mindspore_runtime_pipeline.dll +0 -0
- mindspore/mint/__init__.py +796 -759
- mindspore/mint/distributed/__init__.py +70 -4
- mindspore/mint/distributed/distributed.py +2679 -44
- mindspore/mint/linalg/__init__.py +8 -0
- mindspore/mint/nn/__init__.py +743 -22
- mindspore/mint/nn/functional.py +716 -23
- mindspore/mint/nn/layer/__init__.py +21 -4
- mindspore/mint/nn/layer/_functions.py +334 -0
- mindspore/mint/nn/layer/activation.py +276 -1
- mindspore/mint/nn/layer/basic.py +123 -0
- mindspore/mint/nn/layer/conv.py +921 -0
- mindspore/mint/nn/layer/normalization.py +223 -28
- mindspore/mint/nn/layer/padding.py +797 -0
- mindspore/mint/nn/layer/pooling.py +235 -0
- mindspore/mint/optim/__init__.py +3 -1
- mindspore/mint/optim/adam.py +223 -0
- mindspore/mint/optim/adamw.py +26 -19
- mindspore/mint/optim/sgd.py +171 -0
- mindspore/mint/special/__init__.py +2 -1
- mindspore/msobj140.dll +0 -0
- mindspore/mspdb140.dll +0 -0
- mindspore/mspdbcore.dll +0 -0
- mindspore/mspdbst.dll +0 -0
- mindspore/mspft140.dll +0 -0
- mindspore/msvcdis140.dll +0 -0
- mindspore/msvcp140_1.dll +0 -0
- mindspore/msvcp140_2.dll +0 -0
- mindspore/msvcp140_atomic_wait.dll +0 -0
- mindspore/msvcp140_codecvt_ids.dll +0 -0
- mindspore/multiprocessing/__init__.py +5 -0
- mindspore/nn/__init__.py +4 -1
- mindspore/nn/cell.py +1370 -189
- mindspore/nn/dynamic_lr.py +2 -1
- mindspore/nn/layer/activation.py +29 -27
- mindspore/nn/layer/basic.py +51 -35
- mindspore/nn/layer/channel_shuffle.py +3 -3
- mindspore/nn/layer/container.py +1 -1
- mindspore/nn/layer/conv.py +22 -17
- mindspore/nn/layer/embedding.py +12 -11
- mindspore/nn/layer/normalization.py +56 -49
- mindspore/nn/layer/padding.py +4 -3
- mindspore/nn/layer/pooling.py +120 -42
- mindspore/nn/layer/rnn_cells.py +1 -1
- mindspore/nn/layer/rnns.py +2 -1
- mindspore/nn/layer/timedistributed.py +5 -5
- mindspore/nn/layer/transformer.py +59 -36
- mindspore/nn/learning_rate_schedule.py +8 -4
- mindspore/nn/loss/loss.py +58 -55
- mindspore/nn/optim/ada_grad.py +7 -5
- mindspore/nn/optim/adadelta.py +11 -9
- mindspore/nn/optim/adafactor.py +1 -1
- mindspore/nn/optim/adam.py +17 -13
- mindspore/nn/optim/adamax.py +8 -7
- mindspore/nn/optim/adasum.py +5 -5
- mindspore/nn/optim/asgd.py +1 -1
- mindspore/nn/optim/ftrl.py +11 -9
- mindspore/nn/optim/lamb.py +1 -1
- mindspore/nn/optim/lars.py +1 -4
- mindspore/nn/optim/lazyadam.py +12 -10
- mindspore/nn/optim/momentum.py +7 -6
- mindspore/nn/optim/optimizer.py +3 -3
- mindspore/nn/optim/proximal_ada_grad.py +12 -10
- mindspore/nn/optim/rmsprop.py +13 -12
- mindspore/nn/optim/rprop.py +11 -9
- mindspore/nn/optim/sgd.py +9 -6
- mindspore/nn/optim/tft_wrapper.py +5 -2
- mindspore/nn/optim/thor.py +2 -1
- mindspore/nn/probability/bijector/bijector.py +17 -11
- mindspore/nn/probability/bijector/gumbel_cdf.py +5 -5
- mindspore/nn/probability/bijector/invert.py +2 -2
- mindspore/nn/probability/bijector/scalar_affine.py +3 -3
- mindspore/nn/probability/bijector/softplus.py +3 -2
- mindspore/nn/probability/distribution/beta.py +3 -3
- mindspore/nn/probability/distribution/categorical.py +1 -1
- mindspore/nn/probability/distribution/cauchy.py +4 -2
- mindspore/nn/probability/distribution/exponential.py +6 -7
- mindspore/nn/probability/distribution/gamma.py +2 -2
- mindspore/nn/probability/distribution/gumbel.py +2 -2
- mindspore/nn/probability/distribution/half_normal.py +5 -3
- mindspore/nn/probability/distribution/logistic.py +5 -3
- mindspore/nn/probability/distribution/poisson.py +1 -1
- mindspore/nn/probability/distribution/uniform.py +5 -3
- mindspore/nn/reinforcement/_tensors_queue.py +1 -1
- mindspore/nn/reinforcement/tensor_array.py +1 -1
- mindspore/nn/utils/init.py +13 -11
- mindspore/nn/wrap/__init__.py +6 -6
- mindspore/nn/wrap/cell_wrapper.py +181 -122
- mindspore/nn/wrap/grad_reducer.py +45 -36
- mindspore/nn/wrap/loss_scale.py +6 -7
- mindspore/numpy/array_creations.py +63 -65
- mindspore/numpy/array_ops.py +149 -144
- mindspore/numpy/logic_ops.py +41 -42
- mindspore/numpy/math_ops.py +365 -363
- mindspore/numpy/utils.py +17 -18
- mindspore/numpy/utils_const.py +5 -6
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/opencv_imgproc452.dll +0 -0
- mindspore/ops/__init__.py +5 -3
- mindspore/ops/_grad_experimental/grad_comm_ops.py +112 -16
- mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -2
- mindspore/ops/_grad_experimental/grad_inner_ops.py +9 -0
- mindspore/ops/_grad_experimental/grad_math_ops.py +2 -1
- mindspore/ops/_grad_experimental/taylor_rule.py +29 -0
- mindspore/ops/_op_impl/cpu/__init__.py +1 -0
- mindspore/ops/_op_impl/cpu/raise_op.py +28 -0
- mindspore/ops/_register_for_op.py +0 -11
- mindspore/{ops_generate → ops/_utils}/arg_dtype_cast.py +123 -4
- mindspore/{ops_generate → ops/_utils}/arg_handler.py +3 -65
- mindspore/ops/_vmap/vmap_array_ops.py +27 -25
- mindspore/ops/_vmap/vmap_base.py +0 -2
- mindspore/ops/_vmap/vmap_grad_nn_ops.py +21 -14
- mindspore/ops/_vmap/vmap_math_ops.py +15 -16
- mindspore/ops/_vmap/vmap_nn_ops.py +29 -42
- mindspore/ops/auto_generate/__init__.py +4 -3
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +236 -46
- mindspore/ops/auto_generate/gen_extend_func.py +764 -124
- mindspore/ops/auto_generate/gen_ops_def.py +4018 -2264
- mindspore/ops/auto_generate/gen_ops_prim.py +15463 -5037
- mindspore/ops/auto_generate/pyboost_inner_prim.py +221 -87
- mindspore/ops/composite/__init__.py +2 -1
- mindspore/ops/composite/base.py +20 -25
- mindspore/ops/composite/math_ops.py +6 -16
- mindspore/ops/composite/multitype_ops/__init__.py +5 -2
- mindspore/ops/composite/multitype_ops/_compile_utils.py +228 -30
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -2
- mindspore/ops/composite/multitype_ops/add_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/bitwise_and_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/bitwise_or_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/bitwise_xor_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/div_impl.py +6 -4
- mindspore/ops/composite/multitype_ops/equal_impl.py +4 -3
- mindspore/ops/composite/multitype_ops/floordiv_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/getitem_impl.py +3 -2
- mindspore/ops/composite/multitype_ops/greater_equal_impl.py +4 -3
- mindspore/ops/composite/multitype_ops/greater_impl.py +4 -3
- mindspore/ops/composite/multitype_ops/in_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/invert_impl.py +50 -0
- mindspore/ops/composite/multitype_ops/left_shift_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/less_equal_impl.py +4 -3
- mindspore/ops/composite/multitype_ops/less_impl.py +4 -3
- mindspore/ops/composite/multitype_ops/logic_not_impl.py +3 -2
- mindspore/ops/composite/multitype_ops/logical_and_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/logical_or_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/mod_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/mul_impl.py +3 -2
- mindspore/ops/composite/multitype_ops/negative_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/not_equal_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/not_in_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/ones_like_impl.py +18 -0
- mindspore/ops/composite/multitype_ops/pow_impl.py +2 -30
- mindspore/ops/composite/multitype_ops/right_shift_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/setitem_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/sub_impl.py +2 -1
- mindspore/ops/function/__init__.py +40 -2
- mindspore/ops/function/_add_attr_func.py +58 -0
- mindspore/ops/function/array_func.py +2089 -2403
- mindspore/ops/function/clip_func.py +80 -23
- mindspore/ops/function/debug_func.py +57 -57
- mindspore/ops/function/grad/__init__.py +1 -0
- mindspore/ops/function/grad/grad_func.py +104 -71
- mindspore/ops/function/image_func.py +2 -2
- mindspore/ops/function/linalg_func.py +47 -78
- mindspore/ops/function/math_func.py +4501 -3802
- mindspore/ops/function/nn_func.py +1726 -620
- mindspore/ops/function/other_func.py +159 -1
- mindspore/ops/function/parameter_func.py +18 -84
- mindspore/ops/function/random_func.py +440 -387
- mindspore/ops/function/reshard_func.py +4 -70
- mindspore/ops/function/sparse_func.py +3 -3
- mindspore/ops/function/sparse_unary_func.py +6 -6
- mindspore/ops/function/spectral_func.py +25 -58
- mindspore/ops/function/vmap_func.py +24 -17
- mindspore/ops/functional.py +22 -7
- mindspore/ops/functional_overload.py +1440 -0
- mindspore/ops/op_info_register.py +32 -244
- mindspore/ops/operations/__init__.py +13 -7
- mindspore/ops/operations/_custom_ops_utils.py +247 -0
- mindspore/ops/operations/_embedding_cache_ops.py +4 -4
- mindspore/ops/operations/_grad_ops.py +2 -43
- mindspore/ops/operations/_infer_ops.py +2 -1
- mindspore/ops/operations/_inner_ops.py +43 -84
- mindspore/ops/operations/_ms_kernel.py +4 -10
- mindspore/ops/operations/_rl_inner_ops.py +1 -1
- mindspore/ops/operations/_scalar_ops.py +3 -2
- mindspore/ops/operations/_sequence_ops.py +1 -1
- mindspore/ops/operations/_tensor_array.py +1 -1
- mindspore/ops/operations/array_ops.py +81 -324
- mindspore/ops/operations/comm_ops.py +154 -108
- mindspore/ops/operations/custom_ops.py +232 -78
- mindspore/ops/operations/debug_ops.py +153 -59
- mindspore/ops/operations/inner_ops.py +7 -5
- mindspore/ops/operations/linalg_ops.py +1 -57
- mindspore/ops/operations/manually_defined/_inner.py +1 -1
- mindspore/ops/operations/manually_defined/ops_def.py +928 -180
- mindspore/ops/operations/math_ops.py +32 -234
- mindspore/ops/operations/nn_ops.py +210 -498
- mindspore/ops/operations/other_ops.py +62 -9
- mindspore/ops/operations/random_ops.py +13 -7
- mindspore/ops/operations/reshard_ops.py +1 -1
- mindspore/ops/operations/sparse_ops.py +2 -2
- mindspore/ops/primitive.py +66 -53
- mindspore/ops/tensor_method.py +1888 -0
- mindspore/ops_generate/__init__.py +0 -5
- mindspore/ops_generate/aclnn/__init__.py +0 -0
- mindspore/ops_generate/aclnn/aclnn_kernel_register_auto_cc_generator.py +135 -0
- mindspore/ops_generate/aclnn/gen_aclnn_implement.py +257 -0
- mindspore/ops_generate/api/__init__.py +0 -0
- mindspore/ops_generate/api/add_tensor_docs_generator.py +56 -0
- mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +105 -0
- mindspore/ops_generate/api/functional_map_cpp_generator.py +504 -0
- mindspore/ops_generate/api/functional_overload_py_generator.py +112 -0
- mindspore/ops_generate/api/functions_cc_generator.py +237 -0
- mindspore/ops_generate/api/gen_api.py +103 -0
- mindspore/ops_generate/api/op_api_proto.py +235 -0
- mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +461 -0
- mindspore/ops_generate/common/__init__.py +0 -0
- mindspore/ops_generate/common/base_generator.py +11 -0
- mindspore/ops_generate/common/gen_constants.py +91 -0
- mindspore/ops_generate/common/gen_utils.py +348 -0
- mindspore/ops_generate/common/op_proto.py +473 -0
- mindspore/ops_generate/common/template.py +523 -0
- mindspore/ops_generate/gen_ops.py +22 -1069
- mindspore/ops_generate/op_def/__init__.py +0 -0
- mindspore/ops_generate/op_def/gen_op_def.py +90 -0
- mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +191 -0
- mindspore/ops_generate/op_def/ops_def_cc_generator.py +299 -0
- mindspore/ops_generate/op_def/ops_def_h_generator.py +74 -0
- mindspore/ops_generate/op_def/ops_name_h_generator.py +83 -0
- mindspore/ops_generate/op_def/ops_primitive_h_generator.py +125 -0
- mindspore/ops_generate/op_def_py/__init__.py +0 -0
- mindspore/ops_generate/op_def_py/gen_op_def_py.py +47 -0
- mindspore/ops_generate/op_def_py/op_def_py_generator.py +132 -0
- mindspore/ops_generate/op_def_py/op_prim_py_generator.py +489 -0
- mindspore/ops_generate/pyboost/__init__.py +0 -0
- mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +139 -0
- mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +93 -0
- mindspore/ops_generate/pyboost/gen_pyboost_func.py +175 -0
- mindspore/ops_generate/pyboost/op_template_parser.py +517 -0
- mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +407 -0
- mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +100 -0
- mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +148 -0
- mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +155 -0
- mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +132 -0
- mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +272 -0
- mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +938 -0
- mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +357 -0
- mindspore/ops_generate/{pyboost_utils.py → pyboost/pyboost_utils.py} +179 -36
- mindspore/ops_generate/resources/__init__.py +0 -0
- mindspore/ops_generate/resources/resource_list.py +30 -0
- mindspore/ops_generate/resources/resource_loader.py +36 -0
- mindspore/ops_generate/resources/resource_manager.py +64 -0
- mindspore/ops_generate/resources/yaml_loader.py +88 -0
- mindspore/ops_generate/tensor_py_cc_generator.py +122 -0
- mindspore/parallel/__init__.py +7 -3
- mindspore/parallel/_auto_parallel_context.py +152 -34
- mindspore/parallel/_cell_wrapper.py +130 -15
- mindspore/parallel/_parallel_serialization.py +107 -5
- mindspore/parallel/_ps_context.py +1 -1
- mindspore/parallel/_recovery_context.py +7 -2
- mindspore/parallel/_tensor.py +142 -18
- mindspore/parallel/_utils.py +199 -23
- mindspore/parallel/algo_parameter_config.py +4 -4
- mindspore/parallel/auto_parallel.py +732 -0
- mindspore/parallel/checkpoint_convert.py +159 -0
- mindspore/parallel/checkpoint_transform.py +698 -35
- mindspore/parallel/cluster/process_entity/_api.py +276 -50
- mindspore/parallel/cluster/process_entity/_utils.py +41 -6
- mindspore/parallel/cluster/run.py +21 -4
- mindspore/parallel/function/__init__.py +24 -0
- mindspore/parallel/function/reshard_func.py +259 -0
- mindspore/parallel/nn/__init__.py +25 -0
- mindspore/parallel/nn/parallel_cell_wrapper.py +263 -0
- mindspore/parallel/nn/parallel_grad_reducer.py +169 -0
- mindspore/parallel/parameter_broadcast.py +25 -14
- mindspore/parallel/shard.py +137 -58
- mindspore/parallel/transform_safetensors.py +363 -305
- mindspore/pgodb140.dll +0 -0
- mindspore/pgort140.dll +0 -0
- mindspore/profiler/__init__.py +22 -5
- mindspore/profiler/analysis/__init__.py +0 -0
- mindspore/profiler/analysis/parser/__init__.py +0 -0
- mindspore/profiler/analysis/parser/ascend_cann_parser.py +170 -0
- mindspore/profiler/analysis/parser/base_parser.py +158 -0
- mindspore/profiler/analysis/parser/framework_cann_relation_parser.py +45 -0
- mindspore/profiler/analysis/parser/ms_framework_parser.py +142 -0
- mindspore/profiler/analysis/parser/ms_minddata_parser.py +145 -0
- mindspore/profiler/analysis/parser/timeline_assembly_factory/__init__.py +0 -0
- mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +264 -0
- mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +40 -0
- mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +106 -0
- mindspore/profiler/analysis/parser/timeline_creator/__init__.py +0 -0
- mindspore/profiler/analysis/parser/timeline_creator/base_timeline_creator.py +44 -0
- mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +90 -0
- mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +76 -0
- mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +103 -0
- mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +134 -0
- mindspore/profiler/analysis/parser/timeline_event/__init__.py +0 -0
- mindspore/profiler/analysis/parser/timeline_event/base_event.py +233 -0
- mindspore/profiler/analysis/parser/timeline_event/cpu_op_event.py +47 -0
- mindspore/profiler/analysis/parser/timeline_event/flow_event.py +36 -0
- mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +415 -0
- mindspore/profiler/analysis/parser/timeline_event/msprof_event.py +73 -0
- mindspore/profiler/analysis/parser/timeline_event/scope_layer_event.py +53 -0
- mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +146 -0
- mindspore/profiler/analysis/task_manager.py +131 -0
- mindspore/profiler/analysis/time_converter.py +84 -0
- mindspore/profiler/analysis/viewer/__init__.py +0 -0
- mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +372 -0
- mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +87 -0
- mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +250 -0
- mindspore/profiler/analysis/viewer/ascend_memory_viewer.py +320 -0
- mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +327 -0
- mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +376 -0
- mindspore/profiler/analysis/viewer/ascend_timeline_viewer.py +58 -0
- mindspore/profiler/analysis/viewer/base_viewer.py +26 -0
- mindspore/profiler/analysis/viewer/ms_dataset_viewer.py +96 -0
- mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +581 -0
- mindspore/profiler/analysis/work_flow.py +73 -0
- mindspore/profiler/common/ascend_msprof_exporter.py +139 -0
- mindspore/profiler/common/command_executor.py +90 -0
- mindspore/profiler/common/constant.py +186 -3
- mindspore/profiler/common/file_manager.py +208 -0
- mindspore/profiler/common/log.py +130 -0
- mindspore/profiler/common/msprof_cmd_tool.py +221 -0
- mindspore/profiler/common/path_manager.py +395 -0
- mindspore/profiler/common/process_bar.py +168 -0
- mindspore/profiler/common/process_pool.py +9 -3
- mindspore/profiler/common/profiler_context.py +500 -0
- mindspore/profiler/common/profiler_info.py +304 -0
- mindspore/profiler/common/profiler_meta_data.py +74 -0
- mindspore/profiler/common/profiler_output_path.py +284 -0
- mindspore/profiler/common/profiler_parameters.py +251 -0
- mindspore/profiler/common/profiler_path_manager.py +179 -0
- mindspore/profiler/common/record_function.py +76 -0
- mindspore/profiler/common/tlv_decoder.py +76 -0
- mindspore/profiler/common/util.py +75 -2
- mindspore/profiler/dynamic_profiler.py +341 -75
- mindspore/profiler/envprofiler.py +163 -0
- mindspore/profiler/experimental_config.py +197 -0
- mindspore/profiler/mstx.py +242 -0
- mindspore/profiler/platform/__init__.py +21 -0
- mindspore/profiler/platform/base_profiler.py +40 -0
- mindspore/profiler/platform/cpu_profiler.py +124 -0
- mindspore/profiler/platform/gpu_profiler.py +74 -0
- mindspore/profiler/platform/npu_profiler.py +335 -0
- mindspore/profiler/profiler.py +1073 -90
- mindspore/profiler/profiler_action_controller.py +187 -0
- mindspore/profiler/profiler_interface.py +118 -0
- mindspore/profiler/schedule.py +243 -0
- mindspore/rewrite/api/node.py +15 -13
- mindspore/rewrite/api/symbol_tree.py +2 -3
- mindspore/run_check/_check_version.py +27 -20
- mindspore/run_check/run_check.py +1 -1
- mindspore/runtime/__init__.py +37 -0
- mindspore/runtime/device.py +27 -0
- mindspore/runtime/event.py +209 -0
- mindspore/runtime/executor.py +177 -0
- mindspore/runtime/memory.py +409 -0
- mindspore/runtime/stream.py +460 -0
- mindspore/runtime/thread_bind_core.py +401 -0
- mindspore/safeguard/rewrite_obfuscation.py +12 -9
- mindspore/swresample-4.dll +0 -0
- mindspore/swscale-6.dll +0 -0
- mindspore/tbbmalloc.dll +0 -0
- mindspore/tinyxml2.dll +0 -0
- mindspore/train/__init__.py +8 -8
- mindspore/train/_utils.py +88 -25
- mindspore/train/amp.py +9 -5
- mindspore/train/callback/__init__.py +2 -2
- mindspore/train/callback/_callback.py +2 -16
- mindspore/train/callback/_checkpoint.py +53 -55
- mindspore/train/callback/_cluster_monitor.py +14 -18
- mindspore/train/callback/_early_stop.py +1 -1
- mindspore/train/callback/_flops_collector.py +103 -68
- mindspore/train/callback/_history.py +8 -5
- mindspore/train/callback/_lambda_callback.py +2 -2
- mindspore/train/callback/_landscape.py +0 -3
- mindspore/train/callback/_loss_monitor.py +2 -1
- mindspore/train/callback/_on_request_exit.py +6 -5
- mindspore/train/callback/_reduce_lr_on_plateau.py +11 -6
- mindspore/train/callback/_summary_collector.py +52 -19
- mindspore/train/callback/_time_monitor.py +2 -1
- mindspore/train/callback/{_tft_register.py → _train_fault_tolerance.py} +204 -107
- mindspore/train/data_sink.py +25 -2
- mindspore/train/dataset_helper.py +15 -16
- mindspore/train/loss_scale_manager.py +8 -7
- mindspore/train/metrics/accuracy.py +3 -3
- mindspore/train/metrics/confusion_matrix.py +9 -9
- mindspore/train/metrics/error.py +3 -3
- mindspore/train/metrics/hausdorff_distance.py +4 -4
- mindspore/train/metrics/mean_surface_distance.py +3 -3
- mindspore/train/metrics/metric.py +0 -12
- mindspore/train/metrics/occlusion_sensitivity.py +4 -2
- mindspore/train/metrics/precision.py +11 -10
- mindspore/train/metrics/recall.py +9 -9
- mindspore/train/metrics/root_mean_square_surface_distance.py +2 -2
- mindspore/train/mind_ir_pb2.py +174 -46
- mindspore/train/model.py +184 -113
- mindspore/train/serialization.py +622 -978
- mindspore/train/summary/_summary_adapter.py +2 -2
- mindspore/train/summary/summary_record.py +2 -3
- mindspore/train/train_thor/model_thor.py +1 -1
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/__init__.py +6 -3
- mindspore/utils/dryrun.py +140 -0
- mindspore/utils/hooks.py +81 -0
- mindspore/utils/runtime_execution_order_check.py +550 -0
- mindspore/utils/utils.py +138 -4
- mindspore/vcmeta.dll +0 -0
- mindspore/vcruntime140.dll +0 -0
- mindspore/vcruntime140_1.dll +0 -0
- mindspore/version.py +1 -1
- {mindspore-2.4.10.dist-info → mindspore-2.6.0rc1.dist-info}/METADATA +3 -3
- {mindspore-2.4.10.dist-info → mindspore-2.6.0rc1.dist-info}/RECORD +587 -418
- {mindspore-2.4.10.dist-info → mindspore-2.6.0rc1.dist-info}/entry_points.txt +1 -1
- mindspore/_install_custom.py +0 -43
- mindspore/common/_register_for_adapter.py +0 -74
- mindspore/common/_tensor_overload.py +0 -139
- mindspore/mindspore_np_dtype.dll +0 -0
- mindspore/ops/auto_generate/gen_arg_dtype_cast.py +0 -252
- mindspore/ops/auto_generate/gen_arg_handler.py +0 -197
- mindspore/ops/operations/_opaque_predicate_registry.py +0 -41
- mindspore/ops_generate/gen_aclnn_implement.py +0 -263
- mindspore/ops_generate/gen_ops_inner_prim.py +0 -131
- mindspore/ops_generate/gen_pyboost_func.py +0 -1052
- mindspore/ops_generate/gen_utils.py +0 -209
- mindspore/ops_generate/op_proto.py +0 -145
- mindspore/ops_generate/template.py +0 -261
- mindspore/profiler/envprofiling.py +0 -254
- mindspore/profiler/profiling.py +0 -1926
- {mindspore-2.4.10.dist-info → mindspore-2.6.0rc1.dist-info}/WHEEL +0 -0
- {mindspore-2.4.10.dist-info → mindspore-2.6.0rc1.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"
|
|
257
|
+
The execution order mode, support "bfs", "dfs".
|
|
258
258
|
"""
|
|
259
|
-
exec_order_modes = ["bfs", "dfs"
|
|
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):
|
|
334
|
-
|
|
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':
|
|
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', "
|
|
@@ -909,12 +963,8 @@ def set_auto_parallel_context(**kwargs):
|
|
|
909
963
|
Set auto parallel context, only data parallel supported on CPU.
|
|
910
964
|
|
|
911
965
|
Note:
|
|
912
|
-
|
|
913
|
-
|
|
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.
|
|
966
|
+
Global parallel configuration. This interface will be deprecated in future versions, please use
|
|
967
|
+
the api :class:`mindspore.parallel.auto_parallel.AutoParallel` instead.
|
|
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):
|
|
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
|
|
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)
|
|
@@ -1131,6 +1203,9 @@ def get_auto_parallel_context(attr_key):
|
|
|
1131
1203
|
"""
|
|
1132
1204
|
Get auto parallel context attribute value according to the key.
|
|
1133
1205
|
|
|
1206
|
+
Note:
|
|
1207
|
+
This interface will be deprecated in future versions.
|
|
1208
|
+
|
|
1134
1209
|
Args:
|
|
1135
1210
|
attr_key (str): The key of the attribute.
|
|
1136
1211
|
|
|
@@ -1150,7 +1225,8 @@ def get_auto_parallel_context(attr_key):
|
|
|
1150
1225
|
|
|
1151
1226
|
def reset_auto_parallel_context():
|
|
1152
1227
|
"""
|
|
1153
|
-
Reset auto parallel context attributes to the default values.
|
|
1228
|
+
Reset auto parallel context attributes to the default values. This interface will be deprecated in future
|
|
1229
|
+
versions, please use the api :class:`mindspore.parallel.auto_parallel.AutoParallel` instead.
|
|
1154
1230
|
|
|
1155
1231
|
- device_num: 1.
|
|
1156
1232
|
- global_rank: 0.
|
|
@@ -1171,6 +1247,7 @@ def reset_auto_parallel_context():
|
|
|
1171
1247
|
- fusion_threshold: 64.
|
|
1172
1248
|
- auto_pipeline: False.
|
|
1173
1249
|
- dump_local_norm: False.
|
|
1250
|
+
- dump_local_norm_path: ''.
|
|
1174
1251
|
- dump_device_local_norm: False.
|
|
1175
1252
|
|
|
1176
1253
|
Examples:
|
|
@@ -1184,7 +1261,8 @@ def reset_auto_parallel_context():
|
|
|
1184
1261
|
@args_type_check(offload_config=dict)
|
|
1185
1262
|
def set_offload_context(offload_config):
|
|
1186
1263
|
r"""
|
|
1187
|
-
Configure heterogeneous training detailed parameters to adjust the offload strategy.
|
|
1264
|
+
Configure heterogeneous training detailed parameters to adjust the offload strategy. This function is deprecated and
|
|
1265
|
+
will be removed in future versions.
|
|
1188
1266
|
|
|
1189
1267
|
Note:
|
|
1190
1268
|
The offload configuration is only used if the memory offload feature is enabled
|
|
@@ -1225,7 +1303,8 @@ def set_offload_context(offload_config):
|
|
|
1225
1303
|
def get_offload_context():
|
|
1226
1304
|
"""
|
|
1227
1305
|
Gets the offload configuration parameters. Configure through interface mindspore.set_offload_context().
|
|
1228
|
-
If the user is not set, the default configuration is obtained.
|
|
1306
|
+
If the user is not set, the default configuration is obtained. This function is deprecated and will be removed in
|
|
1307
|
+
future versions.
|
|
1229
1308
|
|
|
1230
1309
|
Returns:
|
|
1231
1310
|
Dict, heterogeneous training offload detailed configuration parameters.
|
|
@@ -1240,8 +1319,6 @@ def get_offload_context():
|
|
|
1240
1319
|
def _check_target_specific_cfgs(device, arg_key):
|
|
1241
1320
|
"""Checking whether a config is suitable for a specified device"""
|
|
1242
1321
|
device_cfgs = {
|
|
1243
|
-
'enable_graph_kernel': ['Ascend', 'GPU', 'CPU'],
|
|
1244
|
-
'graph_kernel_flags': ['Ascend', 'GPU', 'CPU'],
|
|
1245
1322
|
'enable_reduce_precision': ['Ascend'],
|
|
1246
1323
|
'print_file_path': ['Ascend'],
|
|
1247
1324
|
'variable_memory_max_size': ['Ascend'],
|
|
@@ -1266,7 +1343,7 @@ def _check_target_specific_cfgs(device, arg_key):
|
|
|
1266
1343
|
def _check_ascend_device_context_initialized(device_target, settings):
|
|
1267
1344
|
if device_target == 'Ascend' and is_initialized(device_target):
|
|
1268
1345
|
for key, _ in settings.items():
|
|
1269
|
-
if key in ('ascend_config', 'deterministic', 'jit_compile', '
|
|
1346
|
+
if key in ('ascend_config', 'deterministic', 'jit_compile', 'device_id'):
|
|
1270
1347
|
logger.warning(f"For 'context.set_context' in Ascend backend, the backend is already initialized, "
|
|
1271
1348
|
"please set it before the definition of any Tensor and Parameter, and the "
|
|
1272
1349
|
"instantiation and execution of any operation and net, otherwise the settings may not "
|
|
@@ -1280,9 +1357,64 @@ def _check_key(key):
|
|
|
1280
1357
|
raise ValueError(f"Please set '{key}' through parameter ascend_config")
|
|
1281
1358
|
|
|
1282
1359
|
|
|
1360
|
+
def _check_context_deprecated(key):
|
|
1361
|
+
"""Checking whether a context key will be deprecated."""
|
|
1362
|
+
deprecated_context_dict = {'save_graphs': 'env MS_DEV_SAVE_GRAPHS',
|
|
1363
|
+
'save_graphs_path': 'env MS_DEV_SAVE_GRAPHS_PATH',
|
|
1364
|
+
'precompile_only': 'env MS_DEV_PRECOMPILE_ONLY',
|
|
1365
|
+
'check_bprop': '',
|
|
1366
|
+
'max_call_depth': 'api mindspore.set_recursion_limit()',
|
|
1367
|
+
'grad_for_scalar': 'tensor derivative',
|
|
1368
|
+
'enable_compile_cache': 'env MS_COMPILER_CACHE_ENABLE',
|
|
1369
|
+
'enable_cache_path': 'env MS_COMPILER_CACHE_PATH',
|
|
1370
|
+
'debug_level': '',
|
|
1371
|
+
'device_target': 'api mindspore.set_device()',
|
|
1372
|
+
'device_id': 'api mindspore.set_device()',
|
|
1373
|
+
'deterministic': 'api mindspore.set_deterministic()',
|
|
1374
|
+
'inter_op_parallel_num': 'api mindspore.runtime.dispatch_threads_num()',
|
|
1375
|
+
'pynative_synchronize': 'api mindspore.runtime.launch_blocking()',
|
|
1376
|
+
'max_device_memory': 'api mindspore.runtime.set_memory()',
|
|
1377
|
+
'variable_memory_max_size': 'api mindspore.runtime.set_memory()',
|
|
1378
|
+
'mempool_block_size': 'api mindspore.runtime.set_memory()',
|
|
1379
|
+
'memory_optimize_level': 'api mindspore.runtime.set_memory()',
|
|
1380
|
+
'ascend_config': '''api mindspore.device_context.ascend.op_precision.precision_mode(),
|
|
1381
|
+
mindspore.device_context.ascend.op_precision.op_precision_mode(),
|
|
1382
|
+
mindspore.device_context.ascend.op_precision.matmul_allow_hf32(),
|
|
1383
|
+
mindspore.device_context.ascend.op_precision.conv_allow_hf32(),
|
|
1384
|
+
mindspore.device_context.ascend.op_tuning.op_compile()''',
|
|
1385
|
+
'aoe_tune_mode': 'api mindspore.device_context.ascend.op_tuning.aoe_tune_mode()',
|
|
1386
|
+
'aoe_config': 'api mindspore.device_context.ascend.op_tuning.aoe_job_type()',
|
|
1387
|
+
'op_timeout': 'api mindspore.device_context.ascend.op_debug.execute_timeout()',
|
|
1388
|
+
'op_debug_option': 'api mindspore.device_context.ascend.op_debug.debug_option()',
|
|
1389
|
+
'gpu_config': '''api mindspore.device_context.gpu.op_precision.conv_allow_tf32(),
|
|
1390
|
+
mindspore.device_context.gpu.op_precision.matmul_allow_tf32(),
|
|
1391
|
+
mindspore.device_context.gpu.op_precision.conv_fprop_algo(),
|
|
1392
|
+
mindspore.device_context.gpu.op_precision.conv_wgrad_algo(),
|
|
1393
|
+
mindspore.device_context.gpu.op_precision.conv_dgrad_algo()''',
|
|
1394
|
+
'runtime_num_threads': 'api mindspore.device_context.cpu.op_tuning.threads_num()',
|
|
1395
|
+
'memory_offload': "`device` parameter of `mindspore.Parameter`"}
|
|
1396
|
+
invalid_context_dict = {
|
|
1397
|
+
'exception_dump': {'version': '2.6', 'interface': 'device_context.ascend.op_debug.aclinit_config()'}
|
|
1398
|
+
}
|
|
1399
|
+
if key in deprecated_context_dict:
|
|
1400
|
+
log = f"For 'context.set_context', the parameter '{key}' will be deprecated and removed in a future version."
|
|
1401
|
+
if deprecated_context_dict.get(key) != '':
|
|
1402
|
+
log += f" Please use the {deprecated_context_dict.get(key)} instead."
|
|
1403
|
+
logger.warning(log)
|
|
1404
|
+
if key in invalid_context_dict:
|
|
1405
|
+
info = invalid_context_dict.get(key)
|
|
1406
|
+
deprecated_version, new_interface = info.get('version'), info.get('interface')
|
|
1407
|
+
log = (
|
|
1408
|
+
f"For 'context.set_context', the parameter '{key}' has been removed"
|
|
1409
|
+
f" since MindSpore {deprecated_version} version."
|
|
1410
|
+
)
|
|
1411
|
+
if new_interface:
|
|
1412
|
+
log += f" Please use the {new_interface} instead."
|
|
1413
|
+
raise ValueError(log)
|
|
1414
|
+
|
|
1283
1415
|
@args_type_check(mode=int, precompile_only=bool, device_target=str, device_id=int, save_graphs=(bool, int),
|
|
1284
|
-
save_graphs_path=str,
|
|
1285
|
-
|
|
1416
|
+
save_graphs_path=str, aoe_tune_mode=str, aoe_config=dict,
|
|
1417
|
+
enable_reduce_precision=bool, variable_memory_max_size=str,
|
|
1286
1418
|
enable_auto_mixed_precision=bool, inter_op_parallel_num=int,
|
|
1287
1419
|
enable_graph_kernel=bool, reserve_class_name_in_scope=bool, check_bprop=bool,
|
|
1288
1420
|
max_device_memory=str, print_file_path=str, max_call_depth=int, env_config_path=str,
|
|
@@ -1291,542 +1423,142 @@ def _check_key(key):
|
|
|
1291
1423
|
op_timeout=int, deterministic=str, ascend_config=dict, jit_syntax_level=int, debug_level=int,
|
|
1292
1424
|
jit_enable_inplace_ops=bool, gpu_config=dict, jit_config=dict, enable_compile_cache=bool)
|
|
1293
1425
|
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
|
-
+-------------------------+------------------------------+----------------------------+
|
|
1426
|
+
r"""
|
|
1427
|
+
Set context for running environment, this interface will be deprecated in future versions, and its
|
|
1428
|
+
parameter-related functionalities will be provided through new APIs.
|
|
1388
1429
|
|
|
1389
1430
|
Args:
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
Please use
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
Default
|
|
1411
|
-
|
|
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
|
-
|
|
1431
|
+
mode (int): GRAPH_MODE(0) or PYNATIVE_MODE(1). Default ``PYNATIVE_MODE`` .
|
|
1432
|
+
device_id (int): ID of the target device. Default ``0`` . This parameter will be deprecated
|
|
1433
|
+
and removed in future versions. Please use the api :func:`mindspore.set_device` instead.
|
|
1434
|
+
device_target (str): The target device to run, support ``"Ascend"``, ``"GPU"``, and ``"CPU"``. This parameter
|
|
1435
|
+
will be deprecated and removed in future versions. Please use the api :func:`mindspore.set_device` instead.
|
|
1436
|
+
deterministic (str): Deterministic computation of operators. Default ``"OFF"`` .
|
|
1437
|
+
This parameter will be deprecated and removed in future versions. Please use the api
|
|
1438
|
+
:func:`mindspore.set_deterministic` instead.
|
|
1439
|
+
max_call_depth (int): The maximum depth of function call. Default ``1000`` .
|
|
1440
|
+
This parameter will be deprecated and removed in a future version. Please use the api
|
|
1441
|
+
:func:`mindspore.set_recursion_limit` instead.
|
|
1442
|
+
variable_memory_max_size (str): This parameter will be deprecated and removed in future versions.
|
|
1443
|
+
Please use the api :func:`mindspore.runtime.set_memory` instead.
|
|
1444
|
+
mempool_block_size (str): Set the size of the memory pool block for devices. Default ``"1GB"`` .
|
|
1445
|
+
This parameter will be deprecated and removed in future versions. Please use
|
|
1446
|
+
the api :func:`mindspore.runtime.set_memory` instead.
|
|
1447
|
+
memory_optimize_level (str): The memory optimize level. Default ``"O0"``.
|
|
1448
|
+
This parameter will be deprecated and removed in future versions. Please use
|
|
1449
|
+
the api :func:`mindspore.runtime.set_memory` instead.
|
|
1450
|
+
max_device_memory (str): Set the maximum memory available for devices.
|
|
1451
|
+
Default ``"1024GB"`` . This parameter will be deprecated and removed in future versions. Please use
|
|
1452
|
+
the api :func:`mindspore.runtime.set_memory` instead.
|
|
1476
1453
|
pynative_synchronize (bool): Whether to enable synchronous execution of the device in PyNative mode.
|
|
1477
|
-
Default
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
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.
|
|
1454
|
+
Default ``False`` . This parameter will be deprecated and removed in future versions.Please use
|
|
1455
|
+
the api :func:`mindspore.runtime.launch_blocking` instead.
|
|
1456
|
+
compile_cache_path (str): Path to save the compile cache. Default ``"."``.
|
|
1457
|
+
This parameter will be deprecated and removed in a future version. Please use the environment variable
|
|
1458
|
+
`MS_COMPILER_CACHE_PATH` instead.
|
|
1459
|
+
inter_op_parallel_num(int): The thread number of op parallel at the same time.
|
|
1460
|
+
Default ``0`` . This parameter will be deprecated and removed in future versions.
|
|
1461
|
+
Please use the api :func:`mindspore.runtime.dispatch_threads_num` instead.
|
|
1462
|
+
memory_offload (str): Whether to enable the memory offload function. Default ``"OFF"`` .
|
|
1463
|
+
This parameter will be deprecated and removed in future versions. Please use the api
|
|
1464
|
+
:func:`mindspore.nn.Cell.offload` instead.
|
|
1465
|
+
disable_format_transform (bool): Whether to disable the automatic format transform function from NCHW
|
|
1466
|
+
to NHWC. Default ``False`` . This parameter will be deprecated and removed in future versions. Please
|
|
1467
|
+
use the related parameter of :func:`mindspore.jit` instead.
|
|
1468
|
+
jit_syntax_level (int): Set JIT syntax support level. Default ``LAX`` . This parameter is deprecated
|
|
1469
|
+
and removed in future versions. Please use the related parameter of :func:`mindspore.jit` instead.
|
|
1470
|
+
jit_config (dict): Set the global jit config for compile. This parameter is deprecated
|
|
1471
|
+
and removed in future versions. Please use the related parameter of :func:`mindspore.jit` instead.
|
|
1472
|
+
exec_order (str): The sorting method for operator execution. This parameter is deprecated
|
|
1473
|
+
and removed in future versions. Please use the related parameter of :func:`mindspore.jit` instead.
|
|
1474
|
+
op_timeout (int): Set the maximum duration of executing an operator in seconds. Default ``900`` .
|
|
1475
|
+
This parameter will be deprecated and removed in future versions. Please use the
|
|
1476
|
+
api :func:`mindspore.device_context.ascend.op_debug.execute_timeout` instead.
|
|
1477
|
+
aoe_tune_mode (str): AOE tuning mode.
|
|
1478
|
+
This parameter will be deprecated and removed in future versions. Please use the
|
|
1479
|
+
api :func:`mindspore.device_context.ascend.op_tuning.aoe_tune_mode` instead.
|
|
1480
|
+
aoe_config (dict): AOE-specific parameters. This parameter will be deprecated and removed in future
|
|
1481
|
+
versions. Please use the api :func:`mindspore.device_context.ascend.op_tuning.aoe_job_type` instead.
|
|
1482
|
+
runtime_num_threads(int): The thread pool number of cpu kernel used in runtime. Default ``30`` .
|
|
1483
|
+
This parameter will be deprecated and removed in future versions. Please use the
|
|
1484
|
+
api :func:`mindspore.device_context.cpu.op_tuning.threads_num` instead.
|
|
1485
|
+
save_graphs (bool or int): Whether to save intermediate compilation graphs. Default ``0`` .
|
|
1486
|
+
This parameter will be deprecated and removed in a future version. Please use the environment variable
|
|
1487
|
+
`MS_DEV_SAVE_GRAPHS` instead.
|
|
1488
|
+
save_graphs_path (str): Path to save graphs. Default ``"."``.
|
|
1489
|
+
This parameter will be deprecated and removed in a future version. Please use the environment variable
|
|
1490
|
+
`MS_DEV_SAVE_GRAPHS_PATH` instead.
|
|
1491
|
+
precompile_only (bool): Whether to only precompile the network. Default ``False`` .
|
|
1492
|
+
This parameter will be deprecated and removed in a future version. Please use the environment variable
|
|
1493
|
+
`MS_DEV_PRECOMPILE_ONLY` instead.
|
|
1494
|
+
enable_compile_cache (bool): Whether to save or load the compiled cache of the graph.
|
|
1495
|
+
Default ``False`` . This is an experimental prototype that is subject to change and/or deletion.
|
|
1496
|
+
This parameter will be deprecated and removed in a future version. Please use the environment variable
|
|
1497
|
+
`MS_COMPILER_CACHE_ENABLE` instead.
|
|
1498
|
+
ascend_config (dict): Set the parameters specific to Ascend hardware platform.
|
|
1499
|
+
|
|
1500
|
+
- precision_mode (str): Mixed precision mode setting. Default ``"force_fp16"`` .
|
|
1501
|
+
This parameter will be deprecated and removed in future versions. Please use the
|
|
1502
|
+
api :func:`mindspore.device_context.ascend.op_precision.precision_mode` instead.
|
|
1503
|
+
- jit_compile (bool): Whether to select online compilation. This parameter will be deprecated and removed
|
|
1504
|
+
in future versions. Please use the api :func:`mindspore.device_context.ascend.op_tuning.op_compile`
|
|
1505
|
+
instead.
|
|
1506
|
+
- matmul_allow_hf32 (bool): Whether to convert FP32 to HF32 for Matmul operators. Default ``False``.
|
|
1507
|
+
This parameter will be deprecated and removed in future versions. Please use the
|
|
1508
|
+
api :func:`mindspore.device_context.ascend.op_precision.matmul_allow_hf32` instead.
|
|
1509
|
+
- conv_allow_hf32 (bool): Whether to convert FP32 to HF32 for Conv operators. Default ``True``.
|
|
1510
|
+
This parameter will be deprecated and removed in future versions. Please use the
|
|
1511
|
+
api :func:`mindspore.device_context.ascend.op_precision.conv_allow_hf32` instead.
|
|
1512
|
+
- op_precision_mode (str): Path to config file of op precision mode.
|
|
1513
|
+
This parameter will be deprecated and removed in future versions. Please use the
|
|
1514
|
+
api :func:`mindspore.device_context.ascend.op_precision.op_precision_mode` instead.
|
|
1515
|
+
- op_debug_option (str): Enable debugging options for Ascend operators.
|
|
1516
|
+
This parameter will be deprecated and removed in future versions. Please use the
|
|
1517
|
+
api :func:`mindspore.device_context.ascend.op_debug.debug_option` instead.
|
|
1518
|
+
- ge_options (dict): Set options for CANN. This parameter will be deprecated and removed in future versions.
|
|
1519
|
+
Please use the related parameter of :func:`mindspore.jit` instead.
|
|
1614
1520
|
- atomic_clean_policy (int): The policy for cleaning memory occupied by atomic operators in the network.
|
|
1615
|
-
Default
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
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``.
|
|
1521
|
+
Default ``1`` represents that memory is not cleaned centrally, ``0`` represents that memory is cleaned
|
|
1522
|
+
centrally. This parameter will be deprecated and removed in future versions. Please
|
|
1523
|
+
use the related parameter of :func:`mindspore.jit` instead.
|
|
1524
|
+
- exception_dump (str): Enable Ascend operator exception dump. Default ``"2"`` . This parameter has been
|
|
1525
|
+
deprecated and removed. Please use the api
|
|
1526
|
+
:func:`mindspore.device_context.ascend.op_debug.aclinit_config` instead.
|
|
1703
1527
|
- host_scheduling_max_threshold(int): The max threshold to control whether the dynamic shape process is
|
|
1704
|
-
used when run the static graph
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
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
|
-
|
|
1528
|
+
used when run the static graph. Default ``0`` . This parameter will be deprecated and removed in future
|
|
1529
|
+
versions. Please use the related parameter of :func:`mindspore.jit` instead.
|
|
1530
|
+
- parallel_speed_up_json_path(Union[str, None]): The path to the parallel speed up json file.
|
|
1531
|
+
This parameter will be deprecated and removed in future versions. Please use the
|
|
1532
|
+
api :func:`mindspore.parallel.auto_parallel.AutoParallel.transformer_opt` instead.
|
|
1533
|
+
- hccl_watchdog (bool): Enable a thread to monitor the failure of collective communication.
|
|
1534
|
+
Default ``True`` .
|
|
1724
1535
|
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
1536
|
|
|
1828
|
-
|
|
1829
|
-
|
|
1537
|
+
- conv_fprop_algo (str): Specifies convolution forward algorithm. Default ``"normal"`` .
|
|
1538
|
+
This parameter will be deprecated and removed in future versions. Please use the
|
|
1539
|
+
api :func:`mindspore.device_context.gpu.op_tuning.conv_fprop_algo` instead.
|
|
1540
|
+
- conv_dgrad_algo (str): Specifies convolution data grad algorithm. Default ``"normal"`` .
|
|
1541
|
+
This parameter will be deprecated and removed in future versions. Please use the
|
|
1542
|
+
api :func:`mindspore.device_context.gpu.op_tuning.conv_dgrad_algo` instead.
|
|
1543
|
+
- conv_wgrad_algo (str): Specifies convolution filter grad algorithm. Default ``"normal"`` .
|
|
1544
|
+
This parameter will be deprecated and removed in future versions. Please use the
|
|
1545
|
+
api :func:`mindspore.device_context.gpu.op_tuning.conv_wgrad_algo` instead.
|
|
1546
|
+
- conv_allow_tf32 (bool): Controls to allow Tensor core TF32 computation on CUDNN.
|
|
1547
|
+
Default ``True``.
|
|
1548
|
+
This parameter will be deprecated and removed in future versions. Please use the
|
|
1549
|
+
api :func:`mindspore.device_context.gpu.op_precision.conv_allow_tf32` instead.
|
|
1550
|
+
- matmul_allow_tf32 (bool): Controls to allow Tensor core TF32 computation on CUBLAS.
|
|
1551
|
+
Default ``False``.
|
|
1552
|
+
This parameter will be deprecated and removed in future versions. Please use the
|
|
1553
|
+
api :func:`mindspore.device_context.gpu.op_precision.matmul_allow_tf32` instead.
|
|
1554
|
+
print_file_path (str): This parameter will be deprecated and removed in future versions.
|
|
1555
|
+
env_config_path (str): This parameter will be deprecated and removed in future versions.
|
|
1556
|
+
debug_level (int): This parameter will be deprecated and removed in future versions.
|
|
1557
|
+
reserve_class_name_in_scope (bool): This parameter will be deprecated and removed in future versions.
|
|
1558
|
+
check_bprop (bool): This parameter will be deprecated and removed in future versions.
|
|
1559
|
+
enable_reduce_precision (bool): This parameter will be deprecated and removed in a future versions.
|
|
1560
|
+
grad_for_scalar (bool): This parameter will be deprecated and removed in future versions.
|
|
1561
|
+
support_binary (bool): Whether to support run .pyc or .so in graph mode.
|
|
1830
1562
|
|
|
1831
1563
|
Examples:
|
|
1832
1564
|
>>> import mindspore as ms
|
|
@@ -1836,8 +1568,6 @@ def set_context(**kwargs):
|
|
|
1836
1568
|
>>> ms.set_context(device_id=0)
|
|
1837
1569
|
>>> ms.set_context(save_graphs=True, save_graphs_path="./model.ms")
|
|
1838
1570
|
>>> 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
1571
|
>>> ms.set_context(reserve_class_name_in_scope=True)
|
|
1842
1572
|
>>> ms.set_context(variable_memory_max_size="6GB")
|
|
1843
1573
|
>>> ms.set_context(aoe_tune_mode="online")
|
|
@@ -1867,7 +1597,7 @@ def set_context(**kwargs):
|
|
|
1867
1597
|
>>> ms.set_context(gpu_config={"conv_fprop_algo": "performance", "conv_allow_tf32": True,
|
|
1868
1598
|
... "matmul_allow_tf32": True})
|
|
1869
1599
|
>>> ms.set_context(jit_config={"jit_level": "O0"})
|
|
1870
|
-
>>> ms.set_context(exec_order="
|
|
1600
|
+
>>> ms.set_context(exec_order="bfs")
|
|
1871
1601
|
"""
|
|
1872
1602
|
ctx = _context()
|
|
1873
1603
|
# set device target first
|
|
@@ -1877,14 +1607,22 @@ def set_context(**kwargs):
|
|
|
1877
1607
|
_check_ascend_device_context_initialized(device, kwargs)
|
|
1878
1608
|
|
|
1879
1609
|
for key, value in kwargs.items():
|
|
1610
|
+
_check_context_deprecated(key)
|
|
1880
1611
|
if key in ('enable_sparse', 'auto_tune_mode'):
|
|
1881
1612
|
logger.warning(f"For 'context.set_context', '{key}' parameter is deprecated, "
|
|
1882
1613
|
"and will be removed in the next version.")
|
|
1883
1614
|
continue
|
|
1884
|
-
if key in ('enable_auto_mixed_precision',
|
|
1615
|
+
if key in ('enable_auto_mixed_precision',):
|
|
1885
1616
|
logger.warning(f"For 'context.set_context', '{key}' parameter is deprecated. "
|
|
1886
1617
|
"For details, please see the interface parameter API comments")
|
|
1887
1618
|
continue
|
|
1619
|
+
if key == "print_file_path":
|
|
1620
|
+
logger.warning(f"For 'context.set_context', '{key}' parameter is deprecated due to changes in the behavior"
|
|
1621
|
+
f" of the print operator. Recommend not using this parameter and"
|
|
1622
|
+
f" directly viewing the screen output.")
|
|
1623
|
+
if key in ('reserve_class_name_in_scope', 'env_config_path'):
|
|
1624
|
+
logger.warning(f"For 'context.set_context', '{key}' parameter is deprecated, "
|
|
1625
|
+
"and will be removed in the next version.")
|
|
1888
1626
|
_check_key(key)
|
|
1889
1627
|
if key == 'save_graphs':
|
|
1890
1628
|
if value is True:
|
|
@@ -1903,6 +1641,14 @@ def set_context(**kwargs):
|
|
|
1903
1641
|
setattr(ctx, key, value)
|
|
1904
1642
|
ctx.set_param(ms_ctx_param.__members__[key], int(value))
|
|
1905
1643
|
continue
|
|
1644
|
+
if key == 'enable_graph_kernel':
|
|
1645
|
+
logger.warning(f"For 'context.set_context', '{key}' parameter is deprecated, "
|
|
1646
|
+
"and will be removed in the next version. "
|
|
1647
|
+
"Please use jit_config={'jit_level': 'O1'} instead.")
|
|
1648
|
+
if key == 'graph_kernel_flags':
|
|
1649
|
+
logger.warning(f"For 'context.set_context', '{key}' parameter is deprecated, "
|
|
1650
|
+
"and will be removed in the next version. "
|
|
1651
|
+
"Please use environ variable 'MS_DEV_GRAPH_KERNEL_FLAGS' instead.")
|
|
1906
1652
|
if not _check_target_specific_cfgs(device, key):
|
|
1907
1653
|
continue
|
|
1908
1654
|
if key in ctx.setters:
|
|
@@ -1920,6 +1666,7 @@ def set_context(**kwargs):
|
|
|
1920
1666
|
|
|
1921
1667
|
|
|
1922
1668
|
def get_context(attr_key):
|
|
1669
|
+
|
|
1923
1670
|
"""
|
|
1924
1671
|
Get context attribute value according to the input key.
|
|
1925
1672
|
If some attributes are not set, they will be automatically obtained.
|
|
@@ -2019,7 +1766,7 @@ def set_ps_context(**kwargs):
|
|
|
2019
1766
|
enable_ps (bool): Whether to enable parameter server training mode.
|
|
2020
1767
|
Only after enable_ps is set True, the environment variables will be effective.
|
|
2021
1768
|
Default: ``False`` .
|
|
2022
|
-
config_file_path (
|
|
1769
|
+
config_file_path (str): Configuration file path used by recovery, parameter server training mode only
|
|
2023
1770
|
supports Server disaster recovery currently. Default: ``''`` .
|
|
2024
1771
|
scheduler_manage_port (int): Scheduler manage port used to scale out/in. Default: ``11202`` .
|
|
2025
1772
|
enable_ssl (bool): Set PS SSL mode enabled or disabled. Default: ``False`` .
|
|
@@ -2043,14 +1790,15 @@ def get_ps_context(attr_key):
|
|
|
2043
1790
|
Args:
|
|
2044
1791
|
attr_key (str): The key of the attribute:
|
|
2045
1792
|
|
|
2046
|
-
- enable_ps (bool): Whether to enable parameter server training mode. Default: ``False`` .
|
|
2047
|
-
- config_file_path (
|
|
1793
|
+
- enable_ps (bool, optional): Whether to enable parameter server training mode. Default: ``False`` .
|
|
1794
|
+
- config_file_path (str, optional): Configuration file path used by recovery,
|
|
1795
|
+
parameter server training mode only
|
|
2048
1796
|
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.
|
|
1797
|
+
- scheduler_manage_port (int, optional): Scheduler manage port used to scale out/in. Default: ``11202`` .
|
|
1798
|
+
- enable_ssl (bool, optional): Set PS SSL mode enabled or disabled. Default: ``False`` .
|
|
1799
|
+
- client_password (str, optional): Password to decrypt the secret key stored in the client certificate.
|
|
2052
1800
|
Default: ``''`` .
|
|
2053
|
-
- server_password (str): Password to decrypt the secret key stored in the server certificate.
|
|
1801
|
+
- server_password (str, optional): Password to decrypt the secret key stored in the server certificate.
|
|
2054
1802
|
Default: ``''`` .
|
|
2055
1803
|
|
|
2056
1804
|
Returns:
|