mindspore 2.3.0__cp39-cp39-win_amd64.whl → 2.4.0__cp39-cp39-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mindspore might be problematic. Click here for more details.
- mindspore/.commit_id +1 -1
- mindspore/__init__.py +3 -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 +50 -9
- mindspore/_extends/parse/compile_config.py +41 -0
- mindspore/_extends/parse/parser.py +9 -7
- mindspore/_extends/parse/standard_method.py +52 -14
- mindspore/_extends/pijit/pijit_func_white_list.py +350 -24
- mindspore/amp.py +24 -10
- 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/common/__init__.py +6 -4
- mindspore/common/_pijit_context.py +190 -0
- mindspore/common/_register_for_tensor.py +2 -1
- mindspore/common/_tensor_overload.py +139 -0
- mindspore/common/api.py +102 -87
- mindspore/common/dump.py +5 -6
- mindspore/common/generator.py +1 -7
- mindspore/common/hook_handle.py +14 -26
- mindspore/common/mindir_util.py +2 -2
- mindspore/common/parameter.py +46 -13
- mindspore/common/recompute.py +39 -9
- mindspore/common/sparse_tensor.py +7 -3
- mindspore/common/tensor.py +209 -29
- mindspore/communication/__init__.py +1 -1
- mindspore/communication/_comm_helper.py +38 -3
- mindspore/communication/comm_func.py +310 -55
- mindspore/communication/management.py +14 -14
- mindspore/context.py +123 -22
- mindspore/dataset/__init__.py +1 -1
- mindspore/dataset/audio/__init__.py +1 -1
- mindspore/dataset/core/config.py +7 -0
- mindspore/dataset/core/validator_helpers.py +7 -0
- mindspore/dataset/engine/cache_client.py +1 -1
- mindspore/dataset/engine/datasets.py +72 -44
- mindspore/dataset/engine/datasets_audio.py +7 -7
- mindspore/dataset/engine/datasets_standard_format.py +53 -3
- mindspore/dataset/engine/datasets_text.py +20 -20
- mindspore/dataset/engine/datasets_user_defined.py +174 -104
- mindspore/dataset/engine/datasets_vision.py +33 -33
- mindspore/dataset/engine/iterators.py +29 -0
- mindspore/dataset/engine/obs/util.py +7 -0
- mindspore/dataset/engine/queue.py +114 -60
- mindspore/dataset/engine/serializer_deserializer.py +2 -2
- mindspore/dataset/engine/validators.py +34 -14
- mindspore/dataset/text/__init__.py +1 -4
- mindspore/dataset/transforms/__init__.py +0 -3
- mindspore/dataset/utils/line_reader.py +2 -0
- mindspore/dataset/vision/__init__.py +1 -4
- mindspore/dataset/vision/utils.py +1 -1
- mindspore/dataset/vision/validators.py +2 -1
- mindspore/dnnl.dll +0 -0
- mindspore/{nn/extend → experimental/es}/__init__.py +4 -11
- mindspore/experimental/es/embedding_service.py +883 -0
- mindspore/{nn/layer → experimental/es}/embedding_service_layer.py +218 -30
- mindspore/experimental/llm_boost/__init__.py +21 -0
- mindspore/{nn/extend/layer → experimental/llm_boost/atb}/__init__.py +4 -8
- mindspore/experimental/llm_boost/atb/boost_base.py +211 -0
- mindspore/experimental/llm_boost/atb/llama_boost.py +115 -0
- mindspore/experimental/llm_boost/atb/qwen_boost.py +101 -0
- mindspore/experimental/llm_boost/register.py +129 -0
- mindspore/experimental/llm_boost/utils.py +31 -0
- mindspore/experimental/optim/adamw.py +85 -0
- mindspore/experimental/optim/optimizer.py +3 -0
- mindspore/hal/__init__.py +3 -3
- mindspore/hal/contiguous_tensors_handle.py +175 -0
- mindspore/hal/stream.py +18 -0
- mindspore/include/api/model_group.h +13 -1
- mindspore/include/api/types.h +10 -10
- mindspore/include/dataset/config.h +2 -2
- mindspore/include/dataset/constants.h +2 -2
- mindspore/include/dataset/execute.h +2 -2
- mindspore/include/dataset/vision.h +4 -0
- mindspore/jpeg62.dll +0 -0
- mindspore/log.py +1 -1
- mindspore/mindrecord/filewriter.py +68 -51
- mindspore/mindspore_backend.dll +0 -0
- mindspore/mindspore_common.dll +0 -0
- mindspore/mindspore_core.dll +0 -0
- mindspore/mindspore_glog.dll +0 -0
- mindspore/mindspore_np_dtype.dll +0 -0
- mindspore/mindspore_ops.dll +0 -0
- mindspore/mint/__init__.py +495 -46
- mindspore/mint/distributed/__init__.py +31 -0
- mindspore/mint/distributed/distributed.py +254 -0
- mindspore/mint/nn/__init__.py +266 -21
- mindspore/mint/nn/functional.py +125 -19
- mindspore/mint/nn/layer/__init__.py +39 -0
- mindspore/mint/nn/layer/activation.py +133 -0
- mindspore/mint/nn/layer/normalization.py +477 -0
- mindspore/mint/nn/layer/pooling.py +110 -0
- mindspore/mint/optim/adamw.py +28 -7
- mindspore/mint/special/__init__.py +63 -0
- mindspore/multiprocessing/__init__.py +2 -1
- mindspore/nn/__init__.py +0 -1
- mindspore/nn/cell.py +275 -93
- mindspore/nn/layer/activation.py +211 -44
- mindspore/nn/layer/basic.py +113 -3
- mindspore/nn/layer/embedding.py +120 -2
- mindspore/nn/layer/normalization.py +101 -5
- mindspore/nn/layer/padding.py +34 -48
- mindspore/nn/layer/pooling.py +161 -7
- mindspore/nn/layer/transformer.py +3 -3
- mindspore/nn/loss/__init__.py +2 -2
- mindspore/nn/loss/loss.py +84 -6
- mindspore/nn/optim/__init__.py +2 -1
- mindspore/nn/optim/adadelta.py +1 -1
- mindspore/nn/optim/adam.py +1 -1
- mindspore/nn/optim/lamb.py +1 -1
- mindspore/nn/optim/tft_wrapper.py +127 -0
- mindspore/nn/wrap/cell_wrapper.py +12 -23
- mindspore/nn/wrap/grad_reducer.py +5 -5
- mindspore/nn/wrap/loss_scale.py +17 -3
- mindspore/numpy/__init__.py +1 -1
- mindspore/numpy/array_creations.py +65 -68
- mindspore/numpy/array_ops.py +64 -60
- mindspore/numpy/fft.py +610 -75
- mindspore/numpy/logic_ops.py +11 -10
- mindspore/numpy/math_ops.py +85 -84
- mindspore/numpy/utils_const.py +4 -4
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/opencv_imgproc452.dll +0 -0
- mindspore/ops/__init__.py +6 -4
- mindspore/ops/_grad_experimental/grad_comm_ops.py +47 -3
- mindspore/ops/_grad_experimental/grad_math_ops.py +0 -22
- mindspore/ops/_vmap/vmap_array_ops.py +2 -4
- mindspore/ops/_vmap/vmap_math_ops.py +17 -1
- mindspore/ops/_vmap/vmap_nn_ops.py +43 -2
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +85 -7
- mindspore/ops/auto_generate/gen_arg_dtype_cast.py +2 -0
- mindspore/ops/auto_generate/gen_extend_func.py +734 -13
- mindspore/ops/auto_generate/gen_ops_def.py +2420 -381
- mindspore/ops/auto_generate/gen_ops_prim.py +5196 -1659
- mindspore/ops/auto_generate/pyboost_inner_prim.py +176 -56
- mindspore/ops/composite/base.py +85 -48
- mindspore/ops/composite/multitype_ops/_compile_utils.py +1 -0
- mindspore/ops/composite/multitype_ops/not_in_impl.py +2 -2
- mindspore/ops/function/__init__.py +22 -0
- mindspore/ops/function/array_func.py +490 -153
- mindspore/ops/function/debug_func.py +113 -1
- mindspore/ops/function/fft_func.py +15 -2
- mindspore/ops/function/grad/grad_func.py +3 -2
- mindspore/ops/function/math_func.py +558 -207
- mindspore/ops/function/nn_func.py +817 -383
- mindspore/ops/function/other_func.py +3 -2
- mindspore/ops/function/random_func.py +184 -8
- mindspore/ops/function/reshard_func.py +13 -11
- mindspore/ops/function/sparse_unary_func.py +1 -1
- mindspore/ops/function/vmap_func.py +3 -2
- mindspore/ops/functional.py +24 -14
- mindspore/ops/op_info_register.py +3 -3
- mindspore/ops/operations/__init__.py +6 -1
- mindspore/ops/operations/_grad_ops.py +2 -76
- mindspore/ops/operations/_infer_ops.py +1 -1
- mindspore/ops/operations/_inner_ops.py +71 -94
- mindspore/ops/operations/array_ops.py +12 -146
- mindspore/ops/operations/comm_ops.py +42 -53
- mindspore/ops/operations/custom_ops.py +83 -19
- mindspore/ops/operations/debug_ops.py +42 -10
- mindspore/ops/operations/manually_defined/_inner.py +12 -0
- mindspore/ops/operations/manually_defined/ops_def.py +265 -10
- mindspore/ops/operations/math_ops.py +12 -223
- mindspore/ops/operations/nn_ops.py +20 -114
- mindspore/ops/operations/other_ops.py +7 -4
- mindspore/ops/operations/random_ops.py +46 -1
- mindspore/ops/primitive.py +18 -6
- mindspore/ops_generate/arg_dtype_cast.py +2 -0
- mindspore/ops_generate/gen_aclnn_implement.py +11 -11
- mindspore/ops_generate/gen_constants.py +36 -0
- mindspore/ops_generate/gen_ops.py +67 -52
- mindspore/ops_generate/gen_ops_inner_prim.py +1 -1
- mindspore/ops_generate/gen_pyboost_func.py +131 -47
- mindspore/ops_generate/op_proto.py +10 -3
- mindspore/ops_generate/pyboost_utils.py +14 -1
- mindspore/ops_generate/template.py +43 -21
- mindspore/parallel/__init__.py +3 -1
- mindspore/parallel/_auto_parallel_context.py +28 -8
- mindspore/parallel/_cell_wrapper.py +83 -0
- mindspore/parallel/_parallel_serialization.py +47 -19
- mindspore/parallel/_tensor.py +81 -11
- mindspore/parallel/_utils.py +13 -1
- mindspore/parallel/algo_parameter_config.py +5 -5
- mindspore/parallel/checkpoint_transform.py +46 -39
- mindspore/parallel/cluster/process_entity/__init__.py +1 -1
- mindspore/parallel/cluster/process_entity/_api.py +31 -23
- mindspore/parallel/cluster/process_entity/_utils.py +2 -27
- mindspore/parallel/parameter_broadcast.py +3 -4
- mindspore/parallel/shard.py +162 -31
- mindspore/parallel/transform_safetensors.py +993 -0
- mindspore/profiler/__init__.py +2 -1
- mindspore/profiler/common/constant.py +29 -0
- mindspore/profiler/common/registry.py +47 -0
- mindspore/profiler/common/util.py +28 -0
- mindspore/profiler/dynamic_profiler.py +694 -0
- mindspore/profiler/envprofiling.py +17 -19
- mindspore/profiler/parser/ascend_analysis/constant.py +18 -0
- mindspore/profiler/parser/ascend_analysis/file_manager.py +25 -4
- mindspore/profiler/parser/ascend_analysis/function_event.py +43 -19
- mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +31 -26
- mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +56 -10
- mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +55 -8
- mindspore/profiler/parser/ascend_analysis/path_manager.py +313 -0
- mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +27 -20
- mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +9 -2
- mindspore/profiler/parser/ascend_msprof_exporter.py +5 -4
- mindspore/profiler/parser/ascend_timeline_generator.py +27 -25
- mindspore/profiler/parser/base_timeline_generator.py +19 -25
- mindspore/profiler/parser/cpu_gpu_timeline_generator.py +25 -12
- mindspore/profiler/parser/framework_parser.py +1 -391
- mindspore/profiler/parser/gpu_analysis/__init__.py +14 -0
- mindspore/profiler/parser/gpu_analysis/function_event.py +44 -0
- mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +89 -0
- mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +72 -0
- mindspore/profiler/parser/memory_usage_parser.py +0 -154
- mindspore/profiler/parser/profiler_info.py +78 -6
- mindspore/profiler/profiler.py +153 -0
- mindspore/profiler/profiling.py +280 -412
- mindspore/rewrite/__init__.py +1 -2
- mindspore/rewrite/common/namespace.py +4 -4
- mindspore/rewrite/symbol_tree/symbol_tree.py +3 -3
- mindspore/run_check/_check_version.py +36 -103
- mindspore/safeguard/rewrite_obfuscation.py +591 -247
- mindspore/swresample-4.dll +0 -0
- mindspore/swscale-6.dll +0 -0
- mindspore/tinyxml2.dll +0 -0
- mindspore/train/__init__.py +4 -3
- mindspore/train/_utils.py +28 -2
- mindspore/train/amp.py +171 -53
- mindspore/train/callback/__init__.py +2 -2
- mindspore/train/callback/_callback.py +4 -4
- mindspore/train/callback/_checkpoint.py +85 -22
- mindspore/train/callback/_cluster_monitor.py +1 -1
- mindspore/train/callback/_flops_collector.py +1 -0
- mindspore/train/callback/_loss_monitor.py +3 -3
- mindspore/train/callback/_on_request_exit.py +134 -31
- mindspore/train/callback/_summary_collector.py +5 -5
- mindspore/train/callback/_tft_register.py +352 -0
- mindspore/train/dataset_helper.py +7 -3
- mindspore/train/metrics/metric.py +3 -3
- mindspore/train/metrics/roc.py +4 -4
- mindspore/train/mind_ir_pb2.py +44 -39
- mindspore/train/model.py +134 -58
- mindspore/train/serialization.py +336 -112
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/__init__.py +21 -0
- mindspore/utils/utils.py +60 -0
- mindspore/version.py +1 -1
- {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/METADATA +6 -2
- {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/RECORD +258 -252
- mindspore/include/c_api/ms/abstract.h +0 -67
- mindspore/include/c_api/ms/attribute.h +0 -197
- mindspore/include/c_api/ms/base/handle_types.h +0 -43
- mindspore/include/c_api/ms/base/macros.h +0 -32
- mindspore/include/c_api/ms/base/status.h +0 -33
- mindspore/include/c_api/ms/base/types.h +0 -283
- mindspore/include/c_api/ms/context.h +0 -102
- mindspore/include/c_api/ms/graph.h +0 -160
- mindspore/include/c_api/ms/node.h +0 -606
- mindspore/include/c_api/ms/tensor.h +0 -161
- mindspore/include/c_api/ms/value.h +0 -84
- mindspore/mindspore_shared_lib.dll +0 -0
- mindspore/nn/extend/basic.py +0 -140
- mindspore/nn/extend/embedding.py +0 -143
- mindspore/nn/extend/layer/normalization.py +0 -109
- mindspore/nn/extend/pooling.py +0 -117
- mindspore/nn/layer/embedding_service.py +0 -531
- mindspore/ops/_op_impl/aicpu/strided_slice_v2.py +0 -93
- mindspore/ops/_op_impl/aicpu/strided_slice_v2_grad.py +0 -66
- mindspore/ops/extend/__init__.py +0 -53
- mindspore/ops/extend/array_func.py +0 -218
- mindspore/ops/extend/math_func.py +0 -76
- mindspore/ops/extend/nn_func.py +0 -308
- mindspore/ops/silent_check.py +0 -162
- mindspore/profiler/parser/msadvisor_analyzer.py +0 -82
- mindspore/profiler/parser/msadvisor_parser.py +0 -240
- mindspore/train/callback/_mindio_ttp.py +0 -443
- {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/WHEEL +0 -0
- {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/entry_points.txt +0 -0
- {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/top_level.txt +0 -0
mindspore/rewrite/__init__.py
CHANGED
|
@@ -25,5 +25,4 @@ from .sparsify.sparsify import sparsify
|
|
|
25
25
|
from .sparsify.utils import ArgType, SparseFunc
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
__all__ = ["SymbolTree", "Node", "NodeType", "ScopedValue", "ValueType"
|
|
29
|
-
"Replacement"]
|
|
28
|
+
__all__ = ["SymbolTree", "Node", "NodeType", "ScopedValue", "ValueType"]
|
|
@@ -85,12 +85,12 @@ def is_third_party(func_obj):
|
|
|
85
85
|
# A module without __file__ attribute (normally to be a c++ lib) is considered to be third party module.
|
|
86
86
|
if not hasattr(module, '__file__'):
|
|
87
87
|
return True
|
|
88
|
-
module_path = os.path.
|
|
88
|
+
module_path = os.path.realpath(module.__file__)
|
|
89
89
|
for path in _ignore_third_party_paths:
|
|
90
90
|
if module_path.startswith(path):
|
|
91
91
|
return False
|
|
92
92
|
# Python builtin modules are treated as third-party libraries.
|
|
93
|
-
python_builtin_dir = os.path.
|
|
93
|
+
python_builtin_dir = os.path.realpath(os.path.dirname(os.__file__))
|
|
94
94
|
if module_path.startswith(python_builtin_dir):
|
|
95
95
|
return True
|
|
96
96
|
# Check if module is under user workspace directory.
|
|
@@ -106,8 +106,8 @@ def is_third_party(func_obj):
|
|
|
106
106
|
|
|
107
107
|
def get_top_level_module_path(module_path):
|
|
108
108
|
"""Get the path of the top level package of the current working directory."""
|
|
109
|
-
module_abspath = os.path.
|
|
110
|
-
upper_path = os.path.
|
|
109
|
+
module_abspath = os.path.realpath(module_path)
|
|
110
|
+
upper_path = os.path.realpath(os.path.dirname(module_abspath))
|
|
111
111
|
if module_abspath == upper_path:
|
|
112
112
|
return module_abspath
|
|
113
113
|
# Check whether __init__.py exists in the upper directory.
|
|
@@ -307,7 +307,7 @@ class SymbolTree(Observer, Observable, NodeManager):
|
|
|
307
307
|
@staticmethod
|
|
308
308
|
def _get_valid_import_info(import_node: ast.ImportFrom, file_path: str):
|
|
309
309
|
"""Get valid import info while import_node.module is at form of relative path"""
|
|
310
|
-
file_path = os.path.dirname(os.path.
|
|
310
|
+
file_path = os.path.dirname(os.path.realpath(file_path))
|
|
311
311
|
# get real path from import_node.level
|
|
312
312
|
# from .(A) import xxx: current path
|
|
313
313
|
# from ..(A) import xxx: last level path
|
|
@@ -1452,7 +1452,7 @@ class SymbolTree(Observer, Observable, NodeManager):
|
|
|
1452
1452
|
return self._saved_file_name
|
|
1453
1453
|
|
|
1454
1454
|
def save_network_to_file(self):
|
|
1455
|
-
abs_path = os.path.
|
|
1455
|
+
abs_path = os.path.realpath(self._saved_file_name)
|
|
1456
1456
|
if os.path.isfile(abs_path):
|
|
1457
1457
|
os.remove(abs_path)
|
|
1458
1458
|
with os.fdopen(os.open(self._saved_file_name, os.O_WRONLY | os.O_CREAT, stat.S_IRWXU), 'wb') as f:
|
|
@@ -1563,7 +1563,7 @@ class SymbolTree(Observer, Observable, NodeManager):
|
|
|
1563
1563
|
When level_num = 1(e.g. from .xxx import yyy), current path will be saved.
|
|
1564
1564
|
When level_num = 2(e.g. from ..xxx import yyy), the path one level above the current path will be saved.
|
|
1565
1565
|
"""
|
|
1566
|
-
file_path = os.path.dirname(os.path.
|
|
1566
|
+
file_path = os.path.dirname(os.path.realpath(file_path))
|
|
1567
1567
|
file_path = os.path.normcase(file_path)
|
|
1568
1568
|
file_path = os.path.normpath(file_path)
|
|
1569
1569
|
if level_num > 1:
|
|
@@ -20,7 +20,6 @@ import sys
|
|
|
20
20
|
import time
|
|
21
21
|
import subprocess
|
|
22
22
|
import glob
|
|
23
|
-
from copy import deepcopy
|
|
24
23
|
from pathlib import Path
|
|
25
24
|
from abc import abstractmethod, ABCMeta
|
|
26
25
|
from packaging import version
|
|
@@ -159,7 +158,7 @@ class GPUEnvChecker(EnvChecker):
|
|
|
159
158
|
"""Get cuda bin path by lib path."""
|
|
160
159
|
path_list = []
|
|
161
160
|
for path in self.cuda_lib_path:
|
|
162
|
-
path = os.path.
|
|
161
|
+
path = os.path.realpath(path.strip() + "/bin/")
|
|
163
162
|
if Path(path).is_dir():
|
|
164
163
|
path_list.append(path)
|
|
165
164
|
return np.unique(path_list)
|
|
@@ -235,7 +234,7 @@ class GPUEnvChecker(EnvChecker):
|
|
|
235
234
|
continue
|
|
236
235
|
path = path.partition(lib_name)[0]
|
|
237
236
|
if path:
|
|
238
|
-
path_list.append(os.path.
|
|
237
|
+
path_list.append(os.path.realpath(path.strip() + "../"))
|
|
239
238
|
return np.unique(path_list)
|
|
240
239
|
except subprocess.TimeoutExpired:
|
|
241
240
|
logger.warning("Failed to check cuda version due to the ldd command timeout. Please confirm that "
|
|
@@ -259,46 +258,7 @@ class AscendEnvChecker(EnvChecker):
|
|
|
259
258
|
|
|
260
259
|
def __init__(self, library_path):
|
|
261
260
|
self.library_path = library_path
|
|
262
|
-
self.version = ["7.
|
|
263
|
-
atlas_nnae_version = "/usr/local/Ascend/nnae/latest/compiler/version.info"
|
|
264
|
-
atlas_toolkit_version = "/usr/local/Ascend/ascend-toolkit/latest/compiler/version.info"
|
|
265
|
-
hisi_fwk_version = "/usr/local/Ascend/latest/compiler/version.info"
|
|
266
|
-
if os.path.exists(atlas_nnae_version):
|
|
267
|
-
# atlas default path
|
|
268
|
-
self.fwk_path = "/usr/local/Ascend/nnae/latest"
|
|
269
|
-
self.op_impl_path = "/usr/local/Ascend/nnae/latest/opp/built-in/op_impl/ai_core/tbe"
|
|
270
|
-
self.tbe_path = self.fwk_path + "/lib64"
|
|
271
|
-
self.cce_path = self.fwk_path + "/compiler/ccec_compiler/bin"
|
|
272
|
-
self.fwk_version = atlas_nnae_version
|
|
273
|
-
self.op_path = "/usr/local/Ascend/nnae/latest/opp"
|
|
274
|
-
self.aicpu_path = "/usr/local/Ascend/nnae/latest"
|
|
275
|
-
elif os.path.exists(atlas_toolkit_version):
|
|
276
|
-
# atlas default path
|
|
277
|
-
self.fwk_path = "/usr/local/Ascend/ascend-toolkit/latest"
|
|
278
|
-
self.op_impl_path = "/usr/local/Ascend/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe"
|
|
279
|
-
self.tbe_path = self.fwk_path + "/lib64"
|
|
280
|
-
self.cce_path = self.fwk_path + "/compiler/ccec_compiler/bin"
|
|
281
|
-
self.fwk_version = atlas_toolkit_version
|
|
282
|
-
self.op_path = "/usr/local/Ascend/ascend-toolkit/latest/opp"
|
|
283
|
-
self.aicpu_path = "/usr/local/Ascend/ascend-toolkit/latest"
|
|
284
|
-
elif os.path.exists(hisi_fwk_version):
|
|
285
|
-
# hisi default path
|
|
286
|
-
self.fwk_path = "/usr/local/Ascend/latest"
|
|
287
|
-
self.op_impl_path = "/usr/local/Ascend/latest/opp/built-in/op_impl/ai_core/tbe"
|
|
288
|
-
self.tbe_path = self.fwk_path + "/lib64"
|
|
289
|
-
self.cce_path = self.fwk_path + "/compiler/ccec_compiler/bin"
|
|
290
|
-
self.fwk_version = hisi_fwk_version
|
|
291
|
-
self.op_path = "/usr/local/Ascend/latest/opp"
|
|
292
|
-
self.aicpu_path = "/usr/local/Ascend/latest"
|
|
293
|
-
else:
|
|
294
|
-
# custom or unknown environment
|
|
295
|
-
self.fwk_path = ""
|
|
296
|
-
self.op_impl_path = ""
|
|
297
|
-
self.tbe_path = ""
|
|
298
|
-
self.cce_path = ""
|
|
299
|
-
self.fwk_version = ""
|
|
300
|
-
self.op_path = ""
|
|
301
|
-
self.aicpu_path = ""
|
|
261
|
+
self.version = ["7.3", "7.5"]
|
|
302
262
|
|
|
303
263
|
# env
|
|
304
264
|
self.path = os.getenv("PATH")
|
|
@@ -306,12 +266,12 @@ class AscendEnvChecker(EnvChecker):
|
|
|
306
266
|
self.ld_lib_path = os.getenv("LD_LIBRARY_PATH")
|
|
307
267
|
self.ascend_opp_path = os.getenv("ASCEND_OPP_PATH")
|
|
308
268
|
self.ascend_aicpu_path = os.getenv("ASCEND_AICPU_PATH")
|
|
269
|
+
self.compiler_version = self.ascend_opp_path.split("opp")[0] + "compiler/version.info"
|
|
309
270
|
|
|
310
271
|
# check content
|
|
311
272
|
self.path_check = "/compiler/ccec_compiler/bin"
|
|
312
273
|
self.python_path_check = "opp/built-in/op_impl/ai_core/tbe"
|
|
313
274
|
self.ld_lib_path_check_fwk = "/lib64"
|
|
314
|
-
self.ld_lib_path_check_addons = "/add-ons"
|
|
315
275
|
self.ascend_opp_path_check = "/op"
|
|
316
276
|
self.v = ""
|
|
317
277
|
|
|
@@ -322,36 +282,46 @@ class AscendEnvChecker(EnvChecker):
|
|
|
322
282
|
else:
|
|
323
283
|
os.environ[env_name] = env_value + ":" + os.environ[env_name]
|
|
324
284
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
285
|
+
def check_custom_version(self):
|
|
286
|
+
"""custom op version check"""
|
|
287
|
+
custom_ascendc_soc_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
|
288
|
+
"../lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel",
|
|
289
|
+
MSContext.get_instance().get_ascend_soc_version())
|
|
290
|
+
if not os.path.exists(custom_ascendc_soc_dir):
|
|
291
|
+
logger.debug(f"The path {custom_ascendc_soc_dir} of the custom ascend c operator does not exist.")
|
|
292
|
+
return False
|
|
293
|
+
|
|
294
|
+
if not Path(self.compiler_version).is_file():
|
|
329
295
|
return True
|
|
330
296
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
297
|
+
cur_version = self._read_version(self.compiler_version)
|
|
298
|
+
custom_version_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
|
299
|
+
"../lib/plugin/ascend/custom_ascendc_ops/version.info")
|
|
300
|
+
with open(custom_version_path, 'r') as f:
|
|
301
|
+
all_info = f.readlines()
|
|
302
|
+
for line in all_info:
|
|
303
|
+
full_version = line.strip().split("=")[1]
|
|
304
|
+
compile_version = '.'.join(full_version.split('.')[0:2])
|
|
305
|
+
if cur_version == compile_version:
|
|
306
|
+
return True
|
|
336
307
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
return True
|
|
308
|
+
logger.warning(
|
|
309
|
+
f"The version {compile_version} used for compiling the custom operator does not match "
|
|
310
|
+
f"Ascend AI software package version {cur_version} in the current environment.")
|
|
311
|
+
return False
|
|
342
312
|
|
|
343
313
|
def check_env(self):
|
|
344
314
|
self._check_env()
|
|
345
315
|
|
|
346
316
|
def check_version(self):
|
|
347
|
-
if not Path(self.
|
|
317
|
+
if not Path(self.compiler_version).is_file():
|
|
348
318
|
logger.warning("Using custom Ascend AI software package (Ascend Data Center Solution) path, package "
|
|
349
319
|
"version checking is skipped. Please make sure Ascend AI software package (Ascend Data "
|
|
350
320
|
"Center Solution) version is supported. For details, refer to the installation guidelines "
|
|
351
321
|
"https://www.mindspore.cn/install")
|
|
352
322
|
return
|
|
353
323
|
|
|
354
|
-
v = self._read_version(self.
|
|
324
|
+
v = self._read_version(self.compiler_version)
|
|
355
325
|
if v not in self.version:
|
|
356
326
|
v_list = str([x for x in self.version])
|
|
357
327
|
logger.warning(f"MindSpore version {__version__} and Ascend AI software package (Ascend Data Center "
|
|
@@ -397,10 +367,10 @@ class AscendEnvChecker(EnvChecker):
|
|
|
397
367
|
time.sleep(1)
|
|
398
368
|
|
|
399
369
|
def set_env(self):
|
|
400
|
-
curr_path = os.path.
|
|
401
|
-
cust_aicpu_path = os.path.
|
|
402
|
-
cust_aicore_path = os.path.
|
|
403
|
-
cust_ascendc_path = os.path.
|
|
370
|
+
curr_path = os.path.realpath(os.path.dirname(__file__))
|
|
371
|
+
cust_aicpu_path = os.path.realpath(os.path.join(curr_path, "../lib/plugin/ascend/custom_aicpu_ops"))
|
|
372
|
+
cust_aicore_path = os.path.realpath(os.path.join(curr_path, "../lib/plugin/ascend/custom_aicore_ops"))
|
|
373
|
+
cust_ascendc_path = os.path.realpath(os.path.join(curr_path, "../lib/plugin/ascend/custom_ascendc_ops"))
|
|
404
374
|
if os.getenv('ASCEND_CUSTOM_OPP_PATH'):
|
|
405
375
|
os.environ['ASCEND_CUSTOM_OPP_PATH'] = os.environ['ASCEND_CUSTOM_OPP_PATH'] + ":" + \
|
|
406
376
|
cust_ascendc_path + ":" + cust_aicore_path + ":" + cust_aicpu_path
|
|
@@ -410,47 +380,11 @@ class AscendEnvChecker(EnvChecker):
|
|
|
410
380
|
akg_dir = os.path.join(plugin_dir, "ascend")
|
|
411
381
|
AscendEnvChecker._concat_variable('LD_LIBRARY_PATH', akg_dir)
|
|
412
382
|
|
|
413
|
-
|
|
414
|
-
self._check_env()
|
|
415
|
-
return
|
|
416
|
-
|
|
417
|
-
try:
|
|
418
|
-
origin_path = deepcopy(sys.path)
|
|
419
|
-
import te # pylint: disable=unused-import
|
|
420
|
-
# pylint: disable=broad-except
|
|
421
|
-
except Exception:
|
|
422
|
-
sys.path = deepcopy(origin_path)
|
|
423
|
-
if Path(self.tbe_path).is_dir():
|
|
424
|
-
os.environ['LD_LIBRARY_PATH'] = self.tbe_path + ":" + os.environ['LD_LIBRARY_PATH']
|
|
425
|
-
else:
|
|
426
|
-
logger.error(
|
|
427
|
-
f"No such directory: {self.tbe_path}. Please check if Ascend AI software package (Ascend Data "
|
|
428
|
-
"Center Solution) is installed correctly.")
|
|
429
|
-
return
|
|
383
|
+
self._check_env()
|
|
430
384
|
|
|
431
385
|
# check te version after set te env
|
|
432
386
|
self.check_deps_version()
|
|
433
387
|
|
|
434
|
-
if Path(self.op_impl_path).is_dir():
|
|
435
|
-
# python path for sub process
|
|
436
|
-
AscendEnvChecker._concat_variable('PYTHONPATH', self.op_impl_path)
|
|
437
|
-
# sys path for this process
|
|
438
|
-
sys.path.append(self.op_impl_path)
|
|
439
|
-
|
|
440
|
-
os.environ['TBE_IMPL_PATH'] = self.op_impl_path
|
|
441
|
-
else:
|
|
442
|
-
logger.error(
|
|
443
|
-
f"No such directory: {self.op_impl_path}. Please check if Ascend AI software package (Ascend Data "
|
|
444
|
-
"Center Solution) is installed correctly.")
|
|
445
|
-
return
|
|
446
|
-
|
|
447
|
-
if not AscendEnvChecker._check_and_set_env('PATH', self.cce_path, True):
|
|
448
|
-
return
|
|
449
|
-
if not AscendEnvChecker._check_and_set_env('ASCEND_OPP_PATH', self.op_path):
|
|
450
|
-
return
|
|
451
|
-
if not AscendEnvChecker._check_and_set_env('ASCEND_AICPU_PATH', self.aicpu_path):
|
|
452
|
-
return
|
|
453
|
-
|
|
454
388
|
def _check_env(self):
|
|
455
389
|
"""ascend dependence path check"""
|
|
456
390
|
if self.path is None or self.path_check not in self.path:
|
|
@@ -464,8 +398,7 @@ class AscendEnvChecker(EnvChecker):
|
|
|
464
398
|
"Environment Variable PYTHONPATH is set. For details, refer to the installation guidelines: "
|
|
465
399
|
"https://www.mindspore.cn/install")
|
|
466
400
|
|
|
467
|
-
if self.ld_lib_path is None or not
|
|
468
|
-
self.ld_lib_path_check_addons in self.ld_lib_path):
|
|
401
|
+
if self.ld_lib_path is None or not self.ld_lib_path_check_fwk in self.ld_lib_path:
|
|
469
402
|
logger.warning("Can not find driver so(need by mindspore-ascend). Please check whether the "
|
|
470
403
|
"Environment Variable LD_LIBRARY_PATH is set. For details, refer to the installation "
|
|
471
404
|
"guidelines: https://www.mindspore.cn/install")
|