|
|
|
@@ -1309,7 +1309,7 @@ function Run_arm64_codegen() { |
|
|
|
fi |
|
|
|
|
|
|
|
{ |
|
|
|
echo ${model_name} |
|
|
|
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} |
|
|
|
@@ -1379,6 +1379,94 @@ function Run_arm64_codegen() { |
|
|
|
rm -rf ${build_path} |
|
|
|
} |
|
|
|
|
|
|
|
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}-inference-android-aarch32.tar.gz || exit 1 |
|
|
|
local PKG_PATH=${arm32_path}/mindspore-lite-${version}-inference-android-aarch32 |
|
|
|
local CODEGEN_PATH=${x86_path}/mindspore-lite-${version}-inference-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} |
|
|
|
} |
|
|
|
|
|
|
|
# Run on arm64 platform: |
|
|
|
function Run_arm64() { |
|
|
|
cd ${arm64_path} || exit 1 |
|
|
|
@@ -2633,6 +2721,9 @@ 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_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_fp16_log_file=${basepath}/run_arm64_fp16_log.txt |
|
|
|
echo 'run arm64_fp16 logs: ' > ${run_arm64_fp16_log_file} |
|
|
|
|
|
|
|
@@ -2712,6 +2803,19 @@ if [[ $backend == "all" || $backend == "arm_cpu" || $backend == "arm64_codegen" |
|
|
|
sleep 1 |
|
|
|
fi |
|
|
|
|
|
|
|
if [[ $backend == "all" || $backend == "arm_cpu" || $backend == "arm32_codegen" ]]; then |
|
|
|
# Run on arm32 |
|
|
|
arm32_path=${release_path}/android_aarch32 |
|
|
|
file_name=$(ls ${arm32_path}/*inference-android-aarch32.tar.gz) |
|
|
|
IFS="-" read -r -a file_name_array <<< "$file_name" |
|
|
|
version=${file_name_array[2]} |
|
|
|
|
|
|
|
echo "start Run arm32 codegen ..." |
|
|
|
Run_arm32_codegen |
|
|
|
Run_arm32_codegen_status=$? |
|
|
|
sleep 1 |
|
|
|
fi |
|
|
|
|
|
|
|
if [[ $backend == "all" || $backend == "arm_cpu" || $backend == "arm32_fp16" ]]; then |
|
|
|
# Run on armv82-a32-fp16 |
|
|
|
armv82_path=${release_path}/android_aarch32 |
|
|
|
@@ -2869,8 +2973,15 @@ if [[ $backend == "all" || $backend == "arm_cpu" || $backend == "arm64_fp32" ]]; |
|
|
|
fi |
|
|
|
if [[ $backend == "all" || $backend == "arm_cpu" || $backend == "arm64_codegen" ]]; then |
|
|
|
if [[ ${Run_arm64_codegen_status} != 0 ]];then |
|
|
|
echo "Run_arm64_fp32 failed" |
|
|
|
cat ${run_arm64_fp32_log_file} |
|
|
|
echo "Run_arm64_codegen failed" |
|
|
|
cat ${run_arm64_fp32_codegen_log_file} |
|
|
|
isFailed=1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
if [[ $backend == "all" || $backend == "arm_cpu" || $backend == "arm32_codegen" ]]; then |
|
|
|
if [[ ${Run_arm32_codegen_status} != 0 ]];then |
|
|
|
echo "Run_arm32 codegen failed" |
|
|
|
cat ${run_arm32_fp32_codegen_log_file} |
|
|
|
isFailed=1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
|