|
|
|
@@ -2088,6 +2088,38 @@ 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}-inference-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}-inference-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 < ${codegen_models_tflite_config} |
|
|
|
|
|
|
|
rm -rf ${build_path} |
|
|
|
} |
|
|
|
|
|
|
|
# Print start msg before run testcase |
|
|
|
function MS_PRINT_TESTCASE_START_MSG() { |
|
|
|
echo "" |
|
|
|
@@ -2182,8 +2214,10 @@ models_compatibility_config=${basepath}/models_compatibility.cfg |
|
|
|
models_with_multiple_inputs_config=${basepath}/models_with_multiple_inputs.cfg |
|
|
|
models_for_process_only_config=${basepath}/models_for_process_only.cfg |
|
|
|
models_tf_weightquant_config=${basepath}/models_tf_weightquant.cfg |
|
|
|
codegen_models_tflite_config=${basepath}/codegen/models_tflite.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 |
|
|
|
@@ -2215,7 +2249,7 @@ fi |
|
|
|
# Write benchmark result to temp file |
|
|
|
run_benchmark_result_file=${basepath}/run_benchmark_result.txt |
|
|
|
echo ' ' > ${run_benchmark_result_file} |
|
|
|
|
|
|
|
run_x86_log_file |
|
|
|
run_x86_log_file=${basepath}/run_x86_log.txt |
|
|
|
echo 'run x86 logs: ' > ${run_x86_log_file} |
|
|
|
|
|
|
|
@@ -2228,6 +2262,9 @@ 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_arm64_fp32_log_file=${basepath}/run_arm64_fp32_log.txt |
|
|
|
echo 'run arm64_fp32 logs: ' > ${run_arm64_fp32_log_file} |
|
|
|
|
|
|
|
@@ -2286,6 +2323,14 @@ if [[ $backend == "all" || $backend == "x86-all" || $backend == "x86-java" ]]; t |
|
|
|
sleep 1 |
|
|
|
fi |
|
|
|
|
|
|
|
if [[ $backend == "all" || $backend == "x86-all" || $backend == "x86-codegen" ]]; then |
|
|
|
# Run on x86-java |
|
|
|
echo "start Run x86 codegen ..." |
|
|
|
Run_x86_codegen`` & |
|
|
|
Run_x86_codegen_PID=$! |
|
|
|
sleep 1 |
|
|
|
fi |
|
|
|
|
|
|
|
if [[ $backend == "all" || $backend == "arm_cpu" || $backend == "arm64_fp32" ]]; then |
|
|
|
# Run on arm64 |
|
|
|
arm64_path=${release_path}/android_aarch64 |
|
|
|
@@ -2398,6 +2443,17 @@ if [[ $backend == "all" || $backend == "x86-all" || $backend == "x86-java" ]]; t |
|
|
|
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 == "arm_cpu" || $backend == "arm64_fp32" ]]; then |
|
|
|
if [[ ${Run_arm64_fp32_status} != 0 ]];then |
|
|
|
echo "Run_arm64_fp32 failed" |
|
|
|
|