add st ascend smoke

This commit is contained in:
zhengyuanhua 2022-11-17 19:11:21 +08:00
parent 8be44ea00f
commit 06e4ed6500
9 changed files with 101 additions and 30 deletions

View File

@ -206,6 +206,9 @@ build_python_wheel_package() {
cp ${INSTALL_PREFIX}/${pkg_name}/runtime/lib/libtensorrt_plugin.so package/mindspore_lite/lib/
fi
else
if [[ "${MSLITE_ENABLE_ACL}" ]]; then
cp src/litert/kernel/ascend/*.so package/mindspore_lite/lib/
fi
cp src/*.so package/mindspore_lite/lib/
fi
if [ -d "${INSTALL_PREFIX}/${pkg_name}/runtime/third_party/glog" ]; then

View File

@ -0,0 +1,29 @@
# model_info accuracy_limit
# model_name;input_info;input_shapes;mode accuracy_limit/CONVERTER
# Run in Ascend
#onnx
hdc_resnet_1w_class.onnx 3
googlenet-9.onnx;1:data_0;1,3,224,224;;offline_resize 5
cbg_ai_gender_resnet34_mutiscal_v1_1012.onnx;1:input.1;1,1,300,64;;offline_resize 5
hdc_efficientnet_b3_1w_class.onnx;1:input.1;1,3,224,224;;offline_resize 5
#mindir
mindspore_uniir_mobilenetv2.mindir 0.5
#caffe
hdc_resnet 4
machine_vision_mobile_net101_resnet 5
ml_video_edit_img_segment 5
mtk_face_recognition_v1 5
#tf
cbg_ai_ocr_direction.pb;1:input;1,32,32,1;;offline_resize 2
cbg_ai_ocr_detect_straight.pb;1:input;1,32,32,3;;offline_resize 5
cbg_ai_ocr_inception_curve.pb;1:input;1,960,960,3;;offline_resize 5
cbg_ai_ocr_language_classify.pb;1:input_0;2,32,512,1;;offline_resize 5
cbg_ai_ocr_recognize_latin.pb;1:input_0;1,64,64,1;;offline_resize 5
open_source_inception_v3.pb;1:input;2,299,299,3;;offline_resize 5
open_source_mobilenet_v2.pb;1:Placeholder;1,224,224,3;;offline_resize 5
open_source_squeeze_net.pb;1:Placeholder;2,224,224,3;;offline_resize 5
open_source_densenet.pb;1:Placeholder;2,224,224,3;;offline_resize 5

View File

@ -174,7 +174,7 @@ if [[ $backend == "all" || $backend == "x86_gpu" ]]; then
fi
fi
if [[ $backend == "all" || $backend == "x86_ascend310" || $backend == "x86_ascend710" || $backend == "arm_ascend310" ]]; then
if [[ $backend == "all" || $backend =~ "x86_ascend310" || $backend =~ "x86_ascend710" || $backend =~ "arm_ascend310" ]]; then
sh $cur_path/scripts/ascend/run_ascend.sh -r $release_path -m $models_path -d $device_id -e $backend -l $level
ascend_status=$?
if [[ ascend_status -ne 0 ]]; then

View File

@ -9,11 +9,23 @@ function PrePareLocal() {
cp ./scripts/base_functions.sh ${benchmark_test_path} || exit 1
cp ./scripts/ascend/run_converter_ascend.sh ${benchmark_test_path} || exit 1
cp ./scripts/ascend/run_benchmark_ascend.sh ${benchmark_test_path} || exit 1
cp ./../${config_folder}/models_ascend.cfg ${benchmark_test_path} || exit 1
if [[ ${backend} =~ "arm" ]]; then
cp ${release_path}/linux_aarch64/cloud_fusion/*-linux-${arch}.tar.gz ${benchmark_test_path} || exit 1
if [[ ${backend} =~ "_cloud" ]]; then
cp ./../${config_folder}/models_ascend_cloud.cfg ${benchmark_test_path} || exit 1
else
cp ${release_path}/centos_x86/cloud_fusion/*-linux-${arch}.tar.gz ${benchmark_test_path} || exit 1
cp ./../${config_folder}/models_ascend_lite.cfg ${benchmark_test_path} || exit 1
fi
if [[ ${backend} =~ "arm" ]]; then
if [[ ${backend} =~ "_cloud" ]]; then
cp ${release_path}/linux_aarch64/cloud_fusion/*-linux-${arch}.tar.gz ${benchmark_test_path} || exit 1
else
cp ${release_path}/linux_aarch64/ascend/*-linux-${arch}.tar.gz ${benchmark_test_path} || exit 1
fi
else
if [[ ${backend} =~ "_cloud" ]]; then
cp ${release_path}/centos_x86/cloud_fusion/*-linux-${arch}.tar.gz ${benchmark_test_path} || exit 1
else
cp ${release_path}/centos_x86/ascend/*-linux-${arch}.tar.gz ${benchmark_test_path} || exit 1
fi
fi
echo "Copy file success"
}
@ -25,11 +37,23 @@ function PrePareRemote() {
scp ./scripts/ascend/run_converter_ascend.sh ${user_name}@${device_ip}:${benchmark_test_path} || exit 1
scp ./scripts/ascend/run_benchmark_ascend.sh ${user_name}@${device_ip}:${benchmark_test_path} || exit 1
scp ./scripts/base_functions.sh ${user_name}@${device_ip}:${benchmark_test_path} || exit 1
scp ./../${config_folder}/models_ascend.cfg ${user_name}@${device_ip}:${benchmark_test_path} || exit 1
if [[ ${backend} =~ "arm" ]]; then
scp ${release_path}/linux_aarch64/cloud_fusion/*-linux-${arch}.tar.gz ${user_name}@${device_ip}:${benchmark_test_path} || exit 1
if [[ ${backend} =~ "_cloud" ]]; then
scp ./../${config_folder}/models_ascend_cloud.cfg ${user_name}@${device_ip}:${benchmark_test_path} || exit 1
else
scp ${release_path}/centos_x86/cloud_fusion/*-linux-${arch}.tar.gz ${user_name}@${device_ip}:${benchmark_test_path} || exit 1
scp ./../${config_folder}/models_ascend_lite.cfg ${user_name}@${device_ip}:${benchmark_test_path} || exit 1
fi
if [[ ${backend} =~ "arm" ]]; then
if [[ ${backend} =~ "_cloud" ]]; then
scp ${release_path}/linux_aarch64/cloud_fusion/*-linux-${arch}.tar.gz ${user_name}@${device_ip}:${benchmark_test_path} || exit 1
else
scp ${release_path}/linux_aarch64/ascend/*-linux-${arch}.tar.gz ${user_name}@${device_ip}:${benchmark_test_path} || exit 1
fi
else
if [[ ${backend} =~ "_cloud" ]]; then
scp ${release_path}/centos_x86/cloud_fusion/*-linux-${arch}.tar.gz ${user_name}@${device_ip}:${benchmark_test_path} || exit 1
else
scp ${release_path}/centos_x86/ascend/*-linux-${arch}.tar.gz ${user_name}@${device_ip}:${benchmark_test_path} || exit 1
fi
fi
echo "Copy file success"
}

View File

@ -1,7 +1,7 @@
#!/bin/bash
# Example:sh run_remote_ascend.sh -v version -b backend
while getopts "v:b:d:a:" opt; do
while getopts "v:b:d:a:c:" opt; do
case ${opt} in
v)
version=${OPTARG}
@ -19,6 +19,10 @@ while getopts "v:b:d:a:" opt; do
arch=${OPTARG}
echo "arch is ${arch}"
;;
c)
compile_type=${OPTARG}
echo "compile type is ${compile_type}"
;;
?)
echo "unknown para"
exit 1;;
@ -59,11 +63,15 @@ function Run_Benchmark() {
echo "Benchmarking ${model_name} ......"
model_type=${model_name##*.}
model_file=${ms_models_path}'/'${model_name}'.mindir'
if [[ ${compile_type} == "cloud" ]]; then
model_file=${ms_models_path}'/'${model_name}'.mindir'
else
model_file=${ms_models_path}'/'${model_name}'.ms'
fi
input_files=""
output_file=""
data_path=${model_data_path}'/data/'
if [[ ${model_type} == "mindir" ]]; then
if [[ ${model_type} == "mindir" || ${model_type} == "ms" ]]; then
if [[ ${input_num} == "" || ${input_num} == 1 ]]; then
input_files=${data_path}'input/'${model_name}'.ms.bin'
else
@ -116,7 +124,11 @@ function Run_Benchmark() {
user_name=${USER}
benchmark_test=/home/${user_name}/benchmark_test/${device_id}
ms_models_path=${benchmark_test}/ms_models
models_ascend_config=${benchmark_test}/models_ascend.cfg
if [[ ${backend} =~ "lite" ]]; then
models_ascend_config=${benchmark_test}/models_ascend_lite.cfg
elif [[ ${backend} =~ "cloud" ]]; then
models_ascend_config=${benchmark_test}/models_ascend_cloud.cfg
fi
model_data_path=/home/workspace/mindspore_dataset/mslite
# Write benchmark result to temp file

View File

@ -12,7 +12,7 @@ function Run_Converter() {
local ascend_cfg_file_list=("$models_ascend_config")
# Convert models:
# $1:cfgFileList; $2:inModelPath; $3:outModelPath; $4:logFile; $5:resultFile; $6:faile_not_return;
Convert "${ascend_cfg_file_list[*]}" $models_path $ms_models_path $run_converter_log_file $run_converter_result_file $x86_fail_not_return
Convert "${ascend_cfg_file_list[*]}" $models_path $ms_models_path $run_converter_log_file $run_converter_result_file $x86_fail_not_return $compile_type
}
# source ascend env
@ -42,7 +42,14 @@ mkdir -p ${ms_models_path}
model_data_path=/home/workspace/mindspore_dataset/mslite
models_path=${model_data_path}/models
models_ascend_config=${benchmark_test}/models_ascend.cfg
if [[ ${backend} =~ "lite" ]]; then
compile_type="lite"
models_ascend_config=${benchmark_test}/models_ascend_lite.cfg
elif [[ ${backend} =~ "cloud" ]]; then
compile_type="cloud"
models_ascend_config=${benchmark_test}/models_ascend_cloud.cfg
fi
# Write converter result to temp file
run_converter_log_file=${benchmark_test}/run_converter_log.txt
@ -67,6 +74,6 @@ else
fi
# Run Benchmark
source ${benchmark_test}/run_benchmark_ascend.sh -v $version -b $backend -d $device_id -a ${arch}
source ${benchmark_test}/run_benchmark_ascend.sh -v $version -b $backend -d $device_id -a ${arch} -c ${compile_type}
Run_Benchmark_status=$?
exit ${Run_Benchmark_status}

View File

@ -2,7 +2,7 @@
# Convert models:
function Convert() {
# $1:cfgFileList; $2:inModelPath; $3:outModelPath; $4:logFile; $5:resultFile; $6:failNotReturn;
# $1:cfgFileList; $2:inModelPath; $3:outModelPath; $4:logFile; $5:resultFile; $6:failNotReturn; $7:compileType
fifo_file="fifo_file.txt"
mkfifo ${fifo_file}
exec 6<>${fifo_file}
@ -83,8 +83,10 @@ function Convert() {
elif [[ ${cfg_file_name} =~ "_ascend" ]]; then
model_path=$2
option_file="${model_path}/model_option/${model_name}.txt"
if [ -f "$option_file" ]; then
config_file=${option_file}
if [[ ${cfg_file_name} =~ "_lite" ]]; then
if [ -f "$option_file" ]; then
config_file=${option_file}
fi
fi
export_mindir="MINDIR"
target_device="Ascend310"
@ -142,20 +144,15 @@ function Convert() {
' --inputDataType='${in_dtype}' --outputDataType='${out_dtype}' --inputShape="'${spec_shapes}'" --fp16='${fp16_weight}\
' --configFile='${config_file}' --trainModel='${train_model}' --exportMindIR='${export_mindir} ' --device='${target_device}\
' --encryption='${encryption_flag} ' --inputDataFormat='${input_format} '--NoFusion='${no_fusion}
if [[ ${cfg_file_name} =~ "_ascend" ]]; then
./converter_lite --fmk=${model_fmk} --modelFile=${model_file} --weightFile=${weight_file} --outputFile=${output_file}\
--inputDataType=${in_dtype} --outputDataType=${out_dtype} --inputShape="${spec_shapes}" --fp16=${fp16_weight}\
--trainModel=${train_model} --exportMindIR=${export_mindir} --device=${target_device}\
--encryption=${encryption_flag} --inputDataFormat=${input_format} >> "$4"
elif [[ ${cfg_file_name} =~ "_cloud" ]]; then
if [[ ${cfg_file_name} =~ "_cloud" ]]; then
./converter_lite --fmk=${model_fmk} --modelFile=${model_file} --weightFile=${weight_file} --outputFile=${output_file}\
--inputDataType=${in_dtype} --outputDataType=${out_dtype} --inputShape="${spec_shapes}" --fp16=${fp16_weight}\
--configFile=${config_file} --exportMindIR=${export_mindir} --NoFusion=${no_fusion} --encryption=${encryption_flag}\
--trainModel=${train_model} >> "$4"
--trainModel=${train_model} --device=${target_device} --inputDataFormat=${input_format} >> "$4"
else
./converter_lite --fmk=${model_fmk} --modelFile=${model_file} --weightFile=${weight_file} --outputFile=${output_file}\
--inputDataType=${in_dtype} --outputDataType=${out_dtype} --inputShape="${spec_shapes}" --fp16=${fp16_weight}\
--configFile=${config_file} --trainModel=${train_model} >> "$4"
--configFile=${config_file} --trainModel=${train_model} --device=${target_device} >> "$4"
fi
if [ $? = 0 ]; then

View File

@ -62,9 +62,8 @@ function linux_release_package()
cp ${input_path}/linux_aarch64/mindspore*.tar.gz* ${output_path}/release/linux/aarch64/
cp ${input_path}/centos_x86/ascend/mindspore*.whl* ${output_path}/release/linux/x86_64/ascend/
cp ${input_path}/centos_x86/ascend/mindspore*.tar.gz* ${output_path}/release/linux/x86_64/ascend/
# the lite Ascend package has been replaced with a refactored version, which will be added later
# cp ${input_path}/linux_aarch64/ascend/mindspore*.whl* ${output_path}/release/linux/aarch64/ascend/
# cp ${input_path}/linux_aarch64/ascend/mindspore*.tar.gz* ${output_path}/release/linux/aarch64/ascend/
cp ${input_path}/linux_aarch64/ascend/mindspore*.whl* ${output_path}/release/linux/aarch64/ascend/
cp ${input_path}/linux_aarch64/ascend/mindspore*.tar.gz* ${output_path}/release/linux/aarch64/ascend/
cp ${input_path}/centos_x86/tensorrt/mindspore*.whl* ${output_path}/release/linux/x86_64/tensorrt/
cp ${input_path}/centos_x86/tensorrt/mindspore*.tar.gz* ${output_path}/release/linux/x86_64/tensorrt/
cp -r ${input_path}/centos_x86/server/* ${output_path}/release/linux/x86_64/server/