#!/bin/bash PACKAGE=toolkit CUR_DIR=`dirname ${BASH_SOURCE[0]}` version_dir=`cat "$CUR_DIR/../version.info" | grep "version_dir" | cut -d"=" -f2` if [ -z "$version_dir" ]; then INSTALL_DIR=`realpath ${CUR_DIR}/../..` else INSTALL_DIR=`realpath ${CUR_DIR}/../../../latest` fi toolchain_path="${INSTALL_DIR}/${PACKAGE}" if [ -d ${toolchain_path} ]; then toolchain_home=`echo ${TOOLCHAIN_HOME}` num=`echo ":${toolchain_home}:" | grep ":${toolchain_path}:" | wc -l` if [ ${num} -eq 0 ]; then if [ "-${toolchain_home}" = "-" ]; then export TOOLCHAIN_HOME=${toolchain_path} else export TOOLCHAIN_HOME=${toolchain_path}:${toolchain_home} fi fi fi lib_path="${INSTALL_DIR}/${PACKAGE}/python/site-packages/" if [ -d ${lib_path} ]; then python_path=`echo ${PYTHONPATH}` num=`echo ":${python_path}:" | grep ":${lib_path}:" | wc -l` if [ ${num} -eq 0 ]; then if [ "-${python_path}" = "-" ]; then export PYTHONPATH=${lib_path} else export PYTHONPATH=${lib_path}:${python_path} fi fi fi op_tools_path="${INSTALL_DIR}/${PACKAGE}/python/site-packages/bin/" if [ -d ${op_tools_path} ]; then temp_path=`echo ${PATH}` num=`echo ":${temp_path}:" | grep ":${op_tools_path}:" | wc -l` if [ ${num} -eq 0 ]; then if [ "-${temp_path}" = "-" ]; then export PATH=${op_tools_path} else export PATH=${op_tools_path}:${temp_path} fi fi fi msprof_path="${INSTALL_DIR}/${PACKAGE}/tools/profiler/bin/" if [ -d ${msprof_path} ]; then temp_path=`echo ${PATH}` num=`echo ":${temp_path}:" | grep ":${msprof_path}:" | wc -l` if [ ${num} -eq 0 ]; then if [ "-${temp_path}" = "-" ]; then export PATH=${msprof_path} else export PATH=${msprof_path}:${temp_path} fi fi fi asendc_tools_path="${INSTALL_DIR}/${PACKAGE}/tools/ascendc_tools/" if [ -d ${asendc_tools_path} ]; then temp_path=`echo ${PATH}` num=`echo ":${temp_path}:" | grep ":${asendc_tools_path}:" | wc -l` if [ ${num} -eq 0 ]; then if [ "-${temp_path}" = "-" ]; then export PATH=${asendc_tools_path} else export PATH=${asendc_tools_path}:${temp_path} fi fi fi biprof_tools_path="${INSTALL_DIR}/${PACKAGE}/tools/biprof/" if [ -d ${biprof_tools_path} ]; then temp_path=`echo ${PATH}` num=`echo ":${temp_path}:" | grep ":${biprof_tools_path}:" | wc -l` if [ ${num} -eq 0 ]; then if [ "-${temp_path}" = "-" ]; then export PATH=${biprof_tools_path} else export PATH=${biprof_tools_path}:${temp_path} fi fi fi ascend_ml_path="${INSTALL_DIR}/${PACKAGE}/tools/aml/lib64" if [ -d ${ascend_ml_path} ]; then temp_path=`echo ${LD_LIBRARY_PATH}` num=`echo ":${temp_path}:" | grep ":${ascend_ml_path}:" | wc -l` if [ ${num} -eq 0 ]; then if [ "-${temp_path}" = "-" ]; then export LD_LIBRARY_PATH=${ascend_ml_path} else export LD_LIBRARY_PATH=${ascend_ml_path}:${ascend_ml_path}/plugin:${temp_path} fi fi fi asys_path="${INSTALL_DIR}/${PACKAGE}/tools/ascend_system_advisor" if [ -d ${asys_path} ]; then alias asys="python3 ${asys_path}/asys/asys.py" fi ccec_compiler_path="${INSTALL_DIR}/${PACKAGE}/tools/ccec_compiler/bin" if [ -d ${ccec_compiler_path} ]; then temp_path=`echo ${PATH}` num=`echo ":${temp_path}:" | grep ":${ccec_compiler_path}:" | wc -l` if [ ${num} -eq 0 ]; then if [ "-${temp_path}" = "-" ]; then export PATH=${ccec_compiler_path} else export PATH=${ccec_compiler_path}:${temp_path} fi fi fi