mindspore 2.6.0rc1__cp39-cp39-win_amd64.whl → 2.7.0rc1__cp39-cp39-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mindspore might be problematic. Click here for more details.
- mindspore/.commit_id +1 -1
- mindspore/__init__.py +1 -1
- mindspore/_c_dataengine.cp39-win_amd64.pyd +0 -0
- mindspore/_c_expression.cp39-win_amd64.pyd +0 -0
- mindspore/_c_mindrecord.cp39-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 +37 -62
- mindspore/_extends/parse/resources.py +39 -0
- mindspore/_extends/parse/standard_method.py +43 -13
- mindspore/_extends/parse/trope.py +8 -1
- mindspore/_extends/pijit/__init__.py +1 -2
- mindspore/amp.py +4 -4
- 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/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 +77 -16
- mindspore/common/api.py +238 -113
- mindspore/common/dtype.py +21 -11
- mindspore/common/dump.py +10 -15
- mindspore/common/generator.py +5 -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 +81 -81
- mindspore/communication/_comm_helper.py +46 -4
- mindspore/communication/management.py +79 -7
- mindspore/context.py +58 -40
- mindspore/dataset/core/config.py +3 -3
- mindspore/dataset/engine/datasets.py +20 -7
- mindspore/dataset/engine/datasets_user_defined.py +33 -3
- 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/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +3 -7
- 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 +27 -7
- 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 +6 -46
- mindspore/mint/distributed/__init__.py +1 -0
- mindspore/mint/distributed/distributed.py +212 -9
- 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 +137 -101
- 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/nn/cell.py +328 -502
- 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 +117 -110
- 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 +3 -3
- mindspore/nn/optim/adasum.py +2 -2
- mindspore/nn/optim/asgd.py +2 -0
- 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 +5 -5
- 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 +31 -13
- mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +42 -11
- mindspore/ops/auto_generate/gen_extend_func.py +23 -141
- mindspore/ops/auto_generate/gen_ops_def.py +727 -321
- mindspore/ops/auto_generate/gen_ops_prim.py +1721 -984
- 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 +133 -109
- 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 +9 -96
- mindspore/ops/function/debug_func.py +4 -3
- mindspore/ops/function/grad/grad_func.py +1 -1
- mindspore/ops/function/math_func.py +33 -540
- mindspore/ops/function/nn_func.py +28 -74
- mindspore/ops/function/other_func.py +4 -1
- mindspore/ops/function/random_func.py +44 -5
- mindspore/ops/function/vmap_func.py +2 -1
- mindspore/ops/functional.py +2 -3
- mindspore/ops/functional_overload.py +571 -6
- mindspore/ops/op_info_register.py +21 -0
- mindspore/ops/operations/__init__.py +16 -11
- mindspore/ops/operations/_custom_ops_utils.py +689 -34
- mindspore/ops/operations/_inner_ops.py +3 -6
- mindspore/ops/operations/_sequence_ops.py +1 -1
- mindspore/ops/operations/array_ops.py +2 -2
- mindspore/ops/operations/comm_ops.py +185 -26
- mindspore/ops/operations/custom_ops.py +294 -174
- mindspore/ops/operations/debug_ops.py +59 -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 +7 -39
- mindspore/ops/primitive.py +6 -10
- mindspore/ops/tensor_method.py +47 -8
- 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 +8 -3
- 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_def_cc_generator.py +0 -3
- 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 +11 -8
- mindspore/parallel/_cell_wrapper.py +113 -45
- 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 +14 -7
- mindspore/parallel/checkpoint_convert.py +3 -3
- mindspore/parallel/checkpoint_transform.py +11 -7
- 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 +6 -7
- 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 +3 -4
- mindspore/parallel/transform_safetensors.py +463 -174
- 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 +12 -6
- 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 +30 -32
- 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/tinyxml2.dll +0 -0
- mindspore/train/_utils.py +14 -4
- 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 +97 -16
- mindspore/train/data_sink.py +11 -2
- mindspore/train/dataset_helper.py +9 -0
- mindspore/train/model.py +135 -55
- 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 +163 -77
- mindspore/utils/sdc_detect.py +68 -0
- mindspore/utils/utils.py +6 -9
- mindspore/version.py +1 -1
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0rc1.dist-info}/METADATA +5 -4
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0rc1.dist-info}/RECORD +333 -371
- 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.0rc1.dist-info → mindspore-2.7.0rc1.dist-info}/WHEEL +0 -0
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0rc1.dist-info}/entry_points.txt +0 -0
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0rc1.dist-info}/top_level.txt +0 -0
|
@@ -13,45 +13,41 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
# ============================================================================
|
|
15
15
|
"""Profiler Action Controller"""
|
|
16
|
+
__all__ = []
|
|
17
|
+
|
|
16
18
|
from functools import partial
|
|
17
|
-
from typing import
|
|
19
|
+
from typing import Optional, Callable, Any, Dict
|
|
18
20
|
|
|
19
21
|
from mindspore.profiler.profiler_interface import ProfilerInterface
|
|
20
22
|
from mindspore.profiler.schedule import ProfilerAction
|
|
21
|
-
|
|
22
23
|
from mindspore import log as logger
|
|
23
24
|
|
|
24
|
-
__all__ = []
|
|
25
|
-
|
|
26
25
|
|
|
27
26
|
class ProfilerActionController:
|
|
28
27
|
"""
|
|
29
28
|
A controller class for managing profiler actions and transitions.
|
|
30
29
|
|
|
31
30
|
This class handles the actions and transitions between different profiler states.
|
|
32
|
-
It uses
|
|
33
|
-
|
|
31
|
+
It uses an action_map to determine the actions to take based on the previous and
|
|
32
|
+
current profiler actions.
|
|
34
33
|
|
|
35
34
|
Attributes:
|
|
36
|
-
profiler: The profiler instance associated with this controller.
|
|
37
35
|
prof_interface (ProfilerInterface): The profiler interface instance.
|
|
38
36
|
on_trace_ready (Optional[Callable[..., Any]]): A callback function to be called when the trace is ready.
|
|
39
|
-
|
|
40
|
-
normal_action_map (Dict): A map of normal transitions and their corresponding actions.
|
|
37
|
+
action_map (Dict): A map of state transitions and their corresponding actions.
|
|
41
38
|
"""
|
|
42
39
|
|
|
43
40
|
def __init__(self, prof_interface: ProfilerInterface, on_trace_ready: Optional[Callable[..., Any]] = None) -> None:
|
|
44
41
|
"""
|
|
45
|
-
Initializes a new instance of
|
|
42
|
+
Initializes a new instance of ProfilerActionController.
|
|
46
43
|
|
|
47
44
|
Args:
|
|
48
45
|
prof_interface (ProfilerInterface): The profiler interface instance.
|
|
49
46
|
on_trace_ready (Optional[Callable[..., Any]]): A callback function to be called when the trace is ready.
|
|
50
47
|
"""
|
|
51
48
|
self.prof_interface = prof_interface
|
|
52
|
-
self.abnormal_action_map: Dict = self.init_abnormal_action_map()
|
|
53
|
-
self.normal_action_map: Dict = self.init_normal_action_map()
|
|
54
49
|
self.on_trace_ready = on_trace_ready
|
|
50
|
+
self.action_map = self._init_action_map()
|
|
55
51
|
|
|
56
52
|
def _trace_ready(self):
|
|
57
53
|
"""
|
|
@@ -64,80 +60,34 @@ class ProfilerActionController:
|
|
|
64
60
|
|
|
65
61
|
def transit_action(self, prev_action: ProfilerAction, current_action: ProfilerAction) -> None:
|
|
66
62
|
"""
|
|
67
|
-
Handles actions between previous action and
|
|
63
|
+
Handles actions between previous action and current action
|
|
68
64
|
|
|
69
65
|
Args:
|
|
70
66
|
prev_action: The previous state
|
|
71
|
-
current_action: the
|
|
72
|
-
"""
|
|
73
|
-
# Check whether the action is in the abnormal map
|
|
74
|
-
action_list = self.abnormal_action_map.get((prev_action, current_action), [])
|
|
75
|
-
if not action_list:
|
|
76
|
-
if isinstance(prev_action, ProfilerAction) and isinstance(current_action, ProfilerAction):
|
|
77
|
-
# Check whether the action is in the normal map
|
|
78
|
-
action_list = self.handle_normal_action(prev_action, current_action)
|
|
79
|
-
if not action_list:
|
|
80
|
-
return
|
|
81
|
-
for action in action_list:
|
|
82
|
-
action()
|
|
83
|
-
|
|
84
|
-
def handle_normal_action(self, start_state: ProfilerAction, end_state: ProfilerAction) -> list:
|
|
67
|
+
current_action: the current state
|
|
85
68
|
"""
|
|
86
|
-
|
|
69
|
+
# Get the action list for this state transition
|
|
70
|
+
action_list = self.action_map.get((prev_action, current_action))
|
|
87
71
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
72
|
+
if action_list:
|
|
73
|
+
logger.info(f"ProfilerAction transition: {prev_action} -> {current_action}")
|
|
74
|
+
for action in action_list:
|
|
75
|
+
action()
|
|
91
76
|
|
|
92
|
-
|
|
93
|
-
process_action list
|
|
94
|
-
"""
|
|
95
|
-
process_action = []
|
|
96
|
-
initial_state = start_state
|
|
97
|
-
|
|
98
|
-
# Handle special case for ProfilerAction.RECORD_AND_SAVE to ProfilerAction.RECORD_AND_SAVE transition
|
|
99
|
-
if start_state == ProfilerAction.RECORD_AND_SAVE and end_state == ProfilerAction.RECORD_AND_SAVE:
|
|
100
|
-
process_action = [self.prof_interface.stop, self.prof_interface.finalize,
|
|
101
|
-
self._trace_ready, self.prof_interface.clear, self.prof_interface.init,
|
|
102
|
-
self.prof_interface.start]
|
|
103
|
-
else:
|
|
104
|
-
while start_state != end_state:
|
|
105
|
-
process_action.extend(self.normal_action_map[start_state])
|
|
106
|
-
start_state = ProfilerAction.get_by_value((start_state.value + 1) % len(ProfilerAction))
|
|
107
|
-
|
|
108
|
-
# Handle special cases for NONE to NONE, WARM_UP to WARM_UP, RECORD to RECORD transitions
|
|
109
|
-
if initial_state == start_state and initial_state != ProfilerAction.RECORD_AND_SAVE:
|
|
110
|
-
process_action = []
|
|
111
|
-
|
|
112
|
-
return process_action
|
|
113
|
-
|
|
114
|
-
def init_normal_action_map(self) -> dict:
|
|
77
|
+
def _init_action_map(self) -> Dict:
|
|
115
78
|
"""
|
|
116
|
-
|
|
79
|
+
Initialize the action map for state transitions.
|
|
117
80
|
|
|
118
81
|
Returns:
|
|
119
|
-
|
|
82
|
+
Dict: A map of state transitions and their corresponding actions.
|
|
120
83
|
"""
|
|
121
|
-
|
|
122
|
-
ProfilerAction.NONE: [
|
|
123
|
-
ProfilerAction.WARM_UP: [self.prof_interface.
|
|
124
|
-
ProfilerAction.RECORD: [],
|
|
125
|
-
ProfilerAction.RECORD_AND_SAVE: [
|
|
126
|
-
|
|
127
|
-
self.prof_interface.finalize,
|
|
128
|
-
self._trace_ready,
|
|
129
|
-
self.prof_interface.clear
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
def init_abnormal_action_map(self) -> dict:
|
|
134
|
-
"""
|
|
135
|
-
Generate a abnormal action map
|
|
84
|
+
action_map = {
|
|
85
|
+
(ProfilerAction.NONE, ProfilerAction.NONE): [],
|
|
86
|
+
(ProfilerAction.NONE, ProfilerAction.WARM_UP): [self.prof_interface.init],
|
|
87
|
+
(ProfilerAction.NONE, ProfilerAction.RECORD): [self.prof_interface.init, self.prof_interface.start],
|
|
88
|
+
(ProfilerAction.NONE, ProfilerAction.RECORD_AND_SAVE): [self.prof_interface.init,
|
|
89
|
+
self.prof_interface.start],
|
|
136
90
|
|
|
137
|
-
Returns:
|
|
138
|
-
abnormal_action_map map
|
|
139
|
-
"""
|
|
140
|
-
return {
|
|
141
91
|
(ProfilerAction.WARM_UP, ProfilerAction.NONE): [
|
|
142
92
|
partial(logger.warning, "Incorrect schedule: WARMUP followed by NONE"),
|
|
143
93
|
self.prof_interface.start,
|
|
@@ -145,6 +95,10 @@ class ProfilerActionController:
|
|
|
145
95
|
self.prof_interface.finalize,
|
|
146
96
|
self.prof_interface.clear
|
|
147
97
|
],
|
|
98
|
+
(ProfilerAction.WARM_UP, ProfilerAction.WARM_UP): [],
|
|
99
|
+
(ProfilerAction.WARM_UP, ProfilerAction.RECORD): [self.prof_interface.start],
|
|
100
|
+
(ProfilerAction.WARM_UP, ProfilerAction.RECORD_AND_SAVE): [self.prof_interface.start],
|
|
101
|
+
|
|
148
102
|
(ProfilerAction.RECORD, ProfilerAction.NONE): [
|
|
149
103
|
partial(logger.warning, "Incorrect schedule: RECORD followed by NONE"),
|
|
150
104
|
self.prof_interface.stop,
|
|
@@ -157,7 +111,40 @@ class ProfilerActionController:
|
|
|
157
111
|
self.prof_interface.finalize,
|
|
158
112
|
self.prof_interface.clear
|
|
159
113
|
],
|
|
160
|
-
|
|
114
|
+
(ProfilerAction.RECORD, ProfilerAction.RECORD): [],
|
|
115
|
+
(ProfilerAction.RECORD, ProfilerAction.RECORD_AND_SAVE): [],
|
|
116
|
+
|
|
117
|
+
(ProfilerAction.RECORD_AND_SAVE, ProfilerAction.NONE): [
|
|
118
|
+
self.prof_interface.stop,
|
|
119
|
+
self.prof_interface.finalize,
|
|
120
|
+
self._trace_ready,
|
|
121
|
+
self.prof_interface.clear
|
|
122
|
+
],
|
|
123
|
+
(ProfilerAction.RECORD_AND_SAVE, ProfilerAction.WARM_UP): [
|
|
124
|
+
self.prof_interface.stop,
|
|
125
|
+
self.prof_interface.finalize,
|
|
126
|
+
self._trace_ready,
|
|
127
|
+
self.prof_interface.clear,
|
|
128
|
+
self.prof_interface.init,
|
|
129
|
+
],
|
|
130
|
+
(ProfilerAction.RECORD_AND_SAVE, ProfilerAction.RECORD): [
|
|
131
|
+
self.prof_interface.stop,
|
|
132
|
+
self.prof_interface.finalize,
|
|
133
|
+
self._trace_ready,
|
|
134
|
+
self.prof_interface.clear,
|
|
135
|
+
self.prof_interface.init,
|
|
136
|
+
self.prof_interface.start
|
|
137
|
+
],
|
|
138
|
+
(ProfilerAction.RECORD_AND_SAVE, ProfilerAction.RECORD_AND_SAVE): [
|
|
139
|
+
self.prof_interface.stop,
|
|
140
|
+
self.prof_interface.finalize,
|
|
141
|
+
self._trace_ready,
|
|
142
|
+
self.prof_interface.clear,
|
|
143
|
+
self.prof_interface.init,
|
|
144
|
+
self.prof_interface.start
|
|
145
|
+
],
|
|
146
|
+
|
|
147
|
+
# Used for exit action
|
|
161
148
|
(ProfilerAction.WARM_UP, None): [
|
|
162
149
|
partial(logger.warning,
|
|
163
150
|
"Incorrect schedule: Stop profiler while current state is WARMUP "
|
|
@@ -185,3 +172,4 @@ class ProfilerActionController:
|
|
|
185
172
|
self.prof_interface.clear
|
|
186
173
|
]
|
|
187
174
|
}
|
|
175
|
+
return action_map
|
mindspore/profiler/schedule.py
CHANGED
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
# ============================================================================
|
|
15
15
|
"""Profiler Schedule"""
|
|
16
|
+
__all__ = ["ProfilerAction", "Schedule"]
|
|
17
|
+
|
|
16
18
|
from enum import Enum
|
|
17
19
|
|
|
18
20
|
from mindspore import log as logger
|
|
19
21
|
|
|
20
|
-
__all__ = ["ProfilerAction", "Schedule"]
|
|
21
|
-
|
|
22
22
|
|
|
23
23
|
class ProfilerAction(Enum):
|
|
24
24
|
"""
|
|
@@ -83,8 +83,14 @@ class Schedule:
|
|
|
83
83
|
must be greater than or equal to 0. Default value: ``0``.
|
|
84
84
|
repeat (int, optional): The number of times to repeat the cycle.
|
|
85
85
|
If repeat is set to 0, the Profiler will determine the repeat value based on the number of times the model
|
|
86
|
-
is trained,
|
|
87
|
-
|
|
86
|
+
is trained, for example, if the total training steps are 100, wait+active+warmup=10, skip_first=10,
|
|
87
|
+
Then repeat=(100-10)/10=9, indicating that the execution is repeated 9 timeswhich will
|
|
88
|
+
generate one more performance data with incomplete collection. The data in the last step is abnormal data
|
|
89
|
+
that users do not need to pay attention to. Suggest configuring integers greater than 0. When using
|
|
90
|
+
cluster analysis tools or MindStudio Insight to view, it is recommended to configure it as 1;
|
|
91
|
+
If the setting is greater than 1, the collected performance data folder needs to be divided into repeat and
|
|
92
|
+
other parts, placed in different folders for re-parsing, and classified according to the timestamp order in
|
|
93
|
+
the folder name. Default value: ``0``.
|
|
88
94
|
skip_first (int, optional): The number of steps to skip at the beginning. Must be greater than or equal to 0.
|
|
89
95
|
Default value: ``0``
|
|
90
96
|
|
mindspore/rewrite/node/node.py
CHANGED
|
@@ -124,9 +124,14 @@ class Node:
|
|
|
124
124
|
self._init_cls = None
|
|
125
125
|
|
|
126
126
|
@classmethod
|
|
127
|
-
def create_call_method(
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
def create_call_method(
|
|
128
|
+
cls,
|
|
129
|
+
ast_node: Optional[ast.AST],
|
|
130
|
+
targets: [Union[ScopedValue, str]],
|
|
131
|
+
func_name: Union[ScopedValue, str],
|
|
132
|
+
args: [ScopedValue] = None,
|
|
133
|
+
kwargs: {str: ScopedValue} = None, # pylint: disable=bad-whitespace
|
|
134
|
+
name: str = ""):
|
|
130
135
|
"""
|
|
131
136
|
Class method of Node. Instantiate an instance of node whose type is CallCell. A CallCell node represents an
|
|
132
137
|
invoking to cell-op.
|
|
@@ -227,8 +232,12 @@ class Node:
|
|
|
227
232
|
return cls(NodeType.MathOps, ast_node, targets, op_type, args, None, name, None)
|
|
228
233
|
|
|
229
234
|
@staticmethod
|
|
230
|
-
def _create_call_function(
|
|
231
|
-
|
|
235
|
+
def _create_call_function(
|
|
236
|
+
function: FunctionType,
|
|
237
|
+
targets: [Union[ScopedValue, str]],
|
|
238
|
+
args: [ScopedValue] = None,
|
|
239
|
+
kwargs: {str: ScopedValue} = None # pylint: disable=bad-whitespace
|
|
240
|
+
):
|
|
232
241
|
"""
|
|
233
242
|
Create a node that corresponds to a function call.
|
|
234
243
|
|
|
@@ -275,9 +284,14 @@ class Node:
|
|
|
275
284
|
return CallFunction(targets, func_name, args, kwargs, node_name, ast_node, None, None, func_obj, False)
|
|
276
285
|
|
|
277
286
|
@staticmethod
|
|
278
|
-
def create_call_op(
|
|
279
|
-
|
|
280
|
-
|
|
287
|
+
def create_call_op(
|
|
288
|
+
op: Union[Cell, Primitive],
|
|
289
|
+
ast_node: Optional[ast.AST],
|
|
290
|
+
targets: [Union[ScopedValue, str]],
|
|
291
|
+
args: [ScopedValue] = None,
|
|
292
|
+
kwargs: {str: ScopedValue} = None, # pylint: disable=bad-whitespace
|
|
293
|
+
node_name: str = "",
|
|
294
|
+
is_sub_net: bool = False):
|
|
281
295
|
"""
|
|
282
296
|
Static method of Node. Instantiate an instance of node whose type is `CallCell` or `CallPrimitive`.
|
|
283
297
|
If op is custom defined, it is treated by TreeNode.
|
|
@@ -325,9 +339,15 @@ class Node:
|
|
|
325
339
|
return Node.create_call_buildin_op(op, ast_node, new_targets, func_name, args, kwargs, node_name)
|
|
326
340
|
|
|
327
341
|
@classmethod
|
|
328
|
-
def create_call_buildin_op(
|
|
329
|
-
|
|
330
|
-
|
|
342
|
+
def create_call_buildin_op(
|
|
343
|
+
cls,
|
|
344
|
+
op: Union[Cell, Primitive],
|
|
345
|
+
ast_node: Optional[ast.AST],
|
|
346
|
+
targets: [ScopedValue],
|
|
347
|
+
func_name: ScopedValue,
|
|
348
|
+
args: [ScopedValue] = None,
|
|
349
|
+
kwargs: {str: ScopedValue} = None, # pylint: disable=bad-whitespace
|
|
350
|
+
node_name: str = ""):
|
|
331
351
|
"""
|
|
332
352
|
Class method of Node. Instantiate an instance of node whose type is `CallCell` or `CallPrimitive`.
|
|
333
353
|
A `CallCell` node represents an invoking to cell-op.
|
|
@@ -46,7 +46,7 @@ class AssignParser(Parser):
|
|
|
46
46
|
"""Parse ast.Assign in construct function to node of SymbolTree."""
|
|
47
47
|
|
|
48
48
|
# Types for creating Cell Container node
|
|
49
|
-
types_for_cell_container = [SequentialCell
|
|
49
|
+
types_for_cell_container = [SequentialCell]
|
|
50
50
|
# If mindspore built-in function to be parsered or skipped
|
|
51
51
|
_skip_ms_function = False
|
|
52
52
|
# Functions in black list will not be parsed
|
|
@@ -1790,7 +1790,7 @@ class SymbolTree(Observer, Observable, NodeManager):
|
|
|
1790
1790
|
if idx > 0:
|
|
1791
1791
|
name_need_suffix[name] = suffix_alias(alias, idx)
|
|
1792
1792
|
break
|
|
1793
|
-
|
|
1793
|
+
if ast_node.module.startswith(path):
|
|
1794
1794
|
# e.g. origin code is 'from a.b import A' and new code is 'from a.b.c import A'
|
|
1795
1795
|
# then we just need to update name to A_{idx}
|
|
1796
1796
|
if idx > 0:
|
|
@@ -124,9 +124,9 @@ class GPUEnvChecker(EnvChecker):
|
|
|
124
124
|
for path in self.cuda_lib_path:
|
|
125
125
|
real_path = glob.glob(path + "/lib*/libcudart.so.*.*.*")
|
|
126
126
|
# /usr/lib/x86_64-linux-gnu is a default dir for cuda10.1 on ubuntu.
|
|
127
|
-
if real_path
|
|
127
|
+
if not real_path:
|
|
128
128
|
real_path = glob.glob(path + "/x86_64-linux-gnu/libcudart.so.*.*.*")
|
|
129
|
-
if real_path
|
|
129
|
+
if not real_path:
|
|
130
130
|
continue
|
|
131
131
|
ls_cudart = subprocess.run(["ls", real_path[0]], timeout=10, text=True,
|
|
132
132
|
capture_output=True, check=False)
|
|
@@ -258,7 +258,7 @@ class AscendEnvChecker(EnvChecker):
|
|
|
258
258
|
|
|
259
259
|
def __init__(self, library_path):
|
|
260
260
|
self.library_path = library_path
|
|
261
|
-
self.version = ["7.
|
|
261
|
+
self.version = ["7.7", "7.8", "8.2"]
|
|
262
262
|
|
|
263
263
|
# env
|
|
264
264
|
self.path = os.getenv("PATH")
|
|
@@ -293,7 +293,7 @@ class AscendEnvChecker(EnvChecker):
|
|
|
293
293
|
|
|
294
294
|
cur_version = self._read_version(self.compiler_version)
|
|
295
295
|
custom_version_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
|
296
|
-
"../lib/plugin/ascend/
|
|
296
|
+
"../lib/plugin/ascend/custom_ascendc_910b/version.info")
|
|
297
297
|
with open(custom_version_path, 'r') as f:
|
|
298
298
|
all_info = f.readlines()
|
|
299
299
|
for line in all_info:
|
|
@@ -375,18 +375,15 @@ class AscendEnvChecker(EnvChecker):
|
|
|
375
375
|
curr_path = os.path.realpath(os.path.dirname(__file__))
|
|
376
376
|
cust_aicpu_path = os.path.realpath(os.path.join(curr_path, "../lib/plugin/ascend/custom_aicpu_ops"))
|
|
377
377
|
cust_aicore_path = os.path.realpath(os.path.join(curr_path, "../lib/plugin/ascend/custom_aicore_ops"))
|
|
378
|
-
cust_ascendc_ascend910_path = os.path.realpath(
|
|
379
|
-
os.path.join(curr_path, "../lib/plugin/ascend/custom_ascendc_910"))
|
|
380
378
|
cust_ascendc_ascend910b_path = os.path.realpath(
|
|
381
379
|
os.path.join(curr_path, "../lib/plugin/ascend/custom_ascendc_910b"))
|
|
382
380
|
if os.getenv('ASCEND_CUSTOM_OPP_PATH'):
|
|
383
381
|
os.environ['ASCEND_CUSTOM_OPP_PATH'] = os.environ['ASCEND_CUSTOM_OPP_PATH'] + ":" + \
|
|
384
|
-
cust_ascendc_ascend910_path + ":" + cust_ascendc_ascend910b_path + \
|
|
385
|
-
":" + cust_aicore_path + ":" + cust_aicpu_path
|
|
386
|
-
else:
|
|
387
|
-
os.environ['ASCEND_CUSTOM_OPP_PATH'] = cust_ascendc_ascend910_path + ":" + \
|
|
388
382
|
cust_ascendc_ascend910b_path + ":" + cust_aicore_path + ":" + \
|
|
389
383
|
cust_aicpu_path
|
|
384
|
+
else:
|
|
385
|
+
os.environ['ASCEND_CUSTOM_OPP_PATH'] = cust_ascendc_ascend910b_path + ":" + cust_aicore_path + ":" + \
|
|
386
|
+
cust_aicpu_path
|
|
390
387
|
# Ignore ge infer missing error. To be removed after infers are completed.
|
|
391
388
|
os.environ['FAST_IGNORE_INFER_ERROR'] = "1"
|
|
392
389
|
os.environ['IGNORE_INFER_ERROR'] = "1"
|
mindspore/runtime/__init__.py
CHANGED
|
@@ -18,8 +18,8 @@ The runtime interface.
|
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
20
|
from mindspore.runtime.executor import launch_blocking, dispatch_threads_num, set_cpu_affinity, set_kernel_launch_group
|
|
21
|
-
from mindspore.runtime.memory import set_memory, memory_stats, memory_reserved, max_memory_reserved, empty_cache
|
|
22
|
-
reset_peak_memory_stats, memory_summary, memory_allocated
|
|
21
|
+
from mindspore.runtime.memory import set_memory, memory_stats, memory_reserved, max_memory_reserved, empty_cache, \
|
|
22
|
+
memory_replay, reset_peak_memory_stats, memory_summary, memory_allocated, \
|
|
23
23
|
max_memory_allocated, reset_max_memory_reserved, reset_max_memory_allocated
|
|
24
24
|
from mindspore.runtime.stream import Stream, synchronize, set_cur_stream, current_stream, \
|
|
25
25
|
default_stream, communication_stream, StreamCtx
|
|
@@ -29,9 +29,9 @@ from .executor import launch_blocking
|
|
|
29
29
|
__all__ = [
|
|
30
30
|
"launch_blocking", "dispatch_threads_num", "set_cpu_affinity", "set_kernel_launch_group",
|
|
31
31
|
"Stream", "communication_stream", "synchronize", "set_cur_stream", "current_stream", "default_stream", "StreamCtx",
|
|
32
|
-
"set_memory", "memory_stats", "memory_reserved", "max_memory_reserved", "empty_cache", "
|
|
33
|
-
"
|
|
34
|
-
"reset_max_memory_allocated", "Event"
|
|
32
|
+
"set_memory", "memory_stats", "memory_reserved", "max_memory_reserved", "empty_cache", "memory_replay",
|
|
33
|
+
"reset_peak_memory_stats", "memory_summary", "memory_allocated", "max_memory_allocated",
|
|
34
|
+
"reset_max_memory_reserved", "reset_max_memory_allocated", "Event"
|
|
35
35
|
]
|
|
36
36
|
|
|
37
37
|
__all__.sort()
|
mindspore/runtime/event.py
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
from mindspore._c_expression import Event as Event_
|
|
17
17
|
from mindspore._c_expression import Stream as Stream_
|
|
18
18
|
from mindspore._c_expression import current_stream as current_stream_
|
|
19
|
-
from mindspore import _checkparam as Validator
|
|
20
19
|
from .device import _is_supported
|
|
21
20
|
|
|
22
21
|
function_event_status = {'Event': False, 'wait': False}
|
|
@@ -71,9 +70,16 @@ class Event(Event_):
|
|
|
71
70
|
function_event_status['Event'] = True
|
|
72
71
|
if not _is_supported():
|
|
73
72
|
return
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
if not isinstance(enable_timing, bool):
|
|
74
|
+
raise TypeError(
|
|
75
|
+
f"For 'Event', the 'enable_timing' must be a bool,"
|
|
76
|
+
f" but got {type(enable_timing).__name__}."
|
|
77
|
+
)
|
|
78
|
+
if not isinstance(blocking, bool):
|
|
79
|
+
raise TypeError(
|
|
80
|
+
f"For 'Event', the 'blocking' must be a bool,"
|
|
81
|
+
f" but got {type(blocking).__name__}."
|
|
82
|
+
)
|
|
77
83
|
super().__init__(enable_timing, blocking)
|
|
78
84
|
|
|
79
85
|
def record(self, stream=None):
|
mindspore/runtime/executor.py
CHANGED
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
"""Executor manager interfaces."""
|
|
17
17
|
from mindspore._c_expression import RuntimeConf
|
|
18
|
-
from mindspore.runtime.thread_bind_core import
|
|
18
|
+
from mindspore.runtime.thread_bind_core import _get_cpu_affinity_strategy, _validate_affinity_cpu_list, \
|
|
19
|
+
_validate_module_cpu_index, _adapt_to_dict
|
|
19
20
|
from mindspore._checkparam import args_type_check
|
|
20
21
|
from mindspore import _checkparam as Validator
|
|
21
22
|
from mindspore import log as logger
|
|
@@ -64,57 +65,64 @@ def dispatch_threads_num(threads_num):
|
|
|
64
65
|
return RuntimeConf.get_instance().set_dispatch_threads_num(threads_num)
|
|
65
66
|
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
def set_cpu_affinity(enable_affinity, affinity_cpu_list=None):
|
|
68
|
+
def set_cpu_affinity(enable_affinity, affinity_cpu_list=None, module_to_cpu_dict=None):
|
|
69
69
|
"""
|
|
70
|
-
Enable thread-level core binding to
|
|
71
|
-
runtime, minddata),
|
|
70
|
+
Enable thread-level core binding to allocate specific CPU cores for key MindSpore modules (main thread, pynative,
|
|
71
|
+
runtime, and minddata), preventing performance instability caused by CPU core contention among MindSpore threads.
|
|
72
72
|
|
|
73
73
|
Note:
|
|
74
|
-
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
- Flexible Core Binding Configuration:
|
|
75
|
+
|
|
76
|
+
1. When `affinity_cpu_list` is not specified, the process automatically determines the CPU affinity range
|
|
77
|
+
based on available CPU cores, NUMA nodes, and device resources in the environment.
|
|
78
|
+
2. When `affinity_cpu_list` is specified, the process manually binds to the CPU range defined in
|
|
79
|
+
`affinity_cpu_list`.
|
|
80
|
+
3. When `module_to_cpu_dict` is not specified, the default bind-core strategy assigns the CPU
|
|
81
|
+
cores to the `"main"` module.
|
|
82
|
+
4. When `module_to_cpu_dict` is specified, the process manually binds each module to CPU ranges as
|
|
83
|
+
defined in `module_to_cpu_dict`.
|
|
84
|
+
- The automated bind-core strategy generation scenario invokes system commands to obtain CPU, NUMA node, and
|
|
79
85
|
device resources on the environment, and some commands cannot be executed successfully due to environment
|
|
80
|
-
differences; the automated bind-core
|
|
86
|
+
differences; the automated bind-core strategy generated will vary according to the resources available on the
|
|
81
87
|
environment:
|
|
82
88
|
|
|
83
89
|
1. `cat /sys/fs/cgroup/cpuset/cpuset.cpus`, to obtain the available CPU resources on the environment; if the
|
|
84
90
|
execution of this command fails, the bind-core function will not take effect.
|
|
85
91
|
2. `npu-smi info -m`, get the available NPU resources on the environment; if the execution of this command
|
|
86
|
-
fails, the bind-core
|
|
92
|
+
fails, the bind-core strategy will be generated only based on the available CPU resources,
|
|
87
93
|
without considering the device affinity.
|
|
88
94
|
3. `npu-smi info -t board -i {NPU_ID} -c {CHIP_ID}`, get NPU details based on the logical ID of the device;
|
|
89
|
-
if the execution of this command fails, the bind-core
|
|
95
|
+
if the execution of this command fails, the bind-core strategy is generated based on the available CPU
|
|
90
96
|
resources only, regardless of device affinity.
|
|
91
97
|
4. `lspci -s {PCIe_No} -vvv`, get the hardware information of the device on the environment; if the execution
|
|
92
|
-
of this command fails, the bind-core
|
|
98
|
+
of this command fails, the bind-core strategy is generated only based on the available CPU resources,
|
|
93
99
|
without considering the device affinity.
|
|
94
100
|
5. `lscpu`, get information about CPUs and NUMA nodes on the environment; if the execution of this command
|
|
95
|
-
fails, only the available CPU resources are used to generate the bind-core
|
|
101
|
+
fails, only the available CPU resources are used to generate the bind-core strategy, without considering
|
|
96
102
|
the device affinity.
|
|
97
103
|
|
|
98
104
|
Args:
|
|
99
|
-
enable_affinity (bool):
|
|
100
|
-
affinity_cpu_list (
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
enable_affinity (bool): Enables/disables thread-level core binding.
|
|
106
|
+
affinity_cpu_list (list, optional): Manually specifies the CPU affinity range for the process. Format:
|
|
107
|
+
`["cpuidX-cpuidY"]` (e.g., ``["0-3", "8-11"]``). Default: ``None`` (uses auto-generated binding strategy
|
|
108
|
+
based on system resources). Passing an empty list `[]` behaves the same as ``None``.
|
|
109
|
+
module_to_cpu_dict (dict, optional): Customizes core binding for specific modules. Valid keys
|
|
110
|
+
(module names) are ``"main"``, ``"runtime"``, ``"pynative"``, ``"minddata"``. Valid value is a list
|
|
111
|
+
of ``int`` indices representing CPU cores (e.g., ``{"main": [0,1], "minddata": [6,7]}``).
|
|
112
|
+
Default: ``None`` (automatically binds core for module `"main"`). Passing an empty dict `{}`
|
|
113
|
+
behaves the same as ``None``.
|
|
105
114
|
|
|
106
115
|
Raises:
|
|
107
|
-
TypeError: The
|
|
108
|
-
TypeError: The
|
|
109
|
-
|
|
110
|
-
ValueError:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
available in the environment.
|
|
116
|
+
TypeError: The `enable_affinity` parameter is not a boolean.
|
|
117
|
+
TypeError: The `affinity_cpu_list` parameter is neither a list nor ``None``.
|
|
118
|
+
TypeError: An element in `affinity_cpu_list` is not a string.
|
|
119
|
+
ValueError: An element in `affinity_cpu_list` does not follow the ``["cpuidX-cpuidY"]`` format.
|
|
120
|
+
TypeError: The `module_to_cpu_dict` parameter is neither a dictionary nor ``None``.
|
|
121
|
+
TypeError: A key in `module_to_cpu_dict` is not a string.
|
|
122
|
+
TypeError: A value in `module_to_cpu_dict` is not a list.
|
|
123
|
+
ValueError: An element in `module_to_cpu_dict` values is not a non-negative integer.
|
|
124
|
+
RuntimeError: In custom core binding scenarios, the specified CPU cores for a device are unavailable
|
|
125
|
+
in the environment.
|
|
118
126
|
RuntimeError: The `mindspore.runtime.set_cpu_affinity` API is called repeatedly.
|
|
119
127
|
|
|
120
128
|
Examples:
|
|
@@ -124,24 +132,31 @@ def set_cpu_affinity(enable_affinity, affinity_cpu_list=None):
|
|
|
124
132
|
>>>
|
|
125
133
|
>>> import mindspore as ms
|
|
126
134
|
>>> ms.set_device("Ascend", 1)
|
|
127
|
-
>>> ms.runtime.set_cpu_affinity(True,
|
|
135
|
+
>>> ms.runtime.set_cpu_affinity(True, ["10-19", "23-40"])
|
|
136
|
+
>>>
|
|
137
|
+
>>> import mindspore as ms
|
|
138
|
+
>>> ms.set_device("Ascend", 1)
|
|
139
|
+
>>> ms.runtime.set_cpu_affinity(True, ["10-19", "23-40"], {"main": [0,1,2,3], "runtime": [4,5,6]})
|
|
128
140
|
"""
|
|
141
|
+
affinity_cpu_list = _adapt_to_dict(affinity_cpu_list)
|
|
142
|
+
if affinity_cpu_list is False:
|
|
143
|
+
return
|
|
144
|
+
|
|
145
|
+
_validate_affinity_cpu_list(affinity_cpu_list)
|
|
146
|
+
_validate_module_cpu_index(module_to_cpu_dict)
|
|
147
|
+
|
|
129
148
|
if RuntimeConf.get_instance().is_thread_bind_core_configured():
|
|
130
149
|
raise RuntimeError("The 'mindspore.runtime.set_cpu_affinity' cannot be set repeatedly.")
|
|
131
|
-
if enable_affinity:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if bind_policy_flag:
|
|
139
|
-
RuntimeConf.get_instance().thread_bind_core_with_policy(module_bind_core_policy)
|
|
140
|
-
else:
|
|
141
|
-
RuntimeConf.get_instance().thread_bind_core(module_bind_core_policy)
|
|
142
|
-
else:
|
|
150
|
+
if not enable_affinity:
|
|
151
|
+
RuntimeConf.get_instance().set_thread_bind_core_configured()
|
|
152
|
+
return
|
|
153
|
+
module_bind_core_strategy = _get_cpu_affinity_strategy(affinity_cpu_list, module_to_cpu_dict)
|
|
154
|
+
if not module_bind_core_strategy:
|
|
155
|
+
logger.warning("set_cpu_affinity is not enabled because the environment does not meet the "
|
|
156
|
+
"basic conditions for binding core.")
|
|
143
157
|
RuntimeConf.get_instance().set_thread_bind_core_configured()
|
|
144
158
|
return
|
|
159
|
+
RuntimeConf.get_instance().thread_bind_core(module_bind_core_strategy)
|
|
145
160
|
|
|
146
161
|
|
|
147
162
|
@args_type_check(thread_num=int, kernel_group_num=int)
|