217 Star 1.2K Fork 1.1K

Ascend/samples

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
install.sh 1.46 KB
一键复制 编辑 原始数据 按行查看 历史
shinoda 提交于 2025-08-26 15:48 +08:00 . !2747fix log format
#!/bin/bash
SHORT=v:,i:,
LONG=soc-version:,install-path:,
OPTS=$(getopt -a --options $SHORT --longoptions $LONG -- "$@")
eval set -- "$OPTS"
while :; do
case "$1" in
-v | --soc-version)
SOC_VERSION="$2"
shift 2
;;
-i | --install-path)
ASCEND_INSTALL_PATH="$2"
shift 2
;;
--)
shift
break
;;
*)
echo "[ERROR]: Unexpected option: $1"
break
;;
esac
done
VERSION_LIST="Ascend910A Ascend910B Ascend310B1 Ascend310B2 Ascend310B3 Ascend310B4 Ascend310P1 Ascend310P3 Ascend910B1 Ascend910B2 Ascend910B3 Ascend910B4"
if [[ " $VERSION_LIST " != *" $SOC_VERSION "* ]]; then
echo "[ERROR]: SOC_VERSION should be in [$VERSION_LIST]"
exit -1
fi
if [ -n "$ASCEND_INSTALL_PATH" ]; then
_ASCEND_INSTALL_PATH=$ASCEND_INSTALL_PATH
elif [ -n "$ASCEND_HOME_PATH" ]; then
_ASCEND_INSTALL_PATH=$ASCEND_HOME_PATH
else
if [ -d "$HOME/Ascend/ascend-toolkit/latest" ]; then
_ASCEND_INSTALL_PATH=$HOME/Ascend/ascend-toolkit/latest
else
_ASCEND_INSTALL_PATH=/usr/local/Ascend/ascend-toolkit/latest
fi
fi
source $_ASCEND_INSTALL_PATH/bin/setenv.bash
export ASCEND_HOME_PATH=$_ASCEND_INSTALL_PATH
OP_NAME=AddCustom
rm -rf CustomOp
# Generate the op framework
msopgen gen -i $OP_NAME.json -c ai_core-${SOC_VERSION} -lan cpp -out CustomOp
# Copy op implementation files to CustomOp
cp -rf $OP_NAME/* CustomOp
# Build CustomOp project
(cd CustomOp && bash build.sh)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ascend/samples.git
git@gitee.com:ascend/samples.git
ascend
samples
samples
master

搜索帮助