!32544 set ASCEND_AICPU_PATH env

Merge pull request !32544 from zhoufeng/aicpu-opp-path
This commit is contained in:
i-robot 2022-04-06 05:59:19 +00:00 committed by Gitee
commit 8b1678d5cb
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 14 additions and 0 deletions

View File

@ -218,6 +218,7 @@ class AscendEnvChecker(EnvChecker):
self.cce_path = self.fwk_path + "/ccec_compiler/bin"
self.fwk_version = atlas_nnae_version
self.op_path = "/usr/local/Ascend/nnae/latest/opp"
self.aicpu_path = "/usr/local/Ascend/nnae/latest"
elif os.path.exists(atlas_toolkit_version):
# atlas default path
self.fwk_path = "/usr/local/Ascend/ascend-toolkit/latest/fwkacllib"
@ -226,6 +227,7 @@ class AscendEnvChecker(EnvChecker):
self.cce_path = self.fwk_path + "/ccec_compiler/bin"
self.fwk_version = atlas_toolkit_version
self.op_path = "/usr/local/Ascend/ascend-toolkit/latest/opp"
self.aicpu_path = "/usr/local/Ascend/ascend-toolkit/latest"
elif os.path.exists(hisi_fwk_version):
# hisi default path
self.fwk_path = "/usr/local/Ascend/latest/fwkacllib"
@ -234,6 +236,7 @@ class AscendEnvChecker(EnvChecker):
self.cce_path = self.fwk_path + "/ccec_compiler/bin"
self.fwk_version = hisi_fwk_version
self.op_path = "/usr/local/Ascend/latest/opp"
self.aicpu_path = "/usr/local/Ascend/latest"
else:
# custom or unknown environment
self.fwk_path = ""
@ -242,12 +245,14 @@ class AscendEnvChecker(EnvChecker):
self.cce_path = ""
self.fwk_version = ""
self.op_path = ""
self.aicpu_path = ""
# env
self.path = os.getenv("PATH")
self.python_path = os.getenv("PYTHONPATH")
self.ld_lib_path = os.getenv("LD_LIBRARY_PATH")
self.ascend_opp_path = os.getenv("ASCEND_OPP_PATH")
self.ascend_aicpu_path = os.getenv("ASCEND_AICPU_PATH")
# check content
self.path_check = "/fwkacllib/ccec_compiler/bin"
@ -351,6 +356,15 @@ class AscendEnvChecker(EnvChecker):
f"No such directory: {self.op_path}, Please check if Ascend AI software package (Ascend Data Center "
"Solution) is installed correctly.")
if self.aicpu_path is None:
pass
elif Path(self.aicpu_path).is_dir():
os.environ['ASCEND_AICPU_PATH'] = self.aicpu_path
else:
raise EnvironmentError(
f"No such directory: {self.aicpu_path}, Please check if Ascend AI software package (Ascend Data Center"
" Solution) is installed correctly.")
def _check_env(self):
"""ascend dependence path check"""
if self.path is None or self.path_check not in self.path: