diff --git a/mindspore/lite/test/st/run_benchmark_nets.sh b/mindspore/lite/test/st/run_benchmark_nets.sh index b78a5f64b55..000f6e1fe62 100644 --- a/mindspore/lite/test/st/run_benchmark_nets.sh +++ b/mindspore/lite/test/st/run_benchmark_nets.sh @@ -36,14 +36,21 @@ if [[ $backend == "all" || $backend == "arm64_cpu" || $backend == "arm64_fp32" | echo "Run arm64 failed" exit 1 fi + # run codegen + sh $cur_path/scripts/run_benchmark_codegen.sh -r $release_path -m $models_path -d $device_id -e "arm64_codegen" + arm64_status=$? + if [[ $arm64_status -ne 0 ]]; then + echo "Run arm64 codegen failed" + exit 1 + fi # run train - sh $cur_path/scripts/run_net_train.sh -r $release_path -m ${models_path}/../../models_train -d $device_id -e $backend + sh $cur_path/scripts/run_net_train.sh -r $release_path -m ${models_path}/../../models_train -d $device_id -e "arm64_train" arm64_status=$? if [[ $arm64_status -ne 0 ]]; then echo "Run arm64 train failed" exit 1 fi - sh $cur_path/scripts/run_net_train.sh -T -r $release_path -m ${models_path}/../../models_train -d $device_id -e $backend -c ${cur_path}/../config/models_ms_transfer.cfg + sh $cur_path/scripts/run_net_train.sh -T -r $release_path -m ${models_path}/../../models_train -d $device_id -e "arm64_train" -c ${cur_path}/../config/models_ms_transfer.cfg arm64_status=$? if [[ $arm64_status -ne 0 ]]; then echo "Run arm64 transferLearning failed" @@ -59,14 +66,21 @@ if [[ $backend == "all" || $backend == "arm32_cpu" || $backend == "arm32_fp32" | echo "Run arm32 failed" exit 1 fi + # run codegen + sh $cur_path/scripts/run_benchmark_codegen.sh -r $release_path -m $models_path -d $device_id -e "arm32_codegen" + arm32_status=$? + if [[ $arm32_status -ne 0 ]]; then + echo "Run arm32 codegen failed" + exit 1 + fi # run train - sh $cur_path/scripts/run_net_train.sh -r $release_path -m ${models_path}/../../models_train -d $device_id -e $backend + sh $cur_path/scripts/run_net_train.sh -r $release_path -m ${models_path}/../../models_train -d $device_id -e "arm32_train" arm32_status=$? if [[ $arm32_status -ne 0 ]]; then echo "Run arm32 train failed" exit 1 fi - sh $cur_path/scripts/run_net_train.sh -T -r $release_path -m ${models_path}/../../models_train -d $device_id -e $backend -c ${cur_path}/../config/models_ms_transfer.cfg + sh $cur_path/scripts/run_net_train.sh -T -r $release_path -m ${models_path}/../../models_train -d $device_id -e "arm32_train" -c ${cur_path}/../config/models_ms_transfer.cfg arm32_status=$? if [[ $arm32_status -ne 0 ]]; then echo "Run arm32 transferLearning failed" @@ -93,21 +107,28 @@ if [[ $backend == "all" || $backend == "npu" ]]; then fi if [[ $backend == "all" || $backend == "x86-all" || $backend == "x86" || $backend == "x86-sse" || \ - $backend == "x86-avx" || $backend == "x86-java" || $backend == "x86-codegen" ]]; then + $backend == "x86-avx" || $backend == "x86-java" || $backend == "x86_codegen" ]]; then sh $cur_path/scripts/run_benchmark_x86.sh -r $release_path -m $models_path -e $backend x86_status=$? if [[ $x86_status -ne 0 ]]; then echo "Run x86 failed" exit 1 fi + # run codegen + sh $cur_path/scripts/run_benchmark_codegen.sh -r $release_path -m $models_path -e "x86_codegen" + x86_status=$? + if [[ $x86_status -ne 0 ]]; then + echo "Run x86 codegen failed" + exit 1 + fi # run train - sh $cur_path/scripts/run_net_train.sh -r $release_path -m ${models_path}/../../models_train -e $backend + sh $cur_path/scripts/run_net_train.sh -r $release_path -m ${models_path}/../../models_train -e "x86_train" x86_status=$? if [[ $x86_status -ne 0 ]]; then echo "Run x86 train failed" exit 1 fi - sh $cur_path/scripts/run_net_train.sh -T -r $release_path -m ${models_path}/../../models_train -e $backend -c ${cur_path}/../config/models_ms_transfer.cfg + sh $cur_path/scripts/run_net_train.sh -T -r $release_path -m ${models_path}/../../models_train -e "x86_train" -c ${cur_path}/../config/models_ms_transfer.cfg x86_status=$? if [[ $x86_status -ne 0 ]]; then echo "Run x86 transferLearning failed" diff --git a/mindspore/lite/test/st/scripts/run_benchmark_arm32.sh b/mindspore/lite/test/st/scripts/run_benchmark_arm32.sh index 341a5b0e865..6ca7b4c4e14 100644 --- a/mindspore/lite/test/st/scripts/run_benchmark_arm32.sh +++ b/mindspore/lite/test/st/scripts/run_benchmark_arm32.sh @@ -37,94 +37,6 @@ function Run_armv82_a32_fp16() { Run_Benchmark "${arm32_cfg_file_list[*]}" . '/data/local/tmp' $run_armv82_a32_fp16_log_file $run_benchmark_result_file 'arm64' 'CPU' $device_id } -function Run_arm32_codegen() { - echo "ANDROID_NDK: ${ANDROID_NDK}" >> ${run_arm32_fp32_codegen_log_file} - cd ${arm32_path} || exit 1 - tar -zxf mindspore-lite-${version}-android-aarch32.tar.gz || exit 1 - local PKG_PATH=${arm32_path}/mindspore-lite-${version}-android-aarch32 - local CODEGEN_PATH=${x86_path}/mindspore-lite-${version}-linux-x64/tools/codegen - - rm -rf ${build_path} - mkdir -p ${build_path} - - # Run tflite converted models: - while read line; do - model_name=${line} - if [[ $model_name == \#* ]]; then - continue - fi - - { - echo "arm32_codegen: ${model_name}" - echo "${CODEGEN_PATH}/codegen --codePath=${build_path} --modelPath=${ms_models_path}/${model_name}.ms --target=ARM32A" - ${CODEGEN_PATH}/codegen --codePath=${build_path} --modelPath=${ms_models_path}/${model_name}.ms --target=ARM32A - } >> ${run_arm32_fp32_codegen_log_file} - - rm -rf ${build_path}/benchmark - mkdir -p ${build_path}/benchmark && cd ${build_path}/benchmark || exit 1 - - { - echo "cmake -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \ - -DANDROID_ABI=armeabi-v7a \ - -DANDROID_TOOLCHAIN_NAME=clang \ - -DANDROID_NATIVE_API_LEVEL=19 \ - -DPLATFORM_ARM32=ON \ - -DPKG_PATH=${PKG_PATH} ${build_path}/${model_name}" - - cmake -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \ - -DANDROID_ABI="armeabi-v7a" \ - -DANDROID_TOOLCHAIN_NAME="clang" \ - -DANDROID_NATIVE_API_LEVEL="19" \ - -DPLATFORM_ARM32=ON \ - -DPKG_PATH=${PKG_PATH} ${build_path}/${model_name} - - make -j4 - } >> ${run_arm32_fp32_codegen_log_file} - - rm -rf ${build_path}/codegen_test - mkdir ${build_path}/codegen_test && cd ${build_path}/codegen_test || exit 1 - cp -a ${build_path}/benchmark/benchmark ${build_path}/codegen_test/benchmark || exit 1 - cp -a ${build_path}/${model_name}/src/net.bin ${build_path}/codegen_test/net.bin || exit 1 - - { - echo 'ls ${build_path}/codegen_test' - ls ${build_path}/codegen_test - } >> ${run_arm32_fp32_codegen_log_file} - - # adb push all needed files to the phone - adb -s ${device_id} push ${build_path}/codegen_test /data/local/tmp/ > adb_push_log.txt - - { - echo 'cd /data/local/tmp/codegen_test' - echo 'chmod 777 benchmark' - echo 'chmod 777 net.bin' - echo 'ls' - echo './benchmark /data/local/tmp/input_output/input/'${model_name}'.ms.bin ./net.bin 1 /data/local/tmp/input_output/output/'${model_name}'.ms.out' - echo 'cd .. && rm -rf codegen_test' - } >> ${run_arm32_fp32_codegen_log_file} - - { - echo 'cd /data/local/tmp/codegen_test' - echo 'chmod 777 benchmark' - echo 'chmod 777 net.bin' - echo 'ls' - echo './benchmark /data/local/tmp/input_output/input/'${model_name}'.ms.bin ./net.bin 1 /data/local/tmp/input_output/output/'${model_name}'.ms.out' - echo 'cd .. && rm -rf codegen_test' - } > adb_run_cmd.txt - - adb -s ${device_id} shell < adb_run_cmd.txt >> ${run_arm32_fp32_codegen_log_file} - if [ $? = 0 ]; then - run_result='arm32_codegen: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file} - else - run_result='arm32_codegen: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1 - fi - done < ${models_codegen_config} - - rm -rf ${build_path} -} - basepath=$(pwd) echo ${basepath} #set -e @@ -154,8 +66,9 @@ while getopts "r:m:d:e:" opt; do esac done -# mkdir train +# package info x86_path=${release_path}/ubuntu_x86 +arm32_path=${release_path}/android_aarch32 file_name=$(ls ${x86_path}/*-linux-x64.tar.gz) IFS="-" read -r -a file_name_array <<< "$file_name" version=${file_name_array[2]} @@ -163,10 +76,8 @@ version=${file_name_array[2]} # Set models config filepath models_arm32_config=${basepath}/../config/models_arm32.cfg models_arm32_fp16_config=${basepath}/../config/models_arm32_fp16.cfg -models_codegen_config=${basepath}/../config/models_codegen.cfg ms_models_path=${basepath}/ms_models -build_path=${basepath}/codegen_build # Write converter result to temp file run_converter_log_file=${basepath}/run_converter_log.txt @@ -177,7 +88,7 @@ echo ' ' > ${run_converter_result_file} # Run converter echo "start Run converter ..." -Run_Converter $backend +Run_Converter Run_converter_status=$? sleep 1 @@ -198,42 +109,18 @@ echo ' ' > ${run_benchmark_result_file} run_armv82_a32_fp16_log_file=${basepath}/run_armv82_a32_fp16_log.txt echo 'run arm82_a32_fp16 logs: ' > ${run_armv82_a32_fp16_log_file} - run_arm32_log_file=${basepath}/run_arm32_log.txt echo 'run arm32 logs: ' > ${run_arm32_log_file} -run_arm32_fp32_codegen_log_file=${basepath}/run_arm32_fp32_codegen_log.txt -echo 'run arm32_codegen logs: ' > ${run_arm32_fp32_codegen_log_file} - # Copy the MindSpore models: echo "Push files to the arm and run benchmark" benchmark_test_path=${basepath}/benchmark_test rm -rf ${benchmark_test_path} mkdir -p ${benchmark_test_path} cp -a ${ms_models_path}/*.ms ${benchmark_test_path} || exit 1 -# Copy models converted using old release of mslite converter for compatibility test -cp -a ${models_path}/compatibility_test/*.ms ${benchmark_test_path} || exit 1 - -# package info -arm32_path=${release_path}/android_aarch32 -file_name=$(ls ${arm32_path}/*-android-aarch32.tar.gz) -IFS="-" read -r -a file_name_array <<< "$file_name" -version=${file_name_array[2]} backend=${backend:-"all"} isFailed=0 -if [[ $backend == "all" || $backend == "arm32_cpu" || $backend == "arm32_codegen" ]]; then - # Run on arm32 codegen - echo "start Run arm32 codegen ..." - Run_arm32_codegen - Run_arm32_codegen_status=$? - sleep 1 - if [[ ${Run_arm32_codegen_status} != 0 ]];then - echo "Run_arm32 codegen failed" - cat ${run_arm32_fp32_codegen_log_file} - isFailed=1 - fi -fi if [[ $backend == "all" || $backend == "arm32_cpu" || $backend == "arm32_fp16" ]]; then # Run on armv82-a32-fp16 echo "start Run armv82-a32-fp16 ..." diff --git a/mindspore/lite/test/st/scripts/run_benchmark_arm64.sh b/mindspore/lite/test/st/scripts/run_benchmark_arm64.sh index 5946ed6c1c6..39f954e8501 100644 --- a/mindspore/lite/test/st/scripts/run_benchmark_arm64.sh +++ b/mindspore/lite/test/st/scripts/run_benchmark_arm64.sh @@ -89,94 +89,6 @@ function Run_arm64_fp16() { Run_Benchmark "${arm64_cfg_file_list[*]}" . '/data/local/tmp' $run_arm64_fp16_log_file $run_benchmark_result_file 'arm64' 'CPU' $device_id } -function Run_arm64_codegen() { - echo "ANDROID_NDK: ${ANDROID_NDK}" >> ${run_arm64_fp32_codegen_log_file} - cd ${arm64_path} || exit 1 - tar -zxf mindspore-lite-${version}-android-aarch64.tar.gz || exit 1 - local PKG_PATH=${arm64_path}/mindspore-lite-${version}-android-aarch64 - local CODEGEN_PATH=${x86_path}/mindspore-lite-${version}-linux-x64/tools/codegen - - rm -rf ${build_path} - mkdir -p ${build_path} - - # Run tflite converted models: - while read line; do - model_name=${line} - if [[ $model_name == \#* ]]; then - continue - fi - - { - echo "arm64_codegen: ${model_name}" - echo "${CODEGEN_PATH}/codegen --codePath=${build_path} --modelPath=${ms_models_path}/${model_name}.ms --target=ARM64" - ${CODEGEN_PATH}/codegen --codePath=${build_path} --modelPath=${ms_models_path}/${model_name}.ms --target=ARM64 - } >> ${run_arm64_fp32_codegen_log_file} - - rm -rf ${build_path}/benchmark - mkdir -p ${build_path}/benchmark && cd ${build_path}/benchmark || exit 1 - - { - echo "cmake -DCMAKE_BUILD_TYPE=Release - -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake - -DANDROID_ABI=arm64-v8a - -DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang - -DANDROID_NATIVE_API_LEVEL=19 - -DPLATFORM_ARM64=ON - -DPKG_PATH=${PKG_PATH} ${build_path}/${model_name}" - - cmake -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \ - -DANDROID_ABI="arm64-v8a" \ - -DANDROID_TOOLCHAIN_NAME="aarch64-linux-android-clang" \ - -DANDROID_NATIVE_API_LEVEL="19" \ - -DPLATFORM_ARM64=ON \ - -DPKG_PATH=${PKG_PATH} ${build_path}/${model_name} - - make -j4 - } >> ${run_arm64_fp32_codegen_log_file} - - rm -rf ${build_path}/codegen_test - mkdir ${build_path}/codegen_test && cd ${build_path}/codegen_test || exit 1 - cp -a ${build_path}/benchmark/benchmark ${build_path}/codegen_test/benchmark || exit 1 - cp -a ${build_path}/${model_name}/src/net.bin ${build_path}/codegen_test/net.bin || exit 1 - - { - echo 'ls ${build_path}/codegen_test' - ls ${build_path}/codegen_test - } >> ${run_arm64_fp32_codegen_log_file} - - # adb push all needed files to the phone - adb -s ${device_id} push ${build_path}/codegen_test /data/local/tmp/ > adb_push_log.txt - - { - echo 'cd /data/local/tmp/codegen_test' - echo 'chmod 777 benchmark' - echo 'chmod 777 net.bin' - echo 'ls' - echo './benchmark /data/local/tmp/input_output/input/'${model_name}'.ms.bin ./net.bin 1 /data/local/tmp/input_output/output/'${model_name}'.ms.out' - echo 'cd .. && rm -rf codegen_test' - } >> ${run_arm64_fp32_codegen_log_file} - - { - echo 'cd /data/local/tmp/codegen_test' - echo 'chmod 777 benchmark' - echo 'chmod 777 net.bin' - echo 'ls' - echo './benchmark /data/local/tmp/input_output/input/'${model_name}'.ms.bin ./net.bin 1 /data/local/tmp/input_output/output/'${model_name}'.ms.out' - echo 'cd .. && rm -rf codegen_test' - } > adb_run_cmd.txt - - adb -s ${device_id} shell < adb_run_cmd.txt >> ${run_arm64_fp32_codegen_log_file} - if [ $? = 0 ]; then - run_result='arm64_codegen: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file} - else - run_result='arm64_codegen: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1 - fi - done < ${models_codegen_config} - - rm -rf ${build_path} -} - basepath=$(pwd) echo ${basepath} #set -e @@ -206,8 +118,9 @@ while getopts "r:m:d:e:" opt; do esac done -# mkdir train +# package info x86_path=${release_path}/ubuntu_x86 +arm64_path=${release_path}/android_aarch64 file_name=$(ls ${x86_path}/*-linux-x64.tar.gz) IFS="-" read -r -a file_name_array <<< "$file_name" version=${file_name_array[2]} @@ -231,10 +144,8 @@ models_weightquant_9bit_config=${basepath}/../config/models_weightquant_9bit.cfg models_weightquant_config=${basepath}/../config/models_weightquant.cfg models_compatibility_config=${basepath}/../config/models_compatibility.cfg models_for_process_only_config=${basepath}/../config/models_for_process_only.cfg -models_codegen_config=${basepath}/../config/models_codegen.cfg ms_models_path=${basepath}/ms_models -build_path=${basepath}/codegen_build # Write converter result to temp file run_converter_log_file=${basepath}/run_converter_log.txt @@ -268,10 +179,6 @@ echo ' ' > ${run_benchmark_result_file} run_arm64_fp32_log_file=${basepath}/run_arm64_fp32_log.txt echo 'run arm64_fp32 logs: ' > ${run_arm64_fp32_log_file} - -run_arm64_fp32_codegen_log_file=${basepath}/run_arm64_fp32_codegen_log.txt -echo 'run arm64_codegen logs: ' > ${run_arm64_fp32_codegen_log_file} - run_arm64_fp16_log_file=${basepath}/run_arm64_fp16_log.txt echo 'run arm64_fp16 logs: ' > ${run_arm64_fp16_log_file} @@ -284,12 +191,6 @@ cp -a ${ms_models_path}/*.ms ${benchmark_test_path} || exit 1 # Copy models converted using old release of mslite converter for compatibility test cp -a ${models_path}/compatibility_test/*.ms ${benchmark_test_path} || exit 1 -# package info -arm64_path=${release_path}/android_aarch64 -file_name=$(ls ${arm64_path}/*-android-aarch64.tar.gz) -IFS="-" read -r -a file_name_array <<< "$file_name" -version=${file_name_array[2]} - backend=${backend:-"all"} isFailed=0 if [[ $backend == "all" || $backend == "arm64_cpu" || $backend == "arm64_fp32" ]]; then @@ -304,18 +205,6 @@ if [[ $backend == "all" || $backend == "arm64_cpu" || $backend == "arm64_fp32" ] isFailed=1 fi fi -if [[ $backend == "all" || $backend == "arm64_cpu" || $backend == "arm64_fp32" || $backend == "arm64_codegen" ]]; then - # Run on codegen - echo "start Run arm64 codegen ..." - Run_arm64_codegen - Run_arm64_codegen_status=$? - sleep 1 - if [[ ${Run_arm64_codegen_status} != 0 ]];then - echo "Run_arm64_codegen failed" - cat ${run_arm64_fp32_codegen_log_file} - isFailed=1 - fi -fi if [[ $backend == "all" || $backend == "arm64_cpu" || $backend == "arm64_fp16" ]]; then # Run on arm64-fp16 echo "start Run arm64-fp16 ..." diff --git a/mindspore/lite/test/st/scripts/run_benchmark_codegen.sh b/mindspore/lite/test/st/scripts/run_benchmark_codegen.sh new file mode 100644 index 00000000000..c799bd73754 --- /dev/null +++ b/mindspore/lite/test/st/scripts/run_benchmark_codegen.sh @@ -0,0 +1,326 @@ +#!/bin/bash +source ./scripts/base_functions.sh + +# Run converter on x86 platform: +function Run_Converter() { + # Unzip x86 runtime and converter + cd ${x86_path} || exit 1 + tar -zxf mindspore-lite-${version}-linux-x64.tar.gz || exit 1 + cd ${x86_path}/mindspore-lite-${version}-linux-x64/ || exit 1 + + cp tools/converter/converter/converter_lite ./ || exit 1 + export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:./tools/converter/lib/:./tools/converter/third_party/glog/lib + + rm -rf ${ms_models_path} + mkdir -p ${ms_models_path} + # Prepare the config file list + local cfg_file_list=("$models_codegen_parallel_config" "$models_codegen_config") + # Convert models: + # $1:cfgFileList; $2:inModelPath; $3:outModelPath; $4:logFile; $5:resultFile; + Convert "${cfg_file_list[*]}" $models_path $ms_models_path $run_converter_log_file $run_converter_result_file +} + +# Run on x86 codegen benchmark +function Run_x86_codegen() { + # $1:buildPath $2:modelPath $3:cfgFile $4:logFile $5:resultFile + local CODEGEN_PATH=${x86_path}/mindspore-lite-${version}-linux-x64/tools/codegen + rm -rf $1 + mkdir -p $1 + + while read line; do + model_name=${line} + if [[ $model_name == \#* || $model_name == "" ]]; then + continue + fi + support_parallel="false" + bind_mode="" + thread_num="" + suffix="" + if [[ $3 =~ "parallel" ]]; then + support_parallel="true" + bind_mode="0" + thread_num="4" + suffix="parallel" + fi + echo ${model_name} >> "$4" + ${CODEGEN_PATH}/codegen --codePath=$1 --modelPath=$2/${model_name}.ms --supportParallel=${support_parallel} >> $4 + # 1. build benchmark + mkdir -p $1/${model_name}/build && cd $1/${model_name}/build || exit 1 + cmake -DPKG_PATH=${x86_path}/mindspore-lite-${version}-linux-x64 $1/${model_name} >> $4 + make >> $4 + # 2. run benchmark + echo "net file: $1/${model_name}/src/net.bin" >> $4 + echo "./benchmark ${models_path}/input_output/input/${model_name}.ms.bin $1/${model_name}/src/net.bin 1 ${models_path}/input_output/output/${model_name}.ms.out ${thread_num} ${bind_mode}" >> $4 + ./benchmark ${models_path}/input_output/input/${model_name}.ms.bin $1/${model_name}/src/net.bin 1 ${models_path}/input_output/output/${model_name}.ms.out ${thread_num} ${bind_mode} >> $4 + if [ $? = 0 ]; then + run_result='x86_codegen '${suffix}': '${model_name}' pass'; echo ${run_result} >> $5 + else + run_result='x86_codegen '${suffix}': '${model_name}' failed'; echo ${run_result} >> $5; return 1 + fi + done < $3 + + rm -rf $1 +} + +function Run_arm_codegen() { + # $1:buildPath $2:modelPath $3:cfgFile $4:logFile $5:resultFile $6:deviceID $7:processor + echo "ANDROID_NDK: ${ANDROID_NDK}" >> $4 + package_path=${arm64_path} + package_suffix="aarch64" + target="ARM64" + platform=${target} + android_abi="arm64-v8a" + toolchain_name="aarch64-linux-android-clang" + if [[ $7 == "arm32" ]]; then + package_suffix="aarch32" + target="ARM32A" + platform="ARM32" + android_abi="armeabi-v7a" + toolchain_name="clang" + package_path=${arm32_path} + fi + cd ${package_path} || exit 1 + tar -zxf mindspore-lite-${version}-android-${package_suffix}.tar.gz || exit 1 + local PKG_PATH=${package_path}/mindspore-lite-${version}-android-${package_suffix} + local CODEGEN_PATH=${x86_path}/mindspore-lite-${version}-linux-x64/tools/codegen + + rm -rf $1 + mkdir -p $1 + + # Run tflite converted models: + while read line; do + model_name=${line} + if [[ $model_name == \#* ]]; then + continue + fi + + { + echo "$7_codegen: ${model_name}" + echo "${CODEGEN_PATH}/codegen --codePath=$1 --modelPath=$2/${model_name}.ms --target=${target}" + ${CODEGEN_PATH}/codegen --codePath=$1 --modelPath=$2/${model_name}.ms --target=${target} + } >> $4 + + rm -rf $1/benchmark + mkdir -p $1/benchmark && cd $1/benchmark || exit 1 + + { + echo "cmake -DCMAKE_BUILD_TYPE=Release + -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake + -DANDROID_ABI=${android_abi} + -DANDROID_TOOLCHAIN_NAME=${toolchain_name} + -DANDROID_NATIVE_API_LEVEL=19 + -DPLATFORM_${platform}=ON + -DPKG_PATH=${PKG_PATH} $1/${model_name}" + + cmake -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \ + -DANDROID_ABI=${android_abi} \ + -DANDROID_TOOLCHAIN_NAME=${toolchain_name} \ + -DANDROID_NATIVE_API_LEVEL="19" \ + -DPLATFORM_${platform}=ON \ + -DPKG_PATH=${PKG_PATH} $1/${model_name} + + make -j4 + } >> $4 + + rm -rf $1/codegen_test + mkdir $1/codegen_test && cd $1/codegen_test || exit 1 + cp -a $1/benchmark/benchmark $1/codegen_test/benchmark || exit 1 + cp -a $1/${model_name}/src/net.bin $1/codegen_test/net.bin || exit 1 + + { + echo 'ls ${build_path}/codegen_test' + ls $1/codegen_test + } >> $4 + + # adb push all needed files to the phone + adb -s $6 push $1/codegen_test /data/local/tmp/ > adb_push_log.txt + + { + echo 'cd /data/local/tmp/codegen_test' + echo 'chmod 777 benchmark' + echo 'chmod 777 net.bin' + echo 'ls' + echo './benchmark /data/local/tmp/input_output/input/'${model_name}'.ms.bin ./net.bin 1 /data/local/tmp/input_output/output/'${model_name}'.ms.out' + echo 'cd .. && rm -rf codegen_test' + } >> $4 + + { + echo 'cd /data/local/tmp/codegen_test' + echo 'chmod 777 benchmark' + echo 'chmod 777 net.bin' + echo 'ls' + echo './benchmark /data/local/tmp/input_output/input/'${model_name}'.ms.bin ./net.bin 1 /data/local/tmp/input_output/output/'${model_name}'.ms.out' + echo 'cd .. && rm -rf codegen_test' + } > adb_run_cmd.txt + + adb -s $6 shell < adb_run_cmd.txt >> $4 + if [ $? = 0 ]; then + run_result=$7'_codegen: '${model_name}' pass'; echo ${run_result} >> $5 + else + run_result=$7'_codegen: '${model_name}' failed'; echo ${run_result} >> $5; return 1 + fi + done < $3 + + rm -rf $1 +} + +basepath=$(pwd) +echo ${basepath} + +# Example:sh run_benchmark_codegen.sh -r /home/temp_test -m /home/temp_test/models -d "8KE5T19620002408" -e arm_cpu +while getopts "r:m:d:e:" opt; do + case ${opt} in + r) + release_path=${OPTARG} + echo "release_path is ${OPTARG}" + ;; + m) + models_path=${OPTARG} + echo "models_path is ${OPTARG}" + ;; + d) + device_id=${OPTARG} + echo "device_id is ${OPTARG}" + ;; + e) + backend=${OPTARG} + echo "backend is ${OPTARG}" + ;; + ?) + echo "unknown para" + exit 1;; + esac +done + +# package info +x86_path=${release_path}/ubuntu_x86 +arm32_path=${release_path}/android_aarch32 +arm64_path=${release_path}/android_aarch64 +file_name=$(ls ${x86_path}/*-linux-x64.tar.gz) +IFS="-" read -r -a file_name_array <<< "$file_name" +version=${file_name_array[2]} + +# Set models config filepath +models_codegen_config=${basepath}/../config/models_codegen.cfg +models_codegen_parallel_config=${basepath}/../config/models_codegen_parallel.cfg + +ms_models_path=${basepath}/ms_models +build_path=${basepath}/codegen_build +build_parallal_path=${basepath}/codegen_parallel_build + +# Write converter result to temp file +run_converter_log_file=${basepath}/run_converter_log.txt +echo ' ' > ${run_converter_log_file} + +run_converter_result_file=${basepath}/run_converter_result.txt +echo ' ' > ${run_converter_result_file} + +# Run converter +echo "start Run converter ..." +Run_Converter +Run_converter_status=$? +sleep 1 + +# Check converter result and return value +if [[ ${Run_converter_status} = 0 ]];then + echo "Run converter success" + Print_Converter_Result $run_converter_result_file +else + echo "Run converter failed" + cat ${run_converter_log_file} + Print_Converter_Result $run_converter_result_file + exit 1 +fi + +# Write benchmark result to temp file +run_benchmark_result_file=${basepath}/run_benchmark_result.txt +echo ' ' > ${run_benchmark_result_file} + +run_arm32_fp32_codegen_log_file=${basepath}/run_arm32_fp32_codegen_log.txt +echo 'run arm32_codegen logs: ' > ${run_arm32_fp32_codegen_log_file} +run_arm64_fp32_codegen_log_file=${basepath}/run_arm64_fp32_codegen_log.txt +echo 'run arm64_codegen logs: ' > ${run_arm64_fp32_codegen_log_file} +run_x86_codegen_log_file=${basepath}/run_x86_codegen_log.txt +echo 'run x86 codegen logs: ' > ${run_x86_codegen_log_file} +run_x86_codegen_parallel_log_file=${basepath}/run_x86_codegen_parallel_log.txt +echo 'run x86 codegen parallel logs: ' > ${run_x86_codegen_parallel_log_file} + +# Copy the MindSpore models: +echo "Push files to the arm and run benchmark" +benchmark_test_path=${basepath}/benchmark_test +rm -rf ${benchmark_test_path} +mkdir -p ${benchmark_test_path} +cp -a ${ms_models_path}/*.ms ${benchmark_test_path} || exit 1 + +echo "input backend is ${backend}" +backend=${backend:-"all"} +isFailed=0 +echo "current backend is ${backend}" +if [[ $backend == "all" || $backend == "codegen" || $backend == "x86_codegen" || $backend == "codegen&train" ]]; then + # Run on x86-codegen + echo "start Run x86 codegen ..." + Run_x86_codegen ${build_path} ${ms_models_path} ${models_codegen_config} ${run_x86_codegen_log_file} ${run_benchmark_result_file} & + Run_x86_codegen_PID=$! + sleep 1 +fi +if [[ $backend == "all" || $backend == "codegen" || $backend == "x86_codegen" || $backend == "x86_codegen_parallel" || $backend == "codegen&train" ]]; then + # Run on x86-codegen-parallel + echo "start Run x86 codegen parallel ..." + Run_x86_codegen ${build_parallal_path} ${ms_models_path} ${models_codegen_parallel_config} ${run_x86_codegen_parallel_log_file} ${run_benchmark_result_file} & + Run_x86_codegen_parallel_PID=$! + sleep 1 +fi +if [[ $backend == "all" || $backend == "codegen" || $backend == "arm64_codegen" || $backend == "codegen&train" ]]; then + # Run on codegen + echo "start Run arm64 codegen ..." + Run_arm_codegen ${build_path} ${ms_models_path} ${models_codegen_config} ${run_arm64_fp32_codegen_log_file} ${run_benchmark_result_file} ${device_id} "arm64" + Run_arm64_codegen_status=$? + sleep 1 +fi +if [[ $backend == "all" || $backend == "codegen" || $backend == "arm32_codegen" || $backend == "codegen&train" ]]; then + # Run on arm32 codegen + echo "start Run arm32 codegen ..." + Run_arm_codegen ${build_path} ${ms_models_path} ${models_codegen_config} ${run_arm32_fp32_codegen_log_file} ${run_benchmark_result_file} ${device_id} "arm32" + Run_arm32_codegen_status=$? + sleep 1 +fi + +if [[ $backend == "all" || $backend == "codegen" || $backend == "x86_codegen" || $backend == "codegen&train" ]]; then + wait ${Run_x86_codegen_PID} + Run_x86_codegen_status=$? + + if [[ ${Run_x86_codegen_status} != 0 ]];then + echo "Run_x86 codegen failed" + cat ${run_x86_codegen_log_file} + isFailed=1 + fi +fi +if [[ $backend == "all" || $backend == "codegen" || $backend == "x86_codegen" || $backend == "x86_codegen_parallel" || $backend == "codegen&train" ]]; then + wait ${Run_x86_codegen_parallel_PID} + Run_x86_codegen_parallel_status=$? + + if [[ ${Run_x86_codegen_parallel_status} != 0 ]];then + echo "Run_x86 codegen parallel failed" + cat ${run_x86_codegen_log_file} + isFailed=1 + fi +fi +if [[ $backend == "all" || $backend == "codegen" || $backend == "arm64_codegen" || $backend == "codegen&train" ]]; then + if [[ ${Run_arm64_codegen_status} != 0 ]];then + echo "Run_arm64_codegen failed" + cat ${run_arm64_fp32_codegen_log_file} + isFailed=1 + fi +fi +if [[ $backend == "all" || $backend == "codegen" || $backend == "arm32_codegen" || $backend == "codegen&train" ]]; then + if [[ ${Run_arm32_codegen_status} != 0 ]];then + echo "Run_arm32_codegen failed" + cat ${run_arm32_fp32_codegen_log_file} + isFailed=1 + fi +fi + +echo "Run codegen is ended" +Print_Benchmark_Result $run_benchmark_result_file +exit ${isFailed} diff --git a/mindspore/lite/test/st/scripts/run_benchmark_gpu.sh b/mindspore/lite/test/st/scripts/run_benchmark_gpu.sh index bee1daa2e96..2c6c96623ff 100644 --- a/mindspore/lite/test/st/scripts/run_benchmark_gpu.sh +++ b/mindspore/lite/test/st/scripts/run_benchmark_gpu.sh @@ -161,8 +161,6 @@ benchmark_test_path=${basepath}/benchmark_test rm -rf ${benchmark_test_path} mkdir -p ${benchmark_test_path} cp -a ${ms_models_path}/*.ms ${benchmark_test_path} || exit 1 -# Copy models converted using old release of mslite converter for compatibility test -cp -a ${models_path}/compatibility_test/*.ms ${benchmark_test_path} || exit 1 backend=${backend:-"all"} isFailed=0 @@ -195,13 +193,11 @@ if [[ $backend == "all" || $backend == "gpu" ]]; then echo "Run cropper failed" cat ${run_gpu_log_file} isFailed=1 - exit 1 fi fi echo "Run_gpu and Run_cropper is ended" Print_Benchmark_Result $run_benchmark_result_file -exit ${isFailed} ########## mindrt parallel test ############## run_parallel_result_file=${basepath}/run_parallel_result.txt @@ -226,9 +222,8 @@ if [[ $backend == "all" || $backend == "gpu" ]]; then Print_Parallel_Result $run_parallel_result_file if [[ ${Run_mindrt_parallel_status} != 0 ]];then - exit 1 + isFailed=1 fi fi ########## mindrt parallel test end ############## - -exit 0 +exit ${isFailed} diff --git a/mindspore/lite/test/st/scripts/run_benchmark_npu.sh b/mindspore/lite/test/st/scripts/run_benchmark_npu.sh index 622411e954e..d16ced5c676 100644 --- a/mindspore/lite/test/st/scripts/run_benchmark_npu.sh +++ b/mindspore/lite/test/st/scripts/run_benchmark_npu.sh @@ -73,7 +73,6 @@ while getopts "r:m:d:e:" opt; do done # mkdir train - x86_path=${release_path}/ubuntu_x86 file_name=$(ls ${x86_path}/*linux-x64.tar.gz) IFS="-" read -r -a file_name_array <<< "$file_name" diff --git a/mindspore/lite/test/st/scripts/run_benchmark_x86.sh b/mindspore/lite/test/st/scripts/run_benchmark_x86.sh index 774f743a489..7a02ccc04d7 100644 --- a/mindspore/lite/test/st/scripts/run_benchmark_x86.sh +++ b/mindspore/lite/test/st/scripts/run_benchmark_x86.sh @@ -78,25 +78,25 @@ function Run_x86() { echo './benchmark --modelFile='${ms_models_path}'/'${model_name}'_1_1_parallel_split.ms --inDataFile='${models_path}'/input_output/input/'${model_name}'.ms.bin --inputShapes='${input_shapes}' --benchmarkDataFile='${models_path}'/input_output/output/'${model_name}'.ms.out' >> "${run_x86_log_file}" ./benchmark --modelFile=${ms_models_path}/${model_name}_1_1_parallel_split.ms --inDataFile=${models_path}/input_output/input/${model_name}.ms.bin --inputShapes=${input_shapes} --benchmarkDataFile=${models_path}/input_output/output/${model_name}.ms.out >> "${run_x86_log_file}" if [ $? = 0 ]; then - run_result='x86: '${model_name}_1_1_parallel_split' pass'; echo ${run_result} >> ${run_benchmark_result_file} + run_result='x86_Parallel_Split: '${model_name}_1_1_parallel_split' pass'; echo ${run_result} >> ${run_benchmark_result_file} else - run_result='x86: '${model_name}_1_1_parallel_split' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1 + run_result='x86_Parallel_Split: '${model_name}_1_1_parallel_split' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1 fi echo './benchmark --modelFile='${ms_models_path}'/'${model_name}'_1_2_parallel_split.ms --inDataFile='${models_path}'/input_output/input/'${model_name}'.ms.bin --inputShapes='${input_shapes}' --benchmarkDataFile='${models_path}'/input_output/output/'${model_name}'.ms.out' >> "${run_x86_log_file}" ./benchmark --modelFile=${ms_models_path}/${model_name}_1_2_parallel_split.ms --inDataFile=${models_path}/input_output/input/${model_name}.ms.bin --inputShapes=${input_shapes} --benchmarkDataFile=${models_path}/input_output/output/${model_name}.ms.out >> "${run_x86_log_file}" if [ $? = 0 ]; then - run_result='x86: '${model_name}_1_2_parallel_split' pass'; echo ${run_result} >> ${run_benchmark_result_file} + run_result='x86_Parallel_Split: '${model_name}_1_2_parallel_split' pass'; echo ${run_result} >> ${run_benchmark_result_file} else - run_result='x86: '${model_name}_1_2_parallel_split' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1 + run_result='x86_Parallel_Split: '${model_name}_1_2_parallel_split' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1 fi echo './benchmark --modelFile='${ms_models_path}'/'${model_name}'_1_3_parallel_split.ms --inDataFile='${models_path}'/input_output/input/'${model_name}'.ms.bin --inputShapes='${input_shapes}' --benchmarkDataFile='${models_path}'/input_output/output/'${model_name}'.ms.out' >> "${run_x86_log_file}" ./benchmark --modelFile=${ms_models_path}/${model_name}_1_3_parallel_split.ms --inDataFile=${models_path}/input_output/input/${model_name}.ms.bin --inputShapes=${input_shapes} --benchmarkDataFile=${models_path}/input_output/output/${model_name}.ms.out >> "${run_x86_log_file}" if [ $? = 0 ]; then - run_result='x86: '${model_name}_1_3_parallel_split' pass'; echo ${run_result} >> ${run_benchmark_result_file} + run_result='x86_Parallel_Split: '${model_name}_1_3_parallel_split' pass'; echo ${run_result} >> ${run_benchmark_result_file} else - run_result='x86: '${model_name}_1_3_parallel_split' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1 + run_result='x86_Parallel_Split: '${model_name}_1_3_parallel_split' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1 fi done < ${models_tflite_parallel_split_config} @@ -123,9 +123,9 @@ function Run_x86() { ./benchmark --modelFile=${ms_models_path}/${model_name}_posttraining.ms --inDataFile=${transformer_data_path}/decoder_buffer_in_9.bin,${transformer_data_path}/decoder_buffer_in_2.bin,${transformer_data_path}/decoder_buffer_in_0.bin,${transformer_data_path}/decoder_buffer_in_1.bin,${transformer_data_path}/decoder_buffer_in_5.bin,${transformer_data_path}/decoder_buffer_in_3.bin,${transformer_data_path}/decoder_buffer_in_4.bin,${transformer_data_path}/decoder_buffer_in_8.bin,${transformer_data_path}/decoder_buffer_in_6.bin,${transformer_data_path}/decoder_buffer_in_7.bin,${transformer_data_path}/decoder_buffer_in_10.bin --benchmarkDataFile=${models_path}/input_output/output/${model_name}_posttraining.ms.out --accuracyThreshold=${accuracy_limit} >> "${run_x86_log_file}" fi if [ $? = 0 ]; then - run_result='x86: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file} + run_result='x86_posttraining: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file} else - run_result='x86: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1 + run_result='x86_posttraining: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1 fi done < ${models_tflite_posttraining_config} @@ -265,70 +265,6 @@ function Run_x86_java() { done < ${models_tflite_config} } -# Run on x86 codegen benchmark -function Run_x86_codegen() { - local CODEGEN_PATH=${x86_path}/mindspore-lite-${version}-linux-x64/tools/codegen - - rm -rf ${build_path} - mkdir -p ${build_path} - - while read line; do - model_name=${line} - if [[ $model_name == \#* ]]; then - continue - fi - echo ${model_name} >> "${run_x86_codegen_log_file}" - ${CODEGEN_PATH}/codegen --codePath=${build_path} --modelPath=${ms_models_path}/${model_name}.ms >> ${run_x86_codegen_log_file} - # 1. build benchmark - mkdir -p ${build_path}/${model_name}/build && cd ${build_path}/${model_name}/build || exit 1 - cmake -DPKG_PATH=${x86_path}/mindspore-lite-${version}-linux-x64 ${build_path}/${model_name} >> ${run_x86_codegen_log_file} - make >> ${run_x86_codegen_log_file} - # 2. run benchmark - echo "net file: ${build_path}/${model_name}/src/net.bin" >> ${run_x86_codegen_log_file} - echo "./benchmark ${models_path}/input_output/input/${model_name}.ms.bin ${build_path}/${model_name}/src/net.bin 1 ${models_path}/input_output/output/${model_name}.ms.out" >> ${run_x86_codegen_log_file} - ./benchmark ${models_path}/input_output/input/${model_name}.ms.bin ${build_path}/${model_name}/src/net.bin 1 ${models_path}/input_output/output/${model_name}.ms.out >> ${run_x86_codegen_log_file} - if [ $? = 0 ]; then - run_result='x86_codegen: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file} - else - run_result='x86_codegen: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1 - fi - done < ${models_codegen_config} - - rm -rf ${build_path} -} - -# Run on x86 codegen benchmark parallel -function Run_x86_codegen_parallel() { - local CODEGEN_PATH=${x86_path}/mindspore-lite-${version}-linux-x64/tools/codegen - - rm -rf ${build_parallal_path} - mkdir -p ${build_parallal_path} - - while read line; do - model_name=${line} - if [[ $model_name == \#* ]]; then - continue - fi - echo ${model_name} >> "${run_x86_codegen_parallel_log_file}" - ${CODEGEN_PATH}/codegen --codePath=${build_parallal_path} --modelPath=${ms_models_path}/${model_name}.ms --supportParallel=true >> ${run_x86_codegen_parallel_log_file} - # 1. build benchmark - mkdir -p ${build_parallal_path}/${model_name}/build && cd ${build_parallal_path}/${model_name}/build || exit 1 - cmake -DPKG_PATH=${x86_path}/mindspore-lite-${version}-linux-x64 ${build_parallal_path}/${model_name} >> ${run_x86_codegen_parallel_log_file} - make >> ${run_x86_codegen_parallel_log_file} - # 2. run benchmark - echo "net file: ${build_parallal_path}/${model_name}/src/net.bin" >> ${run_x86_codegen_parallel_log_file} - echo "./benchmark ${models_path}/input_output/input/${model_name}.ms.bin ${build_parallal_path}/${model_name}/src/net.bin 1 ${models_path}/input_output/output/${model_name}.ms.out thread_num=4 0" >> ${run_x86_codegen_parallel_log_file} - ./benchmark ${models_path}/input_output/input/${model_name}.ms.bin ${build_parallal_path}/${model_name}/src/net.bin 1 ${models_path}/input_output/output/${model_name}.ms.out 4 0 >> ${run_x86_codegen_parallel_log_file} - if [ $? = 0 ]; then - run_result='x86_codegen_parallel: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file} - else - run_result='x86_codegen_parallel: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1 - fi - done < ${models_codegen_parallel_config} - - rm -rf ${build_parallal_path} -} - basepath=$(pwd) echo ${basepath} #set -e @@ -376,12 +312,8 @@ models_weightquant_7bit_config=${basepath}/../config/models_weightquant_7bit.cfg models_weightquant_9bit_config=${basepath}/../config/models_weightquant_9bit.cfg models_weightquant_config=${basepath}/../config/models_weightquant.cfg models_for_process_only_config=${basepath}/../config/models_for_process_only.cfg -models_codegen_config=${basepath}/../config/models_codegen.cfg -models_codegen_parallel_config=${basepath}/../config/models_codegen_parallel.cfg ms_models_path=${basepath}/ms_models -build_path=${basepath}/codegen_build -build_parallal_path=${basepath}/codegen_parallel_build # Write converter result to temp file run_converter_log_file=${basepath}/run_converter_log.txt @@ -413,22 +345,13 @@ echo ' ' > ${run_benchmark_result_file} run_x86_log_file=${basepath}/run_x86_log.txt echo 'run x86 logs: ' > ${run_x86_log_file} - run_x86_sse_log_file=${basepath}/run_x86_sse_log.txt echo 'run x86 sse logs: ' > ${run_x86_sse_log_file} - run_x86_avx_log_file=${basepath}/run_x86_avx_log.txt echo 'run x86 avx logs: ' > ${run_x86_avx_log_file} - run_x86_java_log_file=${basepath}/run_x86_java_log.txt echo 'run x86 java logs: ' > ${run_x86_java_log_file} -run_x86_codegen_log_file=${basepath}/run_x86_codegen_log.txt -echo 'run x86 codegen logs: ' > ${run_x86_codegen_log_file} - -run_x86_codegen_parallel_log_file=${basepath}/run_x86_codegen_parallel_log.txt -echo 'run x86 codegen parallel logs: ' > ${run_x86_codegen_parallel_log_file} - backend=${backend:-"all"} isFailed=0 @@ -460,20 +383,6 @@ if [[ $backend == "all" || $backend == "x86-all" || $backend == "x86-java" ]]; t Run_x86_java_PID=$! sleep 1 fi -if [[ $backend == "all" || $backend == "x86-all" || $backend == "x86-codegen" ]]; then - # Run on x86-codegen - echo "start Run x86 codegen ..." - Run_x86_codegen & - Run_x86_codegen_PID=$! - sleep 1 -fi -if [[ $backend == "all" || $backend == "x86-all" || $backend == "x86-codegen-parallel" ]]; then - # Run on x86-codegen-parallel - echo "start Run x86 codegen parallel ..." - Run_x86_codegen_parallel & - Run_x86_codegen_parallel_PID=$! - sleep 1 -fi if [[ $backend == "all" || $backend == "x86-all" || $backend == "x86-avx" ]]; then wait ${Run_x86_avx_PID} @@ -516,26 +425,6 @@ if [[ $backend == "all" || $backend == "x86-all" || $backend == "x86-java" ]]; t isFailed=1 fi fi -if [[ $backend == "all" || $backend == "x86-all" || $backend == "x86-codegen" ]]; then - wait ${Run_x86_codegen_PID} - Run_x86_codegen_status=$? - - if [[ ${Run_x86_codegen_status} != 0 ]];then - echo "Run_x86 codegen failed" - cat ${run_x86_codegen_log_file} - isFailed=1 - fi -fi -if [[ $backend == "all" || $backend == "x86-all" || $backend == "x86-codegen" ]]; then - wait ${Run_x86_codegen_parallel_PID} - Run_x86_codegen_parallel_status=$? - - if [[ ${Run_x86_codegen_parallel_status} != 0 ]];then - echo "Run_x86 codegen parallel failed" - cat ${run_x86_codegen_log_file} - isFailed=1 - fi -fi echo "Run_x86 and Run_x86_sse and Run_x86_avx and is ended" Print_Benchmark_Result $run_benchmark_result_file diff --git a/mindspore/lite/test/st/scripts/run_net_train.sh b/mindspore/lite/test/st/scripts/run_net_train.sh index a98cc67e087..00faafcfa3f 100755 --- a/mindspore/lite/test/st/scripts/run_net_train.sh +++ b/mindspore/lite/test/st/scripts/run_net_train.sh @@ -498,21 +498,21 @@ mkdir -p ${benchmark_train_test_path} cp -a ${ms_models_path}/*.ms ${benchmark_train_test_path} || exit 1 isFailed=0 -if [[ $backend == "all" || $backend == "x86-all" || $backend == "x86-train" ]]; then +if [[ $backend == "all" || $backend == "train" || $backend == "x86_train" || $backend == "codegen&train" ]]; then # Run on x86 echo "start Run x86 ..." Run_x86 & Run_x86_PID=$! sleep 1 fi -if [[ $backend == "all" || $backend == "arm64_cpu" || $backend == "arm64_fp32" || $backend == "arm64_train" ]]; then +if [[ $backend == "all" || $backend == "train" || $backend == "arm64_train" || $backend == "codegen&train" ]]; then # Run on arm64 echo "start Run arm64 ..." Run_arm arm64 Run_arm64_status=$? sleep 1 fi -if [[ $backend == "all" || $backend == "arm32_cpu" || $backend == "arm32_fp32" || $backend == "arm32_train" ]]; then +if [[ $backend == "all" || $backend == "train" || $backend == "arm32_train" || $backend == "codegen&train" ]]; then # Run on arm32 echo "start Run arm32 ..." Run_arm arm32 @@ -520,7 +520,7 @@ if [[ $backend == "all" || $backend == "arm32_cpu" || $backend == "arm32_fp32" | sleep 1 fi -if [[ $backend == "all" || $backend == "x86-all" || $backend == "x86-train" ]]; then +if [[ $backend == "all" || $backend == "train" || $backend == "x86_train" || $backend == "codegen&train" ]]; then wait ${Run_x86_PID} Run_x86_status=$? cat ${run_benchmark_train_result_file} @@ -532,14 +532,14 @@ if [[ $backend == "all" || $backend == "x86-all" || $backend == "x86-train" ]]; isFailed=1 fi fi -if [[ $backend == "all" || $backend == "arm64_cpu" || $backend == "arm64_fp32" || $backend == "arm64_train" ]]; then +if [[ $backend == "all" || $backend == "train" || $backend == "arm64_train" || $backend == "codegen&train" ]]; then if [[ ${Run_arm64_status} != 0 ]];then echo "Run_arm64 train failed" cat ${run_arm64_log_file} isFailed=1 fi fi -if [[ $backend == "all" || $backend == "arm32_cpu" || $backend == "arm32_fp32" || $backend == "arm32_train" ]]; then +if [[ $backend == "all" || $backend == "train" || $backend == "arm32_train" || $backend == "codegen&train" ]]; then if [[ ${Run_arm32_status} != 0 ]];then echo "Run_arm32 train failed" cat ${run_arm32_log_file}