mindspore 2.6.0__cp311-cp311-win_amd64.whl → 2.7.0rc1__cp311-cp311-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mindspore might be problematic. Click here for more details.
- mindspore/.commit_id +1 -1
- mindspore/Microsoft.VisualStudio.Telemetry.dll +0 -0
- mindspore/Newtonsoft.Json.dll +0 -0
- mindspore/__init__.py +1 -1
- mindspore/_c_dataengine.cp311-win_amd64.pyd +0 -0
- mindspore/_c_expression.cp311-win_amd64.pyd +0 -0
- mindspore/_c_mindrecord.cp311-win_amd64.pyd +0 -0
- mindspore/_checkparam.py +40 -9
- mindspore/{_deprecated → _extends/optimize}/__init__.py +9 -3
- mindspore/_extends/optimize/cell_utils.py +96 -0
- mindspore/_extends/parse/__init__.py +2 -2
- mindspore/_extends/parse/compile_config.py +44 -22
- mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +1 -1
- mindspore/_extends/parse/parser.py +36 -61
- mindspore/_extends/parse/resources.py +39 -0
- mindspore/_extends/parse/standard_method.py +32 -13
- mindspore/_extends/parse/trope.py +8 -1
- mindspore/_extends/pijit/__init__.py +1 -2
- mindspore/amp.py +4 -4
- 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/adasum.py +1 -1
- mindspore/boost/boost_cell_wrapper.py +4 -4
- mindspore/c1.dll +0 -0
- mindspore/c1xx.dll +0 -0
- mindspore/c2.dll +0 -0
- mindspore/common/__init__.py +27 -2
- mindspore/common/_grad_function.py +2 -1
- mindspore/common/_pijit_context.py +28 -7
- mindspore/common/_stub_tensor.py +1 -209
- mindspore/common/_tensor_cpp_method.py +1 -1
- mindspore/common/_tensor_docs.py +76 -15
- mindspore/common/api.py +193 -112
- mindspore/common/dtype.py +21 -11
- mindspore/common/dump.py +10 -15
- mindspore/common/generator.py +2 -3
- mindspore/common/hook_handle.py +11 -2
- mindspore/common/jit_config.py +1 -1
- mindspore/common/jit_trace.py +84 -105
- mindspore/common/parameter.py +26 -12
- mindspore/common/recompute.py +3 -3
- mindspore/common/sparse_tensor.py +0 -3
- mindspore/common/symbol.py +0 -1
- mindspore/common/tensor.py +48 -83
- mindspore/communication/_comm_helper.py +46 -4
- mindspore/communication/management.py +79 -7
- mindspore/context.py +38 -23
- mindspore/dataset/core/config.py +3 -3
- mindspore/dataset/engine/datasets.py +20 -7
- mindspore/dataset/engine/datasets_user_defined.py +32 -2
- mindspore/dataset/engine/iterators.py +2 -2
- mindspore/dataset/engine/obs/config_loader.py +2 -2
- mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +8 -0
- mindspore/dataset/transforms/py_transforms.py +7 -3
- mindspore/dataset/transforms/transforms.py +7 -3
- mindspore/dataset/vision/validators.py +1 -0
- mindspore/device_context/ascend/device.py +1 -1
- mindspore/device_context/gpu/__init__.py +2 -2
- mindspore/device_context/gpu/device.py +1 -1
- mindspore/device_context/gpu/op_precision.py +4 -2
- mindspore/device_context/gpu/op_tuning.py +6 -3
- mindspore/device_manager.py +16 -9
- mindspore/dnnl.dll +0 -0
- mindspore/dpcmi.dll +0 -0
- mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +3 -5
- mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
- mindspore/experimental/optim/adadelta.py +13 -20
- mindspore/experimental/optim/adagrad.py +15 -22
- mindspore/experimental/optim/adam.py +17 -24
- mindspore/experimental/optim/adamax.py +14 -22
- mindspore/experimental/optim/adamw.py +28 -34
- mindspore/experimental/optim/asgd.py +15 -25
- mindspore/experimental/optim/lr_scheduler.py +27 -45
- mindspore/experimental/optim/nadam.py +14 -24
- mindspore/experimental/optim/optimizer.py +13 -23
- mindspore/experimental/optim/radam.py +18 -24
- mindspore/experimental/optim/rmsprop.py +14 -25
- mindspore/experimental/optim/rprop.py +15 -26
- mindspore/experimental/optim/sgd.py +9 -19
- mindspore/hal/__init__.py +4 -4
- mindspore/hal/contiguous_tensors_handle.py +2 -2
- mindspore/hal/memory.py +1 -0
- mindspore/include/api/cell.h +37 -1
- mindspore/include/api/delegate.h +10 -0
- mindspore/include/api/model.h +3 -0
- mindspore/include/api/types.h +2 -2
- mindspore/include/c_api/model_c.h +0 -58
- mindspore/include/c_api/tensor_c.h +0 -26
- mindspore/include/dataset/vision_ascend.h +1 -1
- mindspore/jpeg62.dll +0 -0
- mindspore/mindrecord/tools/cifar10.py +60 -11
- mindspore/mindrecord/tools/cifar10_to_mr.py +5 -0
- 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_cpu_res_manager.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_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 +4 -44
- mindspore/mint/distributed/__init__.py +1 -0
- mindspore/mint/distributed/distributed.py +208 -5
- mindspore/mint/nn/__init__.py +1 -1
- mindspore/mint/nn/functional.py +53 -6
- mindspore/mint/nn/layer/_functions.py +164 -294
- mindspore/mint/nn/layer/activation.py +8 -6
- mindspore/mint/nn/layer/conv.py +122 -98
- mindspore/mint/nn/layer/normalization.py +8 -22
- mindspore/mint/optim/adam.py +19 -18
- mindspore/mint/optim/adamw.py +14 -8
- mindspore/mint/optim/sgd.py +5 -5
- 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/nn/cell.py +325 -499
- mindspore/nn/grad/cell_grad.py +11 -12
- mindspore/nn/layer/activation.py +32 -34
- mindspore/nn/layer/basic.py +67 -64
- mindspore/nn/layer/channel_shuffle.py +4 -4
- mindspore/nn/layer/combined.py +4 -2
- mindspore/nn/layer/conv.py +86 -85
- mindspore/nn/layer/dense.py +9 -7
- mindspore/nn/layer/embedding.py +50 -52
- mindspore/nn/layer/image.py +37 -39
- mindspore/nn/layer/math.py +111 -112
- mindspore/nn/layer/normalization.py +56 -44
- mindspore/nn/layer/pooling.py +58 -63
- mindspore/nn/layer/rnn_cells.py +33 -33
- mindspore/nn/layer/rnns.py +56 -56
- mindspore/nn/layer/thor_layer.py +74 -73
- mindspore/nn/layer/transformer.py +11 -1
- mindspore/nn/learning_rate_schedule.py +20 -20
- mindspore/nn/loss/loss.py +79 -81
- mindspore/nn/optim/adam.py +1 -1
- mindspore/nn/optim/adasum.py +2 -2
- mindspore/nn/optim/optimizer.py +1 -1
- mindspore/nn/optim/thor.py +2 -2
- mindspore/nn/probability/distribution/exponential.py +2 -1
- mindspore/nn/probability/distribution/poisson.py +2 -1
- mindspore/nn/sparse/sparse.py +3 -3
- mindspore/nn/wrap/cell_wrapper.py +34 -37
- mindspore/nn/wrap/grad_reducer.py +37 -37
- mindspore/nn/wrap/loss_scale.py +72 -74
- mindspore/numpy/array_creations.py +5 -5
- mindspore/numpy/fft.py +1 -1
- mindspore/numpy/math_ops.py +1 -1
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/opencv_imgproc452.dll +0 -0
- mindspore/ops/_grad_experimental/grad_comm_ops.py +51 -13
- mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -0
- mindspore/ops/_vmap/vmap_array_ops.py +6 -13
- mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +17 -8
- mindspore/ops/auto_generate/gen_extend_func.py +1 -51
- mindspore/ops/auto_generate/gen_ops_def.py +463 -257
- mindspore/ops/auto_generate/gen_ops_prim.py +1127 -885
- mindspore/ops/auto_generate/pyboost_inner_prim.py +31 -1
- mindspore/ops/composite/__init__.py +10 -0
- mindspore/ops/composite/base.py +8 -4
- mindspore/ops/composite/multitype_ops/__init__.py +12 -1
- mindspore/ops/composite/multitype_ops/_compile_utils.py +132 -108
- mindspore/ops/composite/multitype_ops/add_impl.py +70 -2
- mindspore/ops/composite/multitype_ops/div_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/floordiv_impl.py +29 -0
- mindspore/ops/composite/multitype_ops/getitem_impl.py +11 -0
- mindspore/ops/composite/multitype_ops/mod_impl.py +5 -3
- mindspore/ops/composite/multitype_ops/mul_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/setitem_impl.py +57 -0
- mindspore/ops/composite/multitype_ops/sub_impl.py +34 -0
- mindspore/ops/composite/multitype_ops/zeros_like_impl.py +14 -0
- mindspore/ops/function/__init__.py +3 -1
- mindspore/ops/function/_add_attr_func.py +11 -6
- mindspore/ops/function/array_func.py +7 -94
- mindspore/ops/function/debug_func.py +4 -3
- mindspore/ops/function/grad/grad_func.py +1 -1
- mindspore/ops/function/math_func.py +21 -367
- mindspore/ops/function/nn_func.py +26 -41
- mindspore/ops/function/other_func.py +4 -1
- mindspore/ops/function/random_func.py +31 -4
- mindspore/ops/functional.py +0 -2
- mindspore/ops/functional_overload.py +463 -6
- mindspore/ops/op_info_register.py +21 -0
- mindspore/ops/operations/__init__.py +5 -2
- mindspore/ops/operations/_custom_ops_utils.py +675 -8
- mindspore/ops/operations/_inner_ops.py +3 -6
- mindspore/ops/operations/_sequence_ops.py +1 -1
- mindspore/ops/operations/comm_ops.py +185 -26
- mindspore/ops/operations/custom_ops.py +235 -172
- mindspore/ops/operations/debug_ops.py +55 -4
- mindspore/ops/operations/image_ops.py +13 -13
- mindspore/ops/operations/manually_defined/ops_def.py +15 -16
- mindspore/ops/operations/math_ops.py +3 -4
- mindspore/ops/operations/nn_ops.py +5 -6
- mindspore/ops/primitive.py +6 -10
- mindspore/ops/tensor_method.py +36 -4
- mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +1 -1
- mindspore/ops_generate/api/functional_map_cpp_generator.py +10 -9
- mindspore/ops_generate/api/functions_cc_generator.py +58 -10
- mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +1 -1
- mindspore/ops_generate/common/base_generator.py +14 -0
- mindspore/ops_generate/common/gen_constants.py +7 -2
- mindspore/ops_generate/common/gen_utils.py +0 -19
- mindspore/ops_generate/common/op_proto.py +11 -4
- mindspore/ops_generate/common/template.py +88 -11
- mindspore/ops_generate/gen_ops.py +1 -1
- mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +4 -4
- mindspore/ops_generate/op_def/ops_name_h_generator.py +0 -3
- mindspore/ops_generate/op_def/ops_primitive_h_generator.py +0 -4
- mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -2
- mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +49 -8
- mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +2 -2
- mindspore/ops_generate/pyboost/gen_pyboost_func.py +31 -0
- mindspore/ops_generate/pyboost/op_template_parser.py +98 -72
- mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +70 -273
- mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +14 -6
- mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +316 -0
- mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +5 -3
- mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_internal_functions_cpp_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_functions_h_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +125 -0
- mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +4 -3
- mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +348 -61
- mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_utils.py +118 -9
- mindspore/ops_generate/tensor_py_cc_generator.py +1 -24
- mindspore/parallel/_auto_parallel_context.py +4 -2
- mindspore/parallel/_cell_wrapper.py +106 -40
- mindspore/parallel/_parallel_serialization.py +1 -1
- mindspore/parallel/_ps_context.py +4 -6
- mindspore/parallel/_tensor.py +167 -12
- mindspore/parallel/_transformer/moe.py +1 -1
- mindspore/parallel/_transformer/transformer.py +13 -8
- mindspore/parallel/auto_parallel.py +12 -5
- mindspore/parallel/checkpoint_convert.py +3 -3
- mindspore/parallel/checkpoint_transform.py +3 -1
- mindspore/parallel/cluster/process_entity/_api.py +84 -48
- mindspore/parallel/cluster/process_entity/_utils.py +95 -7
- mindspore/parallel/cluster/run.py +43 -4
- mindspore/parallel/function/__init__.py +8 -1
- mindspore/parallel/function/reshard_func.py +1 -1
- mindspore/parallel/nn/__init__.py +15 -2
- mindspore/parallel/nn/parallel_cell_wrapper.py +9 -10
- mindspore/parallel/nn/parallel_grad_reducer.py +7 -6
- mindspore/parallel/shard.py +2 -2
- mindspore/parallel/transform_safetensors.py +462 -174
- mindspore/pgodb140.dll +0 -0
- mindspore/pgort140.dll +0 -0
- mindspore/profiler/__init__.py +2 -1
- mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +7 -7
- mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +3 -0
- mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +3 -0
- mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +4 -4
- mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +4 -1
- mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +2 -1
- mindspore/profiler/analysis/task_manager.py +1 -1
- mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +5 -1
- mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +2 -1
- mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +42 -22
- mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +3 -2
- mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +9 -5
- mindspore/profiler/analysis/viewer/ms_operator_details_viewer.py +132 -0
- mindspore/profiler/common/constant.py +16 -0
- mindspore/profiler/common/profiler_context.py +25 -27
- mindspore/profiler/common/profiler_info.py +0 -16
- mindspore/profiler/common/profiler_op_analyse.py +235 -0
- mindspore/profiler/common/profiler_output_path.py +23 -8
- mindspore/profiler/common/profiler_parameters.py +128 -35
- mindspore/profiler/dynamic_profile/__init__.py +0 -0
- mindspore/profiler/dynamic_profile/dynamic_monitor_proxy.py +39 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_config_context.py +666 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_utils.py +62 -0
- mindspore/profiler/dynamic_profiler.py +305 -314
- mindspore/profiler/envprofiler.py +12 -7
- mindspore/profiler/experimental_config.py +96 -6
- mindspore/profiler/mstx.py +33 -12
- mindspore/profiler/platform/__init__.py +2 -3
- mindspore/profiler/platform/npu_profiler.py +29 -19
- mindspore/profiler/profiler.py +35 -19
- mindspore/profiler/profiler_action_controller.py +64 -76
- mindspore/profiler/schedule.py +10 -4
- mindspore/rewrite/common/config.py +1 -0
- mindspore/rewrite/common/namer.py +1 -0
- mindspore/rewrite/common/namespace.py +1 -0
- mindspore/rewrite/node/node.py +31 -11
- mindspore/rewrite/parsers/assign_parser.py +1 -1
- mindspore/rewrite/symbol_tree/symbol_tree.py +1 -1
- mindspore/run_check/_check_version.py +7 -10
- mindspore/runtime/__init__.py +5 -5
- mindspore/runtime/event.py +10 -4
- mindspore/runtime/executor.py +60 -45
- mindspore/runtime/memory.py +21 -30
- mindspore/runtime/thread_bind_core.py +298 -164
- mindspore/safeguard/rewrite_obfuscation.py +12 -13
- mindspore/swresample-4.dll +0 -0
- mindspore/swscale-6.dll +0 -0
- mindspore/tbbmalloc.dll +0 -0
- mindspore/tinyxml2.dll +0 -0
- mindspore/train/_utils.py +6 -2
- mindspore/train/amp.py +43 -20
- mindspore/train/callback/__init__.py +5 -5
- mindspore/train/callback/_checkpoint.py +3 -6
- mindspore/train/callback/_flops_collector.py +1 -1
- mindspore/train/callback/_landscape.py +0 -1
- mindspore/train/callback/_train_fault_tolerance.py +71 -13
- mindspore/train/data_sink.py +11 -2
- mindspore/train/dataset_helper.py +9 -0
- mindspore/train/model.py +51 -33
- mindspore/train/serialization.py +133 -111
- mindspore/train/summary/summary_record.py +13 -2
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/__init__.py +3 -2
- mindspore/utils/dryrun.py +0 -6
- mindspore/utils/runtime_execution_order_check.py +162 -78
- mindspore/utils/sdc_detect.py +68 -0
- mindspore/utils/utils.py +6 -9
- mindspore/vcmeta.dll +0 -0
- mindspore/vcruntime140.dll +0 -0
- mindspore/vcruntime140_1.dll +0 -0
- mindspore/version.py +1 -1
- {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/METADATA +5 -4
- {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/RECORD +352 -390
- mindspore/_deprecated/jit.py +0 -198
- mindspore/experimental/es/__init__.py +0 -22
- mindspore/experimental/es/embedding_service.py +0 -891
- mindspore/experimental/es/embedding_service_layer.py +0 -581
- mindspore/profiler/parser/__init__.py +0 -14
- mindspore/profiler/parser/aicpu_data_parser.py +0 -272
- mindspore/profiler/parser/ascend_analysis/__init__.py +0 -14
- mindspore/profiler/parser/ascend_analysis/constant.py +0 -71
- mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -180
- mindspore/profiler/parser/ascend_analysis/function_event.py +0 -185
- mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +0 -136
- mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +0 -131
- mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +0 -104
- mindspore/profiler/parser/ascend_analysis/path_manager.py +0 -313
- mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +0 -123
- mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +0 -86
- mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +0 -75
- mindspore/profiler/parser/ascend_cluster_generator.py +0 -116
- mindspore/profiler/parser/ascend_communicate_generator.py +0 -314
- mindspore/profiler/parser/ascend_flops_generator.py +0 -116
- mindspore/profiler/parser/ascend_fpbp_generator.py +0 -82
- mindspore/profiler/parser/ascend_hccl_generator.py +0 -271
- mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
- mindspore/profiler/parser/ascend_memory_generator.py +0 -185
- mindspore/profiler/parser/ascend_msprof_exporter.py +0 -282
- mindspore/profiler/parser/ascend_msprof_generator.py +0 -187
- mindspore/profiler/parser/ascend_op_generator.py +0 -334
- mindspore/profiler/parser/ascend_steptrace_generator.py +0 -94
- mindspore/profiler/parser/ascend_timeline_generator.py +0 -545
- mindspore/profiler/parser/base_timeline_generator.py +0 -483
- mindspore/profiler/parser/container.py +0 -229
- mindspore/profiler/parser/cpu_gpu_timeline_generator.py +0 -697
- mindspore/profiler/parser/flops_parser.py +0 -531
- mindspore/profiler/parser/framework_enum.py +0 -111
- mindspore/profiler/parser/framework_parser.py +0 -464
- mindspore/profiler/parser/framework_struct.py +0 -61
- mindspore/profiler/parser/gpu_analysis/__init__.py +0 -14
- mindspore/profiler/parser/gpu_analysis/function_event.py +0 -44
- mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +0 -89
- mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +0 -72
- mindspore/profiler/parser/hccl_parser.py +0 -573
- mindspore/profiler/parser/hwts_log_parser.py +0 -122
- mindspore/profiler/parser/integrator.py +0 -526
- mindspore/profiler/parser/memory_usage_parser.py +0 -277
- mindspore/profiler/parser/minddata_analyzer.py +0 -800
- mindspore/profiler/parser/minddata_parser.py +0 -186
- mindspore/profiler/parser/minddata_pipeline_parser.py +0 -299
- mindspore/profiler/parser/op_intermediate_parser.py +0 -149
- mindspore/profiler/parser/optime_parser.py +0 -250
- mindspore/profiler/parser/profiler_info.py +0 -213
- mindspore/profiler/parser/step_trace_parser.py +0 -666
- {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/WHEEL +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/entry_points.txt +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/top_level.txt +0 -0
mindspore/common/tensor.py
CHANGED
|
@@ -32,11 +32,12 @@ from mindspore.common.hook_handle import _TensorHookHandle
|
|
|
32
32
|
from mindspore.common._utils import get_slice_num
|
|
33
33
|
from mindspore.common._register_for_tensor import tensor_operator_registry
|
|
34
34
|
from mindspore._c_expression import TensorPy as TensorPy_
|
|
35
|
+
from mindspore._c_expression import _rmod_instance
|
|
35
36
|
from mindspore import _checkparam as validator
|
|
36
37
|
from mindspore._checkparam import is_stub_tensor, check_hook_fn
|
|
37
38
|
from mindspore._check_jit_forbidden_api import jit_forbidden_register
|
|
38
39
|
from mindspore.common.symbol import Symbol
|
|
39
|
-
|
|
40
|
+
from mindspore._c_expression import is_reboot_node
|
|
40
41
|
|
|
41
42
|
np_types = (np.int8, np.int16, np.int32, np.int64,
|
|
42
43
|
np.uint8, np.uint16, np.uint32, np.uint64, np.float16,
|
|
@@ -93,13 +94,6 @@ def _set_symbolic_shape(shape):
|
|
|
93
94
|
return shape, symbolic_shape
|
|
94
95
|
|
|
95
96
|
|
|
96
|
-
def _convert_stub_tensor(input_data):
|
|
97
|
-
"""Convert input to stub tensor"""
|
|
98
|
-
if not is_stub_tensor(input_data):
|
|
99
|
-
return input_data
|
|
100
|
-
return input_data.stub_sync()
|
|
101
|
-
|
|
102
|
-
|
|
103
97
|
def _convert_numpy_array(input_data):
|
|
104
98
|
"""Convert inpyt to numpy array"""
|
|
105
99
|
if not isinstance(input_data, np_types):
|
|
@@ -144,8 +138,6 @@ def _init(input_data=None, dtype=None, shape=None, init=None, const_arg=False, d
|
|
|
144
138
|
_cast = tensor_operator_registry.get("cast")
|
|
145
139
|
input_data = _cast(input_data, dtype)
|
|
146
140
|
|
|
147
|
-
input_data = _convert_stub_tensor(input_data)
|
|
148
|
-
|
|
149
141
|
if input_data is None and shape is None and init is None and dtype is not None:
|
|
150
142
|
validator.check_type_name('dtype', dtype, mstype.number_type + (mstype.bool_, mstype.string), "Tensor")
|
|
151
143
|
logger.warning(f"For 'Tensor', if 'dtype' is not None, 'input_data', 'shape' or 'init' must not be None.")
|
|
@@ -325,7 +317,6 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
325
317
|
return True
|
|
326
318
|
return NotImplemented
|
|
327
319
|
|
|
328
|
-
|
|
329
320
|
def __deepcopy__(self, memodict):
|
|
330
321
|
new_obj = Tensor(self)
|
|
331
322
|
new_obj.init = self.init
|
|
@@ -379,9 +370,8 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
379
370
|
try:
|
|
380
371
|
data = self._item()
|
|
381
372
|
return int(data)
|
|
382
|
-
except ValueError:
|
|
383
|
-
raise ValueError("Only one element tensors can be converted to Python scalars")
|
|
384
|
-
|
|
373
|
+
except ValueError as e:
|
|
374
|
+
raise ValueError("Only one element tensors can be converted to Python scalars") from e
|
|
385
375
|
|
|
386
376
|
def __float__(self):
|
|
387
377
|
try:
|
|
@@ -396,8 +386,8 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
396
386
|
if not isinstance(data, (int, bool)):
|
|
397
387
|
raise ValueError
|
|
398
388
|
return int(data)
|
|
399
|
-
except ValueError:
|
|
400
|
-
raise ValueError("Only integer tensors of a single element can be converted to an index.")
|
|
389
|
+
except ValueError as e:
|
|
390
|
+
raise ValueError("Only integer tensors of a single element can be converted to an index.") from e
|
|
401
391
|
|
|
402
392
|
def __pos__(self):
|
|
403
393
|
return self
|
|
@@ -426,11 +416,8 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
426
416
|
def __rtruediv__(self, other):
|
|
427
417
|
return tensor_operator_registry.get('__truediv__')(other, self)
|
|
428
418
|
|
|
429
|
-
def __mod__(self, other):
|
|
430
|
-
return tensor_operator_registry.get('__mod__')(self, other)
|
|
431
|
-
|
|
432
419
|
def __rmod__(self, other):
|
|
433
|
-
return
|
|
420
|
+
return _rmod_instance(other, self)
|
|
434
421
|
|
|
435
422
|
def __imod__(self, other):
|
|
436
423
|
return self.__mod__(other)
|
|
@@ -2110,11 +2097,13 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
2110
2097
|
|
|
2111
2098
|
from mindspore.common.initializer import Zero as ZeroInitializer
|
|
2112
2099
|
|
|
2100
|
+
is_qint4x2 = self.dtype == mstype.qint4x2
|
|
2113
2101
|
try:
|
|
2102
|
+
dtype_ = mstype.int8 if is_qint4x2 else self.dtype
|
|
2114
2103
|
if isinstance(self.init, ZeroInitializer):
|
|
2115
|
-
data = np.zeros(data_shape, dtype=mstype.dtype_to_nptype(
|
|
2104
|
+
data = np.zeros(data_shape, dtype=mstype.dtype_to_nptype(dtype_))
|
|
2116
2105
|
else:
|
|
2117
|
-
data = np.ndarray(data_shape, dtype=mstype.dtype_to_nptype(
|
|
2106
|
+
data = np.ndarray(data_shape, dtype=mstype.dtype_to_nptype(dtype_))
|
|
2118
2107
|
except ValueError as e:
|
|
2119
2108
|
msg = "Error shape={}".format(shape)
|
|
2120
2109
|
logger.critical(msg)
|
|
@@ -2127,7 +2116,7 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
2127
2116
|
self.init = init
|
|
2128
2117
|
global_seed = get_seed()
|
|
2129
2118
|
self._np_seed = np.random.get_state()[1][0]
|
|
2130
|
-
self.need_set_seed =
|
|
2119
|
+
self.need_set_seed = slice_index is not None
|
|
2131
2120
|
self._global_seed = global_seed
|
|
2132
2121
|
self._seed_offset = 1
|
|
2133
2122
|
if self.need_set_seed:
|
|
@@ -2150,7 +2139,8 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
2150
2139
|
self.init.seed, _ = self.seed
|
|
2151
2140
|
|
|
2152
2141
|
with seed_context(self.init):
|
|
2153
|
-
if not isinstance(self.init, ZeroInitializer) and slice_num_of_persistent_data == 1
|
|
2142
|
+
if (not isinstance(self.init, ZeroInitializer) and slice_num_of_persistent_data == 1) \
|
|
2143
|
+
and not is_reboot_node():
|
|
2154
2144
|
self.init(data)
|
|
2155
2145
|
self.init = None
|
|
2156
2146
|
|
|
@@ -2159,6 +2149,10 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
2159
2149
|
self.assign_value(TensorPy_.persistent_data_from_numpy(data, slice_num_of_persistent_data))
|
|
2160
2150
|
else:
|
|
2161
2151
|
self.assign_value(TensorPy_.from_numpy(data))
|
|
2152
|
+
|
|
2153
|
+
if is_qint4x2:
|
|
2154
|
+
self.set_dtype(mstype.qint4x2)
|
|
2155
|
+
|
|
2162
2156
|
return self
|
|
2163
2157
|
|
|
2164
2158
|
def resize(self, *new_shape):
|
|
@@ -2495,7 +2489,6 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
2495
2489
|
"""
|
|
2496
2490
|
return tensor_operator_registry.get('uniform_')(self, from_=from_, to=to, generator=generator)
|
|
2497
2491
|
|
|
2498
|
-
|
|
2499
2492
|
def exponential_(self, lambd=1, *, generator=None):
|
|
2500
2493
|
r"""
|
|
2501
2494
|
Fills `self` tensor with elements drawn from the exponential distribution:
|
|
@@ -2529,7 +2522,6 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
2529
2522
|
"""
|
|
2530
2523
|
return tensor_operator_registry.get('exponential_')(self, lambd=lambd, generator=generator)
|
|
2531
2524
|
|
|
2532
|
-
|
|
2533
2525
|
def sum_to_size(self, *size):
|
|
2534
2526
|
r"""
|
|
2535
2527
|
Sum self Tensor to the `size`. `size` must be expandable to the Tensor size.
|
|
@@ -2561,17 +2553,19 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
2561
2553
|
shape_x = x.shape
|
|
2562
2554
|
if len(size) > x.ndim:
|
|
2563
2555
|
raise ValueError(f"For sum_to_size, size {size} is not expandable to the tensor size {shape_x}.")
|
|
2556
|
+
pre_len = 0
|
|
2557
|
+
pre_axis = []
|
|
2564
2558
|
if len(size) < x.ndim:
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
axes =
|
|
2559
|
+
pre_len = x.ndim - len(size)
|
|
2560
|
+
pre_axis = [axis for axis in range(pre_len)]
|
|
2561
|
+
axes = pre_axis
|
|
2568
2562
|
for i, element in enumerate(size):
|
|
2569
|
-
if element != x.shape[i] and element == 1:
|
|
2570
|
-
axes.append(i)
|
|
2571
|
-
elif element != x.shape[i]:
|
|
2563
|
+
if element != x.shape[i + pre_len] and element == 1:
|
|
2564
|
+
axes.append(i + pre_len)
|
|
2565
|
+
elif element != x.shape[i + pre_len]:
|
|
2572
2566
|
raise ValueError(f"For sum_to_size, size {size} is not expandable to the tensor size {shape_x}.")
|
|
2573
2567
|
if axes:
|
|
2574
|
-
return x.sum(tuple(axes), keepdims=True)
|
|
2568
|
+
return x.sum(tuple(axes), keepdims=True).reshape(size)
|
|
2575
2569
|
return x
|
|
2576
2570
|
|
|
2577
2571
|
def nanmean(self, axis=None, keepdims=False, *, dtype=None):
|
|
@@ -2654,7 +2648,7 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
2654
2648
|
Note:
|
|
2655
2649
|
The rank of `self`.
|
|
2656
2650
|
|
|
2657
|
-
- Ascend: its rank can be equal to 0 except
|
|
2651
|
+
- Ascend: its rank can be equal to 0 except GE backend.
|
|
2658
2652
|
- CPU/GPU: its rank should be greater than or eaqual to 1.
|
|
2659
2653
|
|
|
2660
2654
|
Keyword Args:
|
|
@@ -2673,7 +2667,7 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
2673
2667
|
Raises:
|
|
2674
2668
|
TypeError: If `self` is not Tensor.
|
|
2675
2669
|
TypeError: If `as_tuple` is not bool.
|
|
2676
|
-
RuntimeError: On GPU or CPU or Ascend
|
|
2670
|
+
RuntimeError: On GPU or CPU or Ascend GE backend, if dim of `input` equals to 0.
|
|
2677
2671
|
|
|
2678
2672
|
Supported Platforms:
|
|
2679
2673
|
``Ascend`` ``GPU`` ``CPU``
|
|
@@ -2836,7 +2830,6 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
2836
2830
|
return []
|
|
2837
2831
|
return self._tolist()
|
|
2838
2832
|
|
|
2839
|
-
|
|
2840
2833
|
def unsorted_segment_min(self, segment_ids, num_segments):
|
|
2841
2834
|
r"""
|
|
2842
2835
|
For details, please refer to :func:`mindspore.ops.unsorted_segment_min`.
|
|
@@ -2859,7 +2852,7 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
2859
2852
|
"""
|
|
2860
2853
|
For details, please refer to :func:`mindspore.ops.unique_consecutive`.
|
|
2861
2854
|
"""
|
|
2862
|
-
output, idx, counts
|
|
2855
|
+
output, idx, counts = \
|
|
2863
2856
|
tensor_operator_registry.get("unique_consecutive")(return_inverse, return_counts, dim)(self)
|
|
2864
2857
|
if return_inverse and return_counts:
|
|
2865
2858
|
return output, idx, counts
|
|
@@ -2998,7 +2991,6 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
2998
2991
|
return str(self.dtype)
|
|
2999
2992
|
return self.astype(dtype)
|
|
3000
2993
|
|
|
3001
|
-
|
|
3002
2994
|
def type_as(self, other):
|
|
3003
2995
|
r"""
|
|
3004
2996
|
Returns self tensor cast to the type of the with the input other tensor.
|
|
@@ -3041,7 +3033,6 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
3041
3033
|
return self
|
|
3042
3034
|
return TensorPy_.type_as(self, other)
|
|
3043
3035
|
|
|
3044
|
-
|
|
3045
3036
|
def bool(self):
|
|
3046
3037
|
r"""
|
|
3047
3038
|
Converts input tensor dtype to `bool`.
|
|
@@ -3537,49 +3528,6 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
3537
3528
|
"""
|
|
3538
3529
|
return tensor_operator_registry.get('zero_')(self)
|
|
3539
3530
|
|
|
3540
|
-
def new_empty(self, size, *, dtype=None, device=None):
|
|
3541
|
-
r"""
|
|
3542
|
-
Returns an uninitialized Tensor of `size`. Its dtype is specified by `dtype` and its
|
|
3543
|
-
device is specified by `device`.
|
|
3544
|
-
|
|
3545
|
-
.. warning::
|
|
3546
|
-
This is an experimental API that is subject to change or deletion.
|
|
3547
|
-
|
|
3548
|
-
Args:
|
|
3549
|
-
size (Union[tuple[int], list[int], int]): The specified shape of output tensor. Only positive integer or
|
|
3550
|
-
tuple or list containing positive integers are allowed.
|
|
3551
|
-
|
|
3552
|
-
Keyword Args:
|
|
3553
|
-
dtype (:class:`mindspore.dtype`, optional): The specified dtype of the output tensor. If `dtype = None`,
|
|
3554
|
-
the tensor will have the same dtype as `self`. Default ``None``.
|
|
3555
|
-
device (string, optional): The specified device of the output tensor. Support ``CPU`` and ``Ascend``. If
|
|
3556
|
-
`device = None`, the tensor will have the same device as `self` and if the device of `self` is not
|
|
3557
|
-
defined, the value set by :func:`mindspore.set_device` will be used. Default ``None``.
|
|
3558
|
-
|
|
3559
|
-
Returns:
|
|
3560
|
-
Tensor, the shape, dtype and device is defined above but with uninitialized data (May be a random value).
|
|
3561
|
-
|
|
3562
|
-
Raises:
|
|
3563
|
-
TypeError: If `size` is neither an int nor a tuple or list of int.
|
|
3564
|
-
|
|
3565
|
-
Supported Platforms:
|
|
3566
|
-
``Ascend``
|
|
3567
|
-
|
|
3568
|
-
Examples:
|
|
3569
|
-
>>> import mindspore
|
|
3570
|
-
>>> from mindspore import Tensor
|
|
3571
|
-
>>> x = Tensor([[1, 2, 3], [4, 5, 6]])
|
|
3572
|
-
>>> output1 = x.new_empty((2, 3))
|
|
3573
|
-
>>> print(output1)
|
|
3574
|
-
[[0 0 0]
|
|
3575
|
-
[0 0 0]]
|
|
3576
|
-
>>> output2 = x.new_empty((2, 3), dtype=mindspore.float64)
|
|
3577
|
-
>>> print(output2)
|
|
3578
|
-
[[0. 0. 0.]
|
|
3579
|
-
[0. 0. 0.]]
|
|
3580
|
-
"""
|
|
3581
|
-
return tensor_operator_registry.get('new_empty')(self, size, dtype, device)
|
|
3582
|
-
|
|
3583
3531
|
def sign(self):
|
|
3584
3532
|
r"""
|
|
3585
3533
|
For details, please refer to :func:`mindspore.ops.sign`.
|
|
@@ -3868,6 +3816,23 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
3868
3816
|
"""
|
|
3869
3817
|
return TensorPy_._data_ptr(self)
|
|
3870
3818
|
|
|
3819
|
+
def data_ptr(self):
|
|
3820
|
+
r"""
|
|
3821
|
+
Get the data ptr address of tensor, for CPU is host address, GPU/NPU is device address.
|
|
3822
|
+
User should know how to use the data ptr address.
|
|
3823
|
+
Note: this api is an experimental api, users need understatnd it before use.
|
|
3824
|
+
|
|
3825
|
+
Supported Platforms:
|
|
3826
|
+
``CPU/GPU/Ascend``
|
|
3827
|
+
|
|
3828
|
+
Examples:
|
|
3829
|
+
>>> import mindspore as ms
|
|
3830
|
+
>>> from mindspore import Tensor
|
|
3831
|
+
>>> x = ms.Tensor([1, 2, 3], ms.int64)
|
|
3832
|
+
>>> data_ptr = x.data_ptr()
|
|
3833
|
+
"""
|
|
3834
|
+
return TensorPy_._data_ptr(self)
|
|
3835
|
+
|
|
3871
3836
|
def normal_(self, mean=0, std=1, *, generator=None):
|
|
3872
3837
|
r"""
|
|
3873
3838
|
Update the `self` tensor in place by generating random numbers sampled from the normal
|
|
@@ -3907,13 +3872,13 @@ class Tensor(TensorPy_, metaclass=_TensorMeta):
|
|
|
3907
3872
|
"""
|
|
3908
3873
|
return tensor_operator_registry.get('normal_')(self, mean=mean, std=std, generator=generator)
|
|
3909
3874
|
|
|
3910
|
-
|
|
3911
3875
|
def triangular_solve(self, A, upper=True, transpose=False, unitriangular=False):
|
|
3912
3876
|
r"""
|
|
3913
3877
|
For details, please refer to :func:`mindspore.mint.triangular_solve`.
|
|
3914
3878
|
"""
|
|
3915
3879
|
return tensor_operator_registry.get('triangular_solve')(self, A, upper, transpose, unitriangular)
|
|
3916
3880
|
|
|
3881
|
+
|
|
3917
3882
|
def _vm_compare(*args):
|
|
3918
3883
|
"""Implement `vm_compare` for tensor."""
|
|
3919
3884
|
if args:
|
|
@@ -25,7 +25,7 @@ from mindspore import context
|
|
|
25
25
|
from mindspore.parallel._ps_context import _is_role_sched, _is_ps_mode,\
|
|
26
26
|
_get_ps_context
|
|
27
27
|
from mindspore import log as logger
|
|
28
|
-
from mindspore._c_expression import CollectiveManager, set_cluster_exit_with_exception, MSContext
|
|
28
|
+
from mindspore._c_expression import CollectiveManager, set_cluster_exit_with_exception, MSContext, GroupOptions
|
|
29
29
|
from mindspore.common._utils import load_lib
|
|
30
30
|
|
|
31
31
|
HCCL_LIB = 'libhccl_plugin.so'
|
|
@@ -470,14 +470,25 @@ def _get_group_ranks(group):
|
|
|
470
470
|
|
|
471
471
|
|
|
472
472
|
@check_parameter_available
|
|
473
|
-
def _create_group_helper(group, rank_ids):
|
|
473
|
+
def _create_group_helper(group, rank_ids, options=None):
|
|
474
474
|
"""
|
|
475
475
|
The Helper to do create_group.
|
|
476
476
|
|
|
477
477
|
Args:
|
|
478
478
|
group (str): The communication group.
|
|
479
479
|
rank_ids (list): Rank ids in the group.
|
|
480
|
-
|
|
480
|
+
options (GroupOptions, optional): Additional communication group configuration parameters.
|
|
481
|
+
The backend will automatically select supported parameters and apply them during group
|
|
482
|
+
initialization. i.e. for the ``HCCL`` backend, ``hccl_config`` can be specified so that
|
|
483
|
+
group initialization configurations can be applied. Default is ``None``.
|
|
484
|
+
|
|
485
|
+
`GroupOptions` is defined as a class that can be instantiated as a python object.
|
|
486
|
+
|
|
487
|
+
.. code-block::
|
|
488
|
+
|
|
489
|
+
GroupOptions {
|
|
490
|
+
hccl_config(dict)
|
|
491
|
+
}
|
|
481
492
|
|
|
482
493
|
Raises:
|
|
483
494
|
TypeError: If rank_ids is not a list.
|
|
@@ -499,10 +510,15 @@ def _create_group_helper(group, rank_ids):
|
|
|
499
510
|
"but got 'rank_ids' size : {}.".format(len(rank_ids)))
|
|
500
511
|
if len(rank_ids) - len(list(set(rank_ids))) > 0:
|
|
501
512
|
raise ValueError("List rank_ids in Group {} has duplicate data!".format(group))
|
|
513
|
+
if options is None:
|
|
514
|
+
options = GroupOptions()
|
|
515
|
+
if not isinstance(options, GroupOptions):
|
|
516
|
+
raise TypeError("For 'create_group', the argument 'options' must be type of GroupOptions, "
|
|
517
|
+
"but got 'options' type : {}.".format(type(options)))
|
|
502
518
|
if _hccl_test():
|
|
503
519
|
hccl.create_group(group, rank_size, rank_ids)
|
|
504
520
|
else:
|
|
505
|
-
result = CollectiveManager.get_instance().create_group(group, rank_ids)
|
|
521
|
+
result = CollectiveManager.get_instance().create_group(group, rank_ids, options)
|
|
506
522
|
if not result:
|
|
507
523
|
raise RuntimeError("Failed to create communication group for {} with rank ids {}. "
|
|
508
524
|
"If NCCL is used, 'export NCCL_DEBUG=INFO' "
|
|
@@ -554,3 +570,29 @@ def _get_group_map():
|
|
|
554
570
|
def _wait_all_comm_init():
|
|
555
571
|
"""Wait for all communicators to be initialized."""
|
|
556
572
|
return CollectiveManager.get_instance().wait_all_comm_init()
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
def _remove_group_info(group_name):
|
|
576
|
+
"""
|
|
577
|
+
Remove group info after destroy group by user when using arf.
|
|
578
|
+
|
|
579
|
+
Args:
|
|
580
|
+
group_name (str): The user communication group name.
|
|
581
|
+
|
|
582
|
+
"""
|
|
583
|
+
CollectiveManager.get_instance().remove_group_info(group_name)
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
def _comm_switch_nic_helper(global_ranks: list, use_backup: list) -> bool:
|
|
587
|
+
"""Switch network interface card between the primary and the secondary NIC.
|
|
588
|
+
|
|
589
|
+
Args:
|
|
590
|
+
global_ranks (list[int], tuple[int]): list of integers. The global rank ids that need switch network interface .
|
|
591
|
+
use_backup (list[bool], tuple[int]): list of bool. For each rank id in global_ranks, determine whether to use
|
|
592
|
+
the backup network interface card. True means use, False means not use.
|
|
593
|
+
|
|
594
|
+
Returns:
|
|
595
|
+
bool, whether the network card switch is successful.
|
|
596
|
+
If one fails, return False. If all are successful, return True.
|
|
597
|
+
"""
|
|
598
|
+
return CollectiveManager.get_instance().comm_switch_nic(global_ranks, use_backup)
|
|
@@ -21,7 +21,7 @@ from mindspore.communication._comm_helper import Backend, _get_rank_helper, _get
|
|
|
21
21
|
_get_world_rank_from_group_rank_helper, _get_group_rank_from_world_rank_helper, \
|
|
22
22
|
_create_group_helper, _destroy_group_helper, HCCL_WORLD_COMM_GROUP, NCCL_WORLD_COMM_GROUP, \
|
|
23
23
|
MCCL_WORLD_COMM_GROUP, DEVICE_TO_BACKEND, _get_local_rank_helper, _get_local_size_helper, GlobalComm, \
|
|
24
|
-
_check_mpi_envs, _set_elegant_exit_handle, _get_group_ranks, _get_comm_name_helper
|
|
24
|
+
_check_mpi_envs, _set_elegant_exit_handle, _get_group_ranks, _get_comm_name_helper, _comm_switch_nic_helper
|
|
25
25
|
from mindspore._c_expression import init_hccl, finalize_hccl, init_cluster, MSContext, ms_ctx_param
|
|
26
26
|
from mindspore.hal.device import is_initialized
|
|
27
27
|
|
|
@@ -116,7 +116,7 @@ def _check_hccl():
|
|
|
116
116
|
except Exception as e:
|
|
117
117
|
logger.error(f"Check hccl failed: {e}")
|
|
118
118
|
raise RuntimeError("\"hccl\" wheel was not installed correctly. For details, refer to the installation "
|
|
119
|
-
"guidelines: https://www.mindspore.cn/install")
|
|
119
|
+
"guidelines: https://www.mindspore.cn/install") from e
|
|
120
120
|
|
|
121
121
|
|
|
122
122
|
def init(backend_name=None):
|
|
@@ -545,7 +545,7 @@ def get_group_rank_from_world_rank(world_rank_id, group):
|
|
|
545
545
|
return _get_group_rank_from_world_rank_helper(world_rank_id=world_rank_id, group=group)
|
|
546
546
|
|
|
547
547
|
|
|
548
|
-
def create_group(group, rank_ids):
|
|
548
|
+
def create_group(group, rank_ids, options=None):
|
|
549
549
|
"""
|
|
550
550
|
Create a user collective communication group.
|
|
551
551
|
|
|
@@ -558,6 +558,18 @@ def create_group(group, rank_ids):
|
|
|
558
558
|
Args:
|
|
559
559
|
group (str): The name of the communication group to be created.
|
|
560
560
|
rank_ids (list): A list of device IDs.
|
|
561
|
+
options (GroupOptions, optional): Additional communication group configuration parameters.
|
|
562
|
+
The backend will automatically select supported parameters and apply them during group
|
|
563
|
+
initialization. i.e. for the ``HCCL`` backend, ``hccl_config`` can be specified so that
|
|
564
|
+
group initialization configurations can be applied. Default is ``None``.
|
|
565
|
+
|
|
566
|
+
`GroupOptions` is defined as a class that can be instantiated as a python object.
|
|
567
|
+
|
|
568
|
+
.. code-block::
|
|
569
|
+
|
|
570
|
+
GroupOptions {
|
|
571
|
+
hccl_config(dict)
|
|
572
|
+
}
|
|
561
573
|
|
|
562
574
|
Raises:
|
|
563
575
|
TypeError: If group is not a string or `rank_ids` is not a list.
|
|
@@ -578,22 +590,24 @@ def create_group(group, rank_ids):
|
|
|
578
590
|
for more details.
|
|
579
591
|
|
|
580
592
|
>>> import mindspore as ms
|
|
581
|
-
>>> from mindspore import set_context
|
|
582
|
-
>>> from mindspore import
|
|
593
|
+
>>> from mindspore import set_context, ops
|
|
594
|
+
>>> from mindspore._c_expression import GroupOptions
|
|
583
595
|
>>> from mindspore.communication import init, create_group, get_rank
|
|
584
596
|
>>> set_context(mode=ms.GRAPH_MODE)
|
|
585
597
|
>>> ms.set_device(device_target="Ascend")
|
|
586
598
|
>>> init()
|
|
587
599
|
>>> group = "0-7"
|
|
588
600
|
>>> rank_ids = [0,7]
|
|
601
|
+
>>> options = GroupOptions()
|
|
602
|
+
>>> options.hccl_config = {"hccl_buffer_size": 400}
|
|
589
603
|
>>> if get_rank() in rank_ids:
|
|
590
|
-
... create_group(group, rank_ids)
|
|
604
|
+
... create_group(group, rank_ids, options)
|
|
591
605
|
... allreduce = ops.AllReduce(group)
|
|
592
606
|
"""
|
|
593
607
|
if not isinstance(group, str):
|
|
594
608
|
raise TypeError("For 'create_group', the argument 'group' must be type of string, "
|
|
595
609
|
"but got 'group' type : {}.".format(type(group)))
|
|
596
|
-
_create_group_helper(group, rank_ids)
|
|
610
|
+
_create_group_helper(group, rank_ids, options)
|
|
597
611
|
|
|
598
612
|
|
|
599
613
|
def destroy_group(group):
|
|
@@ -740,3 +754,61 @@ def get_process_group_ranks(group=GlobalComm.WORLD_COMM_GROUP):
|
|
|
740
754
|
|
|
741
755
|
"""
|
|
742
756
|
return _get_group_ranks(group=_get_group(group))
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
def _comm_switch_nic(global_ranks, use_backup):
|
|
760
|
+
"""Switch network interface card between the primary and the secondary NIC.
|
|
761
|
+
|
|
762
|
+
Args:
|
|
763
|
+
global_ranks (list[int], tuple[int]): list of integers. The global rank ids that need switch network interface .
|
|
764
|
+
use_backup (list[bool], tuple[int]): list of bool. For each rank id in global_ranks, determine whether to use
|
|
765
|
+
the backup network interface card. True means use, False means not use.
|
|
766
|
+
|
|
767
|
+
Returns:
|
|
768
|
+
bool, whether the network card switch is successful.
|
|
769
|
+
If one fails, return False. If all are successful, return True.
|
|
770
|
+
|
|
771
|
+
Supported Platforms:
|
|
772
|
+
``Ascend``
|
|
773
|
+
|
|
774
|
+
Examples:
|
|
775
|
+
.. note::
|
|
776
|
+
Before running the following examples, you need to configure the communication environment variables.
|
|
777
|
+
|
|
778
|
+
For Ascend/GPU/CPU devices, it is recommended to use the msrun startup method
|
|
779
|
+
without any third-party or configuration file dependencies.
|
|
780
|
+
|
|
781
|
+
Please see the `msrun start up
|
|
782
|
+
<https://www.mindspore.cn/tutorials/en/master/parallel/msrun_launcher.html>`_
|
|
783
|
+
for more details.
|
|
784
|
+
|
|
785
|
+
This example should be run with 4 devices.
|
|
786
|
+
|
|
787
|
+
>>> import numpy as np
|
|
788
|
+
>>> from mindspore.communication import init, _comm_switch_nic
|
|
789
|
+
>>> from mindspore.communication.management import _comm_switch_nic
|
|
790
|
+
>>>
|
|
791
|
+
>>> init()
|
|
792
|
+
>>> ret = _comm_switch_nic([0, 1], [True, False])
|
|
793
|
+
>>> print(ret)
|
|
794
|
+
True
|
|
795
|
+
|
|
796
|
+
"""
|
|
797
|
+
max_rank = get_group_size() - 1
|
|
798
|
+
if not all(isinstance(i, (list, tuple)) for i in (global_ranks, use_backup)):
|
|
799
|
+
raise ValueError(f"For _comm_switch_nic, the args 'global_ranks' and 'use_backup' should be list or tuple, "
|
|
800
|
+
f"but got 'global_ranks' type {type(global_ranks)}, 'use_backup' type {type(use_backup)}")
|
|
801
|
+
if not all(isinstance(rank, int) and not isinstance(rank, bool) and rank <= max_rank for rank in global_ranks):
|
|
802
|
+
raise ValueError(f"For _comm_switch_nic, the all elements in 'global_ranks' should be int number, and less "
|
|
803
|
+
f"than {get_group_size()}, but got 'global_ranks' : {global_ranks}.")
|
|
804
|
+
if not all(isinstance(ub, bool) for ub in use_backup):
|
|
805
|
+
raise ValueError(f"For _comm_switch_nic, the all elements in 'use_backup' should be bool, but got "
|
|
806
|
+
f"'use_backup' : {use_backup}.")
|
|
807
|
+
if len(set(global_ranks)) != len(global_ranks):
|
|
808
|
+
raise ValueError(f"For _comm_switch_nic, the all elements in 'global_ranks' should be different, but got "
|
|
809
|
+
f"'global_ranks' : {global_ranks}.")
|
|
810
|
+
if len(global_ranks) != len(use_backup):
|
|
811
|
+
raise ValueError(f"For _comm_switch_nic, the elements number in 'global_ranks' should be equal to 'use_backup',"
|
|
812
|
+
f" but got 'global_ranks' {len(global_ranks)} elements: {global_ranks},"
|
|
813
|
+
f" 'use_backup' {len(use_backup)} elements: {use_backup},.")
|
|
814
|
+
return _comm_switch_nic_helper(global_ranks, use_backup)
|
mindspore/context.py
CHANGED
|
@@ -207,7 +207,7 @@ class _Context:
|
|
|
207
207
|
parallel_mode = _get_auto_parallel_context("parallel_mode")
|
|
208
208
|
if parallel_mode not in (ParallelMode.DATA_PARALLEL, ParallelMode.STAND_ALONE, ParallelMode.AUTO_PARALLEL):
|
|
209
209
|
raise ValueError(f"Got {parallel_mode}, when the user enabled SEMI_AUTO_PARALELL, "
|
|
210
|
-
f"pynative mode
|
|
210
|
+
f"pynative mode does not support, you should set either "
|
|
211
211
|
f"context.set_auto_parallel_context(parallel_mode='data_parallel'), "
|
|
212
212
|
f"context.set_auto_parallel_context(parallel_mode='stand_alone') "
|
|
213
213
|
f"or context.set_auto_parallel_context(parallel_mode='auto_parallel').")
|
|
@@ -290,6 +290,8 @@ class _Context:
|
|
|
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
292
|
|
|
293
|
+
logger.info(f"Set deterministic setting to '{deterministic}'.")
|
|
294
|
+
|
|
293
295
|
# Must wait for all async created groups to be initialized so that
|
|
294
296
|
# deterministic feature could be consistent between all processes.
|
|
295
297
|
CollectiveManager.get_instance().wait_all_comm_init()
|
|
@@ -838,6 +840,25 @@ class _Context:
|
|
|
838
840
|
raise TypeError(f"For step num, the value type should be int, but got {type(step)}, {step}")
|
|
839
841
|
self.set_param(ms_ctx_param.last_triggered_step, step)
|
|
840
842
|
|
|
843
|
+
@staticmethod
|
|
844
|
+
def _check_speedup_config_str_value(key, value):
|
|
845
|
+
"""check speedup config str value"""
|
|
846
|
+
if key in ["pp_1f1b_overlap", "recompute_comm_overlap", "recomputation_communication_overlap"]:
|
|
847
|
+
if isinstance(value, str):
|
|
848
|
+
values = value.split(",")
|
|
849
|
+
for v in values:
|
|
850
|
+
if v not in ['AlltoAll', 'AlltoAllV', 'MorphAllGather', 'AllReduce',
|
|
851
|
+
'AllGather', 'ReduceScatter', 'MorphReduceScatter', '']:
|
|
852
|
+
raise ValueError("{} 's value should be subset of ['AlltoAll', 'AlltoAllV',"
|
|
853
|
+
" 'MorphAllGather', 'AllGather', 'ReduceScatter',"
|
|
854
|
+
" 'MorphReduceScatter', 'AllReduce'].".format(key))
|
|
855
|
+
return value
|
|
856
|
+
if value:
|
|
857
|
+
return "AlltoAll,AlltoAllV,AllGather,ReduceScatter,AllReduce"
|
|
858
|
+
return ""
|
|
859
|
+
|
|
860
|
+
return value
|
|
861
|
+
|
|
841
862
|
def _set_speedup_config_path(self, speedup_config_path):
|
|
842
863
|
""""Check and set speedup config for auto parallel."""
|
|
843
864
|
if speedup_config_path is None or speedup_config_path == "":
|
|
@@ -848,8 +869,8 @@ class _Context:
|
|
|
848
869
|
f"{speedup_config_real_path} does not exist, please check whether the "
|
|
849
870
|
f"'parallel_speed_up_json_path' is correct.")
|
|
850
871
|
try:
|
|
851
|
-
valid_option = {"recompute_comm_overlap": (ms_ctx_param.recompute_comm_overlap,
|
|
852
|
-
"recomputation_communication_overlap": (ms_ctx_param.recompute_comm_overlap,
|
|
872
|
+
valid_option = {"recompute_comm_overlap": (ms_ctx_param.recompute_comm_overlap, str),
|
|
873
|
+
"recomputation_communication_overlap": (ms_ctx_param.recompute_comm_overlap, str),
|
|
853
874
|
"matmul_grad_comm_overlap": (ms_ctx_param.matmul_grad_comm_overlap, bool),
|
|
854
875
|
"grad_matmul_communication_overlap": (ms_ctx_param.matmul_grad_comm_overlap, bool),
|
|
855
876
|
"enable_task_opt": (ms_ctx_param.enable_task_opt, bool),
|
|
@@ -908,17 +929,12 @@ class _Context:
|
|
|
908
929
|
f"Please use '{name_replace.get(key)}' instead.")
|
|
909
930
|
set_func, valid_type = valid_option.get(key)
|
|
910
931
|
if not isinstance(value, valid_type):
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
'AllGather', 'ReduceScatter', 'MorphReduceScatter']:
|
|
918
|
-
raise ValueError("{} 's value should be subset of ['AlltoAll', 'AlltoAllV',"
|
|
919
|
-
" 'MorphAllGather', 'AllGather', 'ReduceScatter',"
|
|
920
|
-
" 'MorphReduceScatter'].".format(key))
|
|
921
|
-
self.set_param(set_func, value)
|
|
932
|
+
if not ((key == "recompute_comm_overlap" or key == "recomputation_communication_overlap")
|
|
933
|
+
and isinstance(value, bool)):
|
|
934
|
+
raise TypeError(f"The value type of {key} must be {valid_type}, "
|
|
935
|
+
f"but got value is {value} and type is {type(value)}.")
|
|
936
|
+
value_new = self._check_speedup_config_str_value(key, value)
|
|
937
|
+
self.set_param(set_func, value_new)
|
|
922
938
|
except (TypeError, ValueError) as exo:
|
|
923
939
|
raise ValueError(str(exo) + "\nFor 'context.set_context', "
|
|
924
940
|
"open or load the 'speedup_config_path' file {} "
|
|
@@ -1557,7 +1573,8 @@ def set_context(**kwargs):
|
|
|
1557
1573
|
check_bprop (bool): This parameter will be deprecated and removed in future versions.
|
|
1558
1574
|
enable_reduce_precision (bool): This parameter will be deprecated and removed in a future versions.
|
|
1559
1575
|
grad_for_scalar (bool): This parameter will be deprecated and removed in future versions.
|
|
1560
|
-
support_binary (bool): Whether to support run .pyc or .so in graph mode.
|
|
1576
|
+
support_binary (bool): Whether to support run .pyc or .so in graph mode. This parameter will be deprecated and
|
|
1577
|
+
removed in a future version. Please use the environment variable `MS_SUPPORT_BINARY` instead.
|
|
1561
1578
|
|
|
1562
1579
|
Examples:
|
|
1563
1580
|
>>> import mindspore as ms
|
|
@@ -1769,8 +1786,9 @@ def set_ps_context(**kwargs):
|
|
|
1769
1786
|
Default: ``False`` .
|
|
1770
1787
|
config_file_path (str): Configuration file path used by recovery, parameter server training mode only
|
|
1771
1788
|
supports Server disaster recovery currently. Default: ``''`` .
|
|
1772
|
-
|
|
1773
|
-
|
|
1789
|
+
enable_ssl (bool): Set PS SSL mode enabled or disabled. Default: ``False``.
|
|
1790
|
+
Turning it off by default may be a security risk,
|
|
1791
|
+
and users need to ensure the security of the network environment.
|
|
1774
1792
|
client_password (str): Password to decrypt the secret key stored in the client certificate. Default: ``''`` .
|
|
1775
1793
|
server_password (str): Password to decrypt the secret key stored in the server certificate. Default: ``''`` .
|
|
1776
1794
|
|
|
@@ -1779,7 +1797,7 @@ def set_ps_context(**kwargs):
|
|
|
1779
1797
|
|
|
1780
1798
|
Examples:
|
|
1781
1799
|
>>> import mindspore as ms
|
|
1782
|
-
>>> ms.set_ps_context(enable_ps=True, enable_ssl=True, client_password='
|
|
1800
|
+
>>> ms.set_ps_context(enable_ps=True, enable_ssl=True, client_password='', server_password='')
|
|
1783
1801
|
"""
|
|
1784
1802
|
_set_ps_context(**kwargs)
|
|
1785
1803
|
|
|
@@ -1796,12 +1814,9 @@ def get_ps_context(attr_key):
|
|
|
1796
1814
|
- config_file_path (str, optional): Configuration file path used by recovery,
|
|
1797
1815
|
parameter server training mode only
|
|
1798
1816
|
supports Server disaster recovery currently. Default: ``''`` .
|
|
1799
|
-
- scheduler_manage_port (int, optional): Scheduler manage port used to scale out/in. Default: ``11202`` .
|
|
1800
1817
|
- enable_ssl (bool, optional): Set PS SSL mode enabled or disabled. Default: ``False`` .
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
- server_password (str, optional): Password to decrypt the secret key stored in the server certificate.
|
|
1804
|
-
Default: ``''`` .
|
|
1818
|
+
Turning it off by default may be a security risk,
|
|
1819
|
+
and users need to ensure the security of the network environment.
|
|
1805
1820
|
|
|
1806
1821
|
Returns:
|
|
1807
1822
|
Returns attribute value according to the key.
|