You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

run_benchmark_nets.sh 101 kB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450
  1. #!/bin/bash
  2. # Run converter on x86 platform:
  3. function Run_Converter() {
  4. # Unzip x86 runtime and convertor
  5. cd ${x86_path} || exit 1
  6. tar -zxf mindspore-lite-${version}-runtime-x86-${process_unit_x86}.tar.gz || exit 1
  7. tar -zxf mindspore-lite-${version}-runtime-x86-sse-${process_unit_x86}.tar.gz || exit 1
  8. tar -zxf mindspore-lite-${version}-converter-ubuntu.tar.gz || exit 1
  9. cd ${x86_path}/mindspore-lite-${version}-converter-ubuntu || exit 1
  10. cp converter/converter_lite ./ || exit 1
  11. export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:./lib/:./third_party/protobuf/lib:./third_party/flatbuffers/lib:./third_party/glog/lib
  12. # Convert the models
  13. cd ${x86_path}/mindspore-lite-${version}-converter-ubuntu || exit 1
  14. rm -rf ${ms_models_path}
  15. mkdir -p ${ms_models_path}
  16. # Convert tflite models:
  17. while read line; do
  18. model_name=${line}
  19. if [[ $model_name == \#* ]]; then
  20. continue
  21. fi
  22. echo ${model_name} >> "${run_converter_log_file}"
  23. echo './converter_lite --fmk=TFLITE --modelFile='${models_path}'/'${model_name}' --outputFile='${ms_models_path}'/'${model_name}'' >> "${run_converter_log_file}"
  24. ./converter_lite --fmk=TFLITE --modelFile=$models_path/${model_name} --outputFile=${ms_models_path}/${model_name}
  25. if [ $? = 0 ]; then
  26. converter_result='converter tflite '${model_name}' pass';echo ${converter_result} >> ${run_converter_result_file}
  27. else
  28. converter_result='converter tflite '${model_name}' failed';echo ${converter_result} >> ${run_converter_result_file};return 1
  29. fi
  30. done < ${models_tflite_config}
  31. # Convert caffe models:
  32. while read line; do
  33. model_name=${line}
  34. if [[ $model_name == \#* ]]; then
  35. continue
  36. fi
  37. echo ${model_name} >> "${run_converter_log_file}"
  38. echo './converter_lite --fmk=CAFFE --modelFile='${models_path}'/'${model_name}'.prototxt --weightFile='${models_path}'/'${model_name}'.caffemodel --outputFile='${ms_models_path}'/'${model_name}'' >> "${run_converter_log_file}"
  39. ./converter_lite --fmk=CAFFE --modelFile=${models_path}/${model_name}.prototxt --weightFile=${models_path}/${model_name}.caffemodel --outputFile=${ms_models_path}/${model_name}
  40. if [ $? = 0 ]; then
  41. converter_result='converter caffe '${model_name}' pass';echo ${converter_result} >> ${run_converter_result_file}
  42. else
  43. converter_result='converter caffe '${model_name}' failed';echo ${converter_result} >> ${run_converter_result_file};return 1
  44. fi
  45. done < ${models_caffe_config}
  46. # Convert onnx models:
  47. while read line; do
  48. model_name=${line%;*}
  49. if [[ $model_name == \#* ]]; then
  50. continue
  51. fi
  52. echo ${model_name} >> "${run_converter_log_file}"
  53. echo './converter_lite --fmk=ONNX --modelFile='${models_path}'/'${model_name}' --outputFile='${ms_models_path}'/'${model_name}'' >> "${run_converter_log_file}"
  54. ./converter_lite --fmk=ONNX --modelFile=${models_path}/${model_name} --outputFile=${ms_models_path}/${model_name}
  55. if [ $? = 0 ]; then
  56. converter_result='converter onnx '${model_name}' pass';echo ${converter_result} >> ${run_converter_result_file}
  57. else
  58. converter_result='converter onnx '${model_name}' failed';echo ${converter_result} >> ${run_converter_result_file};return 1
  59. fi
  60. done < ${models_onnx_config}
  61. # Convert mindspore models:
  62. while read line; do
  63. mindspore_line_info=${line}
  64. if [[ $mindspore_line_info == \#* ]]; then
  65. continue
  66. fi
  67. model_name=`echo ${mindspore_line_info}|awk -F ' ' '{print $1}'`
  68. accuracy_limit=`echo ${mindspore_line_info}|awk -F ' ' '{print $2}'`
  69. echo ${model_name} >> "${run_converter_log_file}"
  70. echo './converter_lite --fmk=MINDIR --modelFile='${models_path}'/'${model_name}' --outputFile='${ms_models_path}'/'${model_name}'' >> "${run_converter_log_file}"
  71. ./converter_lite --fmk=MINDIR --modelFile=${models_path}/${model_name} --outputFile=${ms_models_path}/${model_name}
  72. if [ $? = 0 ]; then
  73. converter_result='converter mindspore '${model_name}' pass';echo ${converter_result} >> ${run_converter_result_file}
  74. else
  75. converter_result='converter mindspore '${model_name}' failed';echo ${converter_result} >> ${run_converter_result_file};return 1
  76. fi
  77. done < ${models_mindspore_config}
  78. # Convert mindspore train models:
  79. while read line; do
  80. model_name=${line}
  81. if [[ $model_name == \#* ]]; then
  82. continue
  83. fi
  84. echo ${model_name}'_train' >> "${run_converter_log_file}"
  85. echo './converter_lite --fmk=MINDIR --modelFile='${models_path}'/'${model_name}' --outputFile='${ms_models_path}'/'${model_name}'_train --trainModel=true' >> "${run_converter_log_file}"
  86. ./converter_lite --fmk=MINDIR --modelFile=${models_path}/${model_name} --outputFile=${ms_models_path}/${model_name}'_train' --trainModel=true
  87. if [ $? = 0 ]; then
  88. converter_result='converter mindspore '${model_name}'_train pass';echo ${converter_result} >> ${run_converter_result_file}
  89. else
  90. converter_result='converter mindspore '${model_name}'_train failed';echo ${converter_result} >> ${run_converter_result_file};return 1
  91. fi
  92. done < ${models_mindspore_train_config}
  93. # Convert TFLite PostTraining models:
  94. while read line; do
  95. model_name=${line}
  96. if [[ $model_name == \#* ]]; then
  97. continue
  98. fi
  99. echo ${model_name} >> "${run_converter_log_file}"
  100. echo 'convert mode name: '${model_name}' begin.'
  101. echo './converter_lite --fmk=TFLITE --modelFile='${models_path}'/'${model_name}' --outputFile='${ms_models_path}'/'${model_name}_posttraining' --quantType=PostTraining --config_file='${models_path}'/'${model_name}'_posttraining.config' >> "${run_converter_log_file}"
  102. ./converter_lite --fmk=TFLITE --modelFile=$models_path/${model_name} --outputFile=${ms_models_path}/${model_name}_posttraining --quantType=PostTraining --configFile=${models_path}/${model_name}_posttraining.config
  103. if [ $? = 0 ]; then
  104. converter_result='converter post_training '${model_name}' pass';echo ${converter_result} >> ${run_converter_result_file}
  105. else
  106. converter_result='converter post_training '${model_name}' failed';echo ${converter_result} >> ${run_converter_result_file};return 1
  107. fi
  108. done < ${models_tflite_posttraining_config}
  109. # Convert Caffe PostTraining models:
  110. while read line; do
  111. model_name=${line}
  112. if [[ $model_name == \#* ]]; then
  113. continue
  114. fi
  115. echo ${model_name} >> "${run_converter_log_file}"
  116. echo 'convert mode name: '${model_name}' begin.'
  117. echo './converter_lite --fmk=TFLITE --modelFile='${models_path}'/'${model_name}' --outputFile='${ms_models_path}'/'${model_name}_posttraining' --quantType=PostTraining --config_file='${models_path}'/'${model_name}'_posttraining.config' >> "${run_converter_log_file}"
  118. ./converter_lite --fmk=CAFFE --modelFile=$models_path/${model_name}.prototxt --weightFile=$models_path/${model_name}.caffemodel --outputFile=${ms_models_path}/${model_name}_posttraining --quantType=PostTraining --configFile=${models_path}/config.${model_name}
  119. if [ $? = 0 ]; then
  120. converter_result='converter post_training '${model_name}' pass';echo ${converter_result} >> ${run_converter_result_file}
  121. else
  122. converter_result='converter post_training '${model_name}' failed';echo ${converter_result} >> ${run_converter_result_file};return 1
  123. fi
  124. done < ${models_caffe_posttraining_config}
  125. # Convert TFLite AwareTraining models:
  126. while read line; do
  127. model_name=${line}
  128. if [[ $model_name == \#* ]]; then
  129. continue
  130. fi
  131. echo ${model_name} >> "${run_converter_log_file}"
  132. echo './converter_lite --fmk=TFLITE --modelFile='${models_path}'/'${model_name}' --outputFile='${ms_models_path}'/'${model_name}' --inputDataType=FLOAT --outputDataType=FLOAT' >> "${run_converter_log_file}"
  133. ./converter_lite --fmk=TFLITE --modelFile=${models_path}/${model_name} --outputFile=${ms_models_path}/${model_name} --inputDataType=FLOAT --outputDataType=FLOAT
  134. if [ $? = 0 ]; then
  135. converter_result='converter aware_training '${model_name}' pass';echo ${converter_result} >> ${run_converter_result_file}
  136. else
  137. converter_result='converter aware_training '${model_name}' failed';echo ${converter_result} >> ${run_converter_result_file};return 1
  138. fi
  139. done < ${models_tflite_awaretraining_config}
  140. # Copy fp16 ms models:
  141. while read line; do
  142. fp16_line_info=${line}
  143. if [[ $fp16_line_info == \#* ]]; then
  144. continue
  145. fi
  146. model_name=`echo ${fp16_line_info}|awk -F ' ' '{print $1}'`
  147. echo 'cp '${ms_models_path}'/'${model_name}'.ms' ${ms_models_path}'/'${model_name}'.fp16.ms'
  148. cp ${ms_models_path}/${model_name}.ms ${ms_models_path}/${model_name}.fp16.ms
  149. if [ $? = 0 ]; then
  150. converter_result='converter fp16 '${model_name}' pass';echo ${converter_result} >> ${run_converter_result_file}
  151. else
  152. converter_result='converter fp16 '${model_name}' failed';echo ${converter_result} >> ${run_converter_result_file};return 1
  153. fi
  154. done < ${models_fp16_config}
  155. # Convert tflite weightquant models:
  156. while read line; do
  157. model_name=${line}
  158. if [[ $model_name == \#* ]]; then
  159. continue
  160. fi
  161. echo ${model_name} >> "${run_converter_log_file}"
  162. echo './converter_lite --fmk=TFLITE --modelFile='${models_path}'/'${model_name}' --outputFile='${ms_models_path}'/'${model_name}'--quantType=WeightQuant --bitNum=8 --quantWeightSize=500 --quantWeightChannel=16' >> "${run_converter_log_file}"
  163. ./converter_lite --fmk=TFLITE --modelFile=$models_path/${model_name} --outputFile=${ms_models_path}/${model_name}_weightquant --quantType=WeightQuant --bitNum=8 --quantWeightSize=500 --quantWeightChannel=16
  164. if [ $? = 0 ]; then
  165. converter_result='converter weight_quant '${model_name}' pass';echo ${converter_result} >> ${run_converter_result_file}
  166. else
  167. converter_result='converter weight_quant '${model_name}' failed';echo ${converter_result} >> ${run_converter_result_file};return 1
  168. fi
  169. done < ${models_tflite_weightquant_config}
  170. # Convert mindir weightquant models:
  171. while read line; do
  172. model_name=${line}
  173. if [[ $model_name == \#* ]]; then
  174. continue
  175. fi
  176. echo ${model_name} >> "${run_converter_log_file}"
  177. echo './converter_lite --fmk=MINDIR --modelFile='${models_path}'/'${model_name}' --outputFile='${ms_models_path}'/'${model_name}' --quantType=WeightQuant --bitNum=8 --quantWeightSize=500 --quantWeightChannel=16' >> "${run_converter_log_file}"
  178. ./converter_lite --fmk=MINDIR --modelFile=$models_path/${model_name} --outputFile=${ms_models_path}/${model_name}_weightquant --quantType=WeightQuant --bitNum=8 --quantWeightSize=500 --quantWeightChannel=16
  179. if [ $? = 0 ]; then
  180. converter_result='converter weight_quant '${model_name}' pass';echo ${converter_result} >> ${run_converter_result_file}
  181. else
  182. converter_result='converter weight_quant '${model_name}' failed';echo ${converter_result} >> ${run_converter_result_file};return 1
  183. fi
  184. done < ${models_mindspore_weightquant_config}
  185. # Convert mindir mixbit weightquant models:
  186. while read line; do
  187. model_name=${line}
  188. if [[ $model_name == \#* ]]; then
  189. continue
  190. fi
  191. echo ${model_name}'_7bit' >> "${run_converter_log_file}"
  192. echo './converter_lite --fmk=MINDIR --modelFile='${models_path}'/'${model_name}' --outputFile='${ms_models_path}'/'${model_name}'_7bit --quantType=WeightQuant --bitNum=7 --quantWeightSize=500 --quantWeightChannel=16' >> "${run_converter_log_file}"
  193. ./converter_lite --fmk=MINDIR --modelFile=${models_path}/${model_name} --outputFile=${ms_models_path}/${model_name}'_7bit' --quantType=WeightQuant --bitNum=7 --quantWeightSize=500 --quantWeightChannel=16
  194. if [ $? = 0 ]; then
  195. converter_result='converter mindspore '${model_name}'_7bit pass';echo ${converter_result} >> ${run_converter_result_file}
  196. else
  197. converter_result='converter mindspore '${model_name}'_7bit failed';echo ${converter_result} >> ${run_converter_result_file};return 1
  198. fi
  199. echo ${model_name}'_9bit' >> "${run_converter_log_file}"
  200. echo './converter_lite --fmk=MINDIR --modelFile='${models_path}'/'${model_name}' --outputFile='${ms_models_path}'/'${model_name}'_9bit --quantType=WeightQuant --bitNum=9 --quantWeightSize=500 --quantWeightChannel=16' >> "${run_converter_log_file}"
  201. ./converter_lite --fmk=MINDIR --modelFile=${models_path}/${model_name} --outputFile=${ms_models_path}/${model_name}'_9bit' --quantType=WeightQuant --bitNum=9 --quantWeightSize=500 --quantWeightChannel=16
  202. if [ $? = 0 ]; then
  203. converter_result='converter mindspore '${model_name}'_9bit pass';echo ${converter_result} >> ${run_converter_result_file}
  204. else
  205. converter_result='converter mindspore '${model_name}'_9bit failed';echo ${converter_result} >> ${run_converter_result_file};return 1
  206. fi
  207. done < ${models_mindspore_mixbit_config}
  208. # Convert models which has several inputs or does not need to be cared about the accuracy:
  209. while read line; do
  210. if [[ $line == \#* ]]; then
  211. continue
  212. fi
  213. model_name=${line%%;*}
  214. model_type=${model_name##*.}
  215. case $model_type in
  216. tflite)
  217. model_fmk="TFLITE"
  218. ;;
  219. caffemodel)
  220. model_name=${model_name%.*}
  221. model_fmk="CAFFE"
  222. ;;
  223. onnx)
  224. model_fmk="ONNX"
  225. ;;
  226. mindir)
  227. model_fmk="MINDIR"
  228. ;;
  229. esac
  230. echo ${model_name} >> "${run_converter_log_file}"
  231. echo './converter_lite --fmk='${model_fmk}' --modelFile='${models_path}'/'${model_name}' --outputFile='${ms_models_path}'/'${model_name} >> "${run_converter_log_file}"
  232. ./converter_lite --fmk=${model_fmk} --modelFile=${models_path}/${model_name} --outputFile=${ms_models_path}/${model_name}
  233. if [ $? = 0 ]; then
  234. converter_result='converter '${model_type}' '${model_name}' pass';echo ${converter_result} >> ${run_converter_result_file}
  235. else
  236. converter_result='converter '${model_type}' '${model_name}' failed';echo ${converter_result} >> ${run_converter_result_file};return 1
  237. fi
  238. done < ${models_only_for_process_config}
  239. }
  240. # Run on x86 platform:
  241. function Run_x86() {
  242. # Run tflite converted models:
  243. while read line; do
  244. model_name=${line}
  245. if [[ $model_name == \#* ]]; then
  246. continue
  247. fi
  248. echo ${model_name} >> "${run_x86_log_file}"
  249. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-'${process_unit_x86} >> "{run_x86_log_file}"
  250. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-${process_unit_x86} || return 1
  251. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'.ms.out' >> "${run_x86_log_file}"
  252. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}.ms.out >> "${run_x86_log_file}"
  253. if [ $? = 0 ]; then
  254. run_result='x86: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  255. else
  256. run_result='x86: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  257. fi
  258. done < ${models_tflite_config}
  259. # Run caffe converted models:
  260. while read line; do
  261. model_name=${line}
  262. if [[ $model_name == \#* ]]; then
  263. continue
  264. fi
  265. echo ${model_name} >> "${run_x86_log_file}"
  266. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-'${process_unit_x86} >> "${run_x86_log_file}"
  267. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-${process_unit_x86} || return 1
  268. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'.ms.out' >> "${run_x86_log_file}"
  269. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}.ms.out >> "${run_x86_log_file}"
  270. if [ $? = 0 ]; then
  271. run_result='x86: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  272. else
  273. run_result='x86: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  274. fi
  275. done < ${models_caffe_config}
  276. # Run onnx converted models:
  277. while read line; do
  278. model_name=${line%;*}
  279. length=${#model_name}
  280. input_shapes=${line:length+1}
  281. if [[ $model_name == \#* ]]; then
  282. continue
  283. fi
  284. echo ${model_name} >> "${run_x86_log_file}"
  285. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-'${process_unit_x86} >> "${run_x86_log_file}"
  286. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-${process_unit_x86} || return 1
  287. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --inputShapes='${input_shapes}' --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'.ms.out' >> "${run_x86_log_file}"
  288. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --inputShapes=${input_shapes} --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}.ms.out >> "${run_x86_log_file}"
  289. if [ $? = 0 ]; then
  290. run_result='x86: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  291. else
  292. run_result='x86: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  293. fi
  294. done < ${models_onnx_config}
  295. # Run tflite post training quantization converted models:
  296. while read line; do
  297. model_name=${line}
  298. if [[ $model_name == \#* ]]; then
  299. continue
  300. fi
  301. echo ${model_name} >> "${run_x86_log_file}"
  302. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-'${process_unit_x86} >> "${run_x86_log_file}"
  303. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-${process_unit_x86} || return 1
  304. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'_posttraining.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/quantTraining/mnist_calibration_data/00099.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'_posttraining.ms.out' >> "${run_x86_log_file}"
  305. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}_posttraining.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/quantTraining/mnist_calibration_data/00099.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}_posttraining.ms.out >> "${run_x86_log_file}"
  306. if [ $? = 0 ]; then
  307. run_result='x86: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  308. else
  309. run_result='x86: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  310. fi
  311. done < ${models_tflite_posttraining_config}
  312. # Run caffe post training quantization converted models:
  313. while read line; do
  314. model_name=${line}
  315. if [[ $model_name == \#* ]]; then
  316. continue
  317. fi
  318. echo ${model_name} >> "${run_x86_log_file}"
  319. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-'${process_unit_x86} >> "${run_x86_log_file}"
  320. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-${process_unit_x86} || return 1
  321. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'_posttraining.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/quantTraining/ml_face_mnet_calibration_data/20_Family_Group_Family_Group_20_1001.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'_posttraining.ms.out' --accuracyThreshold=105 >> "${run_x86_log_file}"
  322. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}_posttraining.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/quantTraining/ml_face_mnet_calibration_data/20_Family_Group_Family_Group_20_1001.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}_posttraining.ms.out --accuracyThreshold=105 >> "${run_x86_log_file}"
  323. if [ $? = 0 ]; then
  324. run_result='x86: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  325. else
  326. run_result='x86: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  327. fi
  328. done < ${models_caffe_posttraining_config}
  329. # Run tflite aware training quantization converted models:
  330. while read line; do
  331. model_name=${line}
  332. if [[ $model_name == \#* ]]; then
  333. continue
  334. fi
  335. echo ${model_name} >> "${run_x86_log_file}"
  336. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-'${process_unit_x86} >> "${run_x86_log_file}"
  337. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-${process_unit_x86} || return 1
  338. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'.ms.out' >> "${run_x86_log_file}"
  339. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}.ms.out >> "${run_x86_log_file}"
  340. if [ $? = 0 ]; then
  341. run_result='x86: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  342. else
  343. run_result='x86: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  344. fi
  345. done < ${models_tflite_awaretraining_config}
  346. # Run mindspore converted train models:
  347. while read line; do
  348. model_name=${line}
  349. if [[ $model_name == \#* ]]; then
  350. continue
  351. fi
  352. echo ${model_name}'_train' >> "${run_x86_log_file}"
  353. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-'${process_unit_x86} >> "${run_x86_log_file}"
  354. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-${process_unit_x86} || return 1
  355. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'_train.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'.train.ms.out' >> "${run_x86_log_file}"
  356. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}'_train'.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}.train.ms.out --accuracyThreshold=1.5 >> "${run_x86_log_file}"
  357. if [ $? = 0 ]; then
  358. run_result='x86: '${model_name}'_train pass'; echo ${run_result} >> ${run_benchmark_result_file}
  359. else
  360. run_result='x86: '${model_name}'_train failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  361. fi
  362. done < ${models_mindspore_train_config}
  363. # Run mindspore converted models:
  364. while read line; do
  365. mindspore_line_info=${line}
  366. if [[ $mindspore_line_info == \#* ]]; then
  367. continue
  368. fi
  369. model_name=`echo ${mindspore_line_info}|awk -F ' ' '{print $1}'`
  370. accuracy_limit=`echo ${mindspore_line_info}|awk -F ' ' '{print $2}'`
  371. echo "---------------------------------------------------------" >> "${run_x86_log_file}"
  372. echo "mindspore run: ${model_name}, accuracy limit:${accuracy_limit}" >> "${run_x86_log_file}"
  373. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-'${process_unit_x86} >> "${run_x86_log_file}"
  374. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-${process_unit_x86} || return 1
  375. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'.ms.out' >> "${run_x86_log_file}"
  376. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}.ms.out --accuracyThreshold=${accuracy_limit} >> "${run_x86_log_file}"
  377. if [ $? = 0 ]; then
  378. run_result='x86: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  379. else
  380. run_result='x86: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  381. fi
  382. done < ${models_mindspore_config}
  383. # Run tflite weight quantization converted models:
  384. while read line; do
  385. model_name=${line}
  386. if [[ $model_name == \#* ]]; then
  387. continue
  388. fi
  389. echo ${model_name} >> "${run_x86_log_file}"
  390. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-'${process_unit_x86} >> "${run_x86_log_file}"
  391. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-${process_unit_x86} || return 1
  392. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'.ms.out' >> "${run_x86_log_file}"
  393. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}_weightquant.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}.ms.out >> "${run_x86_log_file}"
  394. if [ $? = 0 ]; then
  395. run_result='x86: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  396. else
  397. run_result='x86: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  398. fi
  399. done < ${models_tflite_weightquant_config}
  400. # Run mindir weight quantization converted models:
  401. while read line; do
  402. model_name=${line}
  403. if [[ $model_name == \#* ]]; then
  404. continue
  405. fi
  406. echo ${model_name} >> "${run_x86_log_file}"
  407. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-'${process_unit_x86} >> "${run_x86_log_file}"
  408. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-${process_unit_x86} || return 1
  409. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'.ms.out' >> "${run_x86_log_file}"
  410. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}_weightquant.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}.weightquant.ms.out >> "${run_x86_log_file}"
  411. if [ $? = 0 ]; then
  412. run_result='x86: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  413. else
  414. run_result='x86: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  415. fi
  416. done < ${models_mindspore_weightquant_config}
  417. # Run mindir mixbit weight quantization converted models:
  418. while read line; do
  419. model_name=${line}
  420. if [[ $model_name == \#* ]]; then
  421. continue
  422. fi
  423. echo ${model_name} >> "${run_x86_log_file}"
  424. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-'${process_unit_x86} >> "${run_x86_log_file}"
  425. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-${process_unit_x86} || return 1
  426. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'_7bit.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'_7bit.ms.out' >> "${run_x86_log_file}"
  427. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}_7bit.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}_7bit.ms.out >> "${run_x86_log_file}"
  428. if [ $? = 0 ]; then
  429. run_result='x86: '${model_name}'_7bit pass'; echo ${run_result} >> ${run_benchmark_result_file}
  430. else
  431. run_result='x86: '${model_name}'_7bit failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  432. fi
  433. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'_9bit.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'_9bit.ms.out' >> "${run_x86_log_file}"
  434. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}_9bit.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}_9bit.ms.out >> "${run_x86_log_file}"
  435. if [ $? = 0 ]; then
  436. run_result='x86: '${model_name}'_9bit pass'; echo ${run_result} >> ${run_benchmark_result_file}
  437. else
  438. run_result='x86: '${model_name}'_9bit failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  439. fi
  440. done < ${models_mindspore_mixbit_config}
  441. # Run converted models which has several inputs or does not need to be cared about the accuracy:
  442. while read line; do
  443. if [[ $line == \#* ]]; then
  444. continue
  445. fi
  446. model_name=${line%%;*}
  447. model_name_len=${#model_name}
  448. input_params=${line:model_name_len+1}
  449. input_num=${input_params%%;*}
  450. input_shape=${input_params##*;}
  451. input_files=''
  452. output_file=''
  453. if [[ -z "$input_files" || $input_files == 1 ]] && [ -e ${ms_models_path}/${model_name}'.ms.bin' ]; then
  454. input_files=$model_name'.ms.bin'
  455. elif [[ ! -z "$input_files" && $input_files > 1 ]]; then
  456. for i in $(seq 1 $input_num)
  457. do
  458. input_files=$input_files$model_name'.ms.bin_'$i','
  459. done
  460. fi
  461. if [ -e ${ms_models_path}/${model_name}'.ms.out' ]; then
  462. output_file=${ms_models_path}/${model_name}'.ms.out'
  463. fi
  464. if [[ ${model_name##*.} == "caffemodel" ]]; then
  465. model_name=${model_name%.*}
  466. fi
  467. echo ${model_name} >> "${run_x86_log_file}"
  468. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-'${process_unit_x86} >> "{run_x86_log_file}"
  469. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-${process_unit_x86} || return 1
  470. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'.ms --inDataFile='${input_files}' --benchmarkDataFile='${output_file}' --loopCount=1 --warmUpLoopCount=0' >> "${run_x86_log_file}"
  471. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}.ms --inDataFile=${input_files} --benchmarkDataFile=${output_file} --loopCount=1 --warmUpLoopCount=0 >> "${run_x86_log_file}"
  472. if [ $? = 0 ]; then
  473. run_result='x86: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  474. else
  475. run_result='x86: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  476. fi
  477. done < ${models_only_for_process_config}
  478. }
  479. # Run on x86 sse platform:
  480. function Run_x86_sse() {
  481. # Run tflite converted models:
  482. while read line; do
  483. model_name=${line}
  484. if [[ $model_name == \#* ]]; then
  485. continue
  486. fi
  487. echo ${model_name} >> "${run_x86_sse_log_file}"
  488. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-sse-'${process_unit_x86} >> "{run_x86_sse_log_file}"
  489. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-sse-${process_unit_x86} || return 1
  490. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'.ms.out' >> "${run_x86_sse_log_file}"
  491. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}.ms.out >> "${run_x86_sse_log_file}"
  492. if [ $? = 0 ]; then
  493. run_result='x86_sse: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  494. else
  495. run_result='x86_sse: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  496. fi
  497. done < ${models_tflite_config}
  498. # Run caffe converted models:
  499. while read line; do
  500. model_name=${line}
  501. if [[ $model_name == \#* ]]; then
  502. continue
  503. fi
  504. echo ${model_name} >> "${run_x86_sse_log_file}"
  505. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-sse-'${process_unit_x86} >> "${run_x86_sse_log_file}"
  506. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-sse-${process_unit_x86} || return 1
  507. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'.ms.out' >> "${run_x86_sse_log_file}"
  508. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}.ms.out >> "${run_x86_sse_log_file}"
  509. if [ $? = 0 ]; then
  510. run_result='x86_sse: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  511. else
  512. run_result='x86_sse: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  513. fi
  514. done < ${models_caffe_config}
  515. # Run onnx converted models:
  516. while read line; do
  517. model_name=${line%;*}
  518. length=${#model_name}
  519. input_shapes=${line:length+1}
  520. if [[ $model_name == \#* ]]; then
  521. continue
  522. fi
  523. echo ${model_name} >> "${run_x86_sse_log_file}"
  524. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-sse-'${process_unit_x86} >> "${run_x86_sse_log_file}"
  525. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-sse-${process_unit_x86} || return 1
  526. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --inputShapes='${input_shapes}' --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'.ms.out' >> "${run_x86_sse_log_file}"
  527. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --inputShapes=${input_shapes} --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}.ms.out >> "${run_x86_sse_log_file}"
  528. if [ $? = 0 ]; then
  529. run_result='x86_sse: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  530. else
  531. run_result='x86_sse: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  532. fi
  533. done < ${models_onnx_config}
  534. # Run tflite post training quantization converted models:
  535. while read line; do
  536. model_name=${line}
  537. if [[ $model_name == \#* ]]; then
  538. continue
  539. fi
  540. echo ${model_name} >> "${run_x86_sse_log_file}"
  541. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-sse-'${process_unit_x86} >> "${run_x86_sse_log_file}"
  542. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-sse-${process_unit_x86} || return 1
  543. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'_posttraining.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/quantTraining/mnist_calibration_data/00099.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'_posttraining.ms.out' >> "${run_x86_sse_log_file}"
  544. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}_posttraining.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/quantTraining/mnist_calibration_data/00099.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}_posttraining.ms.out >> "${run_x86_sse_log_file}"
  545. if [ $? = 0 ]; then
  546. run_result='x86_sse: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  547. else
  548. run_result='x86_sse: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  549. fi
  550. done < ${models_tflite_posttraining_config}
  551. # Run caffe post training quantization converted models:
  552. while read line; do
  553. model_name=${line}
  554. if [[ $model_name == \#* ]]; then
  555. continue
  556. fi
  557. echo ${model_name} >> "${run_x86_sse_log_file}"
  558. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-sse-'${process_unit_x86} >> "${run_x86_sse_log_file}"
  559. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-sse-${process_unit_x86} || return 1
  560. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'_posttraining.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/quantTraining/ml_face_mnet_calibration_data/20_Family_Group_Family_Group_20_1001.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'_posttraining.ms.out' --accuracyThreshold=105 >> "${run_x86_sse_log_file}"
  561. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}_posttraining.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/quantTraining/ml_face_mnet_calibration_data/20_Family_Group_Family_Group_20_1001.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}_posttraining.ms.out --accuracyThreshold=105 >> "${run_x86_sse_log_file}"
  562. if [ $? = 0 ]; then
  563. run_result='x86_sse: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  564. else
  565. run_result='x86_sse: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  566. fi
  567. done < ${models_caffe_posttraining_config}
  568. # Run tflite aware training quantization converted models:
  569. while read line; do
  570. model_name=${line}
  571. if [[ $model_name == \#* ]]; then
  572. continue
  573. fi
  574. echo ${model_name} >> "${run_x86_sse_log_file}"
  575. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-sse-'${process_unit_x86} >> "${run_x86_sse_log_file}"
  576. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-sse-${process_unit_x86} || return 1
  577. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'.ms.out' >> "${run_x86_sse_log_file}"
  578. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}.ms.out >> "${run_x86_sse_log_file}"
  579. if [ $? = 0 ]; then
  580. run_result='x86_sse: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  581. else
  582. run_result='x86_sse: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  583. fi
  584. done < ${models_tflite_awaretraining_config}
  585. # Run mindspore converted train models:
  586. while read line; do
  587. model_name=${line}
  588. if [[ $model_name == \#* ]]; then
  589. continue
  590. fi
  591. echo ${model_name}'_train' >> "${run_x86_sse_log_file}"
  592. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-sse-'${process_unit_x86} >> "${run_x86_sse_log_file}"
  593. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-sse-${process_unit_x86} || return 1
  594. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'_train.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'.train.ms.out' >> "${run_x86_sse_log_file}"
  595. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}'_train'.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}.train.ms.out --accuracyThreshold=1.5 >> "${run_x86_sse_log_file}"
  596. if [ $? = 0 ]; then
  597. run_result='x86_sse: '${model_name}'_train pass'; echo ${run_result} >> ${run_benchmark_result_file}
  598. else
  599. run_result='x86_sse: '${model_name}'_train failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  600. fi
  601. done < ${models_mindspore_train_config}
  602. # Run mindspore converted models:
  603. while read line; do
  604. mindspore_line_info=${line}
  605. if [[ $mindspore_line_info == \#* ]]; then
  606. continue
  607. fi
  608. model_name=`echo ${mindspore_line_info}|awk -F ' ' '{print $1}'`
  609. accuracy_limit=`echo ${mindspore_line_info}|awk -F ' ' '{print $2}'`
  610. echo "---------------------------------------------------------" >> "${run_x86_sse_log_file}"
  611. echo "mindspore run: ${model_name}, accuracy limit:${accuracy_limit}" >> "${run_x86_sse_log_file}"
  612. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-sse-'${process_unit_x86} >> "${run_x86_sse_log_file}"
  613. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-sse-${process_unit_x86} || return 1
  614. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'.ms.out' >> "${run_x86_sse_log_file}"
  615. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}.ms.out --accuracyThreshold=${accuracy_limit} >> "${run_x86_sse_log_file}"
  616. if [ $? = 0 ]; then
  617. run_result='x86_sse: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  618. else
  619. run_result='x86_sse: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  620. fi
  621. done < ${models_mindspore_config}
  622. # Run tflite weight quantization converted models:
  623. while read line; do
  624. model_name=${line}
  625. if [[ $model_name == \#* ]]; then
  626. continue
  627. fi
  628. echo ${model_name} >> "${run_x86_sse_log_file}"
  629. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-sse-'${process_unit_x86} >> "${run_x86_sse_log_file}"
  630. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-sse-${process_unit_x86} || return 1
  631. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'.ms.out' >> "${run_x86_sse_log_file}"
  632. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}_weightquant.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}.ms.out >> "${run_x86_sse_log_file}"
  633. if [ $? = 0 ]; then
  634. run_result='x86_sse: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  635. else
  636. run_result='x86_sse: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  637. fi
  638. done < ${models_tflite_weightquant_config}
  639. # Run mindir weight quantization converted models:
  640. while read line; do
  641. model_name=${line}
  642. if [[ $model_name == \#* ]]; then
  643. continue
  644. fi
  645. echo ${model_name} >> "${run_x86_sse_log_file}"
  646. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-sse-'${process_unit_x86} >> "${run_x86_sse_log_file}"
  647. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-sse-${process_unit_x86} || return 1
  648. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'.ms.out' >> "${run_x86_sse_log_file}"
  649. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}_weightquant.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}.weightquant.ms.out >> "${run_x86_sse_log_file}"
  650. if [ $? = 0 ]; then
  651. run_result='x86_sse: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  652. else
  653. run_result='x86_sse: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  654. fi
  655. done < ${models_mindspore_weightquant_config}
  656. # Run mindir mixbit weight quantization converted models:
  657. while read line; do
  658. model_name=${line}
  659. if [[ $model_name == \#* ]]; then
  660. continue
  661. fi
  662. echo ${model_name} >> "${run_x86_sse_log_file}"
  663. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-sse-'${process_unit_x86} >> "${run_x86_sse_log_file}"
  664. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-sse-${process_unit_x86} || return 1
  665. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'_7bit.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'_7bit.ms.out' >> "${run_x86_sse_log_file}"
  666. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}_7bit.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}_7bit.ms.out >> "${run_x86_sse_log_file}"
  667. if [ $? = 0 ]; then
  668. run_result='x86_sse: '${model_name}'_7bit pass'; echo ${run_result} >> ${run_benchmark_result_file}
  669. else
  670. run_result='x86_sse: '${model_name}'_7bit failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  671. fi
  672. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'_9bit.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'${model_name}'_9bit.ms.out' >> "${run_x86_sse_log_file}"
  673. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}_9bit.ms --inDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --benchmarkDataFile=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/${model_name}_9bit.ms.out >> "${run_x86_sse_log_file}"
  674. if [ $? = 0 ]; then
  675. run_result='x86_sse: '${model_name}'_9bit pass'; echo ${run_result} >> ${run_benchmark_result_file}
  676. else
  677. run_result='x86_sse: '${model_name}'_9bit failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  678. fi
  679. done < ${models_mindspore_mixbit_config}
  680. # Run converted models which has several inputs or does not need to be cared about the accuracy:
  681. while read line; do
  682. model_name=${line%%;*}
  683. model_name_len=${#model_name}
  684. input_params=${line:model_name_len+1}
  685. input_num=${input_params%%;*}
  686. input_shape=${input_params##*;}
  687. input_files=''
  688. output_file=''
  689. if [[ -z "$input_files" || $input_files == 1 ]] && [ -e ${ms_models_path}/${model_name}'.ms.bin' ]; then
  690. input_files=$model_name'.ms.bin'
  691. elif [[ ! -z "$input_files" && $input_files > 1 ]]; then
  692. for i in $(seq 1 $input_num)
  693. do
  694. input_files=$input_files$model_name'.ms.bin_'$i','
  695. done
  696. fi
  697. if [ -e ${ms_models_path}/${model_name}'.ms.out' ]; then
  698. output_file=${ms_models_path}/${model_name}'.ms.out'
  699. fi
  700. if [[ ${model_name##*.} == "caffemodel" ]]; then
  701. model_name=${model_name%.*}
  702. fi
  703. echo ${model_name} >> "${run_x86_sse_log_file}"
  704. echo 'cd '${x86_path}'/mindspore-lite-'${version}'-runtime-x86-sse-'${process_unit_x86} >> "{run_x86_sse_log_file}"
  705. cd ${x86_path}/mindspore-lite-${version}-runtime-x86-sse-${process_unit_x86} || return 1
  706. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile='${ms_models_path}'/'${model_name}'.ms --inDataFile='${input_files}' --benchmarkDataFile='${output_file}' --loopCount=1 --warmUpLoopCount=0' >> "${run_x86_sse_log_file}"
  707. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark/benchmark --modelFile=${ms_models_path}/${model_name}.ms --inDataFile=${input_files} --benchmarkDataFile=${output_file} --loopCount=1 --warmUpLoopCount=0 >> "${run_x86_sse_log_file}"
  708. if [ $? = 0 ]; then
  709. run_result='x86_sse: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  710. else
  711. run_result='x86_sse: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  712. fi
  713. done < ${models_only_for_process_config}
  714. }
  715. # Run on arm64 platform:
  716. function Run_arm64() {
  717. # Unzip arm64
  718. cd ${arm64_path} || exit 1
  719. tar -zxf mindspore-lite-${version}-runtime-arm64-${process_unit_arm64}.tar.gz || exit 1
  720. # If build with minddata, copy the minddata related libs
  721. cd ${benchmark_test_path} || exit 1
  722. if [ -f ${arm64_path}/mindspore-lite-${version}-runtime-arm64-${process_unit_arm64}/lib/libminddata-lite.so ]; then
  723. cp -a ${arm64_path}/mindspore-lite-${version}-runtime-arm64-${process_unit_arm64}/third_party/libjpeg-turbo/lib/libjpeg.so ${benchmark_test_path}/libjpeg.so || exit 1
  724. cp -a ${arm64_path}/mindspore-lite-${version}-runtime-arm64-${process_unit_arm64}/third_party/libjpeg-turbo/lib/libturbojpeg.so ${benchmark_test_path}/libturbojpeg.so || exit 1
  725. cp -a ${arm64_path}/mindspore-lite-${version}-runtime-arm64-${process_unit_arm64}/third_party/opencv/lib/libopencv_core.so ${benchmark_test_path}/libopencv_core.so || exit 1
  726. cp -a ${arm64_path}/mindspore-lite-${version}-runtime-arm64-${process_unit_arm64}/third_party/opencv/lib/libopencv_imgcodecs.so ${benchmark_test_path}/libopencv_imgcodecs.so || exit 1
  727. cp -a ${arm64_path}/mindspore-lite-${version}-runtime-arm64-${process_unit_arm64}/third_party/opencv/lib/libopencv_imgproc.so ${benchmark_test_path}/libopencv_imgproc.so || exit 1
  728. cp -a ${arm64_path}/mindspore-lite-${version}-runtime-arm64-${process_unit_arm64}/lib/libminddata-lite.so ${benchmark_test_path}/libminddata-lite.so || exit 1
  729. fi
  730. cp -a ${arm64_path}/mindspore-lite-${version}-runtime-arm64-${process_unit_arm64}/lib/libmindspore-lite.so ${benchmark_test_path}/libmindspore-lite.so || exit 1
  731. cp -a ${arm64_path}/mindspore-lite-${version}-runtime-arm64-${process_unit_arm64}/benchmark/benchmark ${benchmark_test_path}/benchmark || exit 1
  732. # adb push all needed files to the phone
  733. adb -s ${device_id} push ${benchmark_test_path} /data/local/tmp/ > adb_push_log.txt
  734. # run adb ,run session ,check the result:
  735. echo 'cd /data/local/tmp/benchmark_test' > adb_cmd.txt
  736. echo 'cp /data/local/tmp/libc++_shared.so ./' >> adb_cmd.txt
  737. echo 'chmod 777 benchmark' >> adb_cmd.txt
  738. adb -s ${device_id} shell < adb_cmd.txt
  739. # Run compatibility test models:
  740. while read line; do
  741. model_name=${line}
  742. if [[ $model_name == \#* ]]; then
  743. continue
  744. fi
  745. echo ${model_name} >> "${run_arm64_log_file}"
  746. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  747. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms' >> "${run_arm64_log_file}"
  748. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms' >> adb_run_cmd.txt
  749. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  750. if [ $? = 0 ]; then
  751. run_result='arm64: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  752. else
  753. run_result='arm64: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  754. fi
  755. # run benchmark test without clib data
  756. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  757. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --warmUpLoopCount=1 --loopCount=2' >> "${run_arm64_log_file}"
  758. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --warmUpLoopCount=1 --loopCount=2' >> adb_run_cmd.txt
  759. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  760. if [ $? = 0 ]; then
  761. run_result='arm64: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  762. else
  763. run_result='arm64: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  764. fi
  765. done < ${models_compatibility_config}
  766. # Run tflite converted models:
  767. while read line; do
  768. model_name=${line}
  769. if [[ $model_name == \#* ]]; then
  770. continue
  771. fi
  772. echo ${model_name} >> "${run_arm64_log_file}"
  773. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  774. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out' >> "${run_arm64_log_file}"
  775. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out' >> adb_run_cmd.txt
  776. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  777. if [ $? = 0 ]; then
  778. run_result='arm64: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  779. else
  780. run_result='arm64: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  781. fi
  782. # run benchmark test without clib data
  783. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  784. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --warmUpLoopCount=1 --loopCount=2' >> "${run_arm64_log_file}"
  785. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --warmUpLoopCount=1 --loopCount=2' >> adb_run_cmd.txt
  786. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  787. if [ $? = 0 ]; then
  788. run_result='arm64: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  789. else
  790. run_result='arm64: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  791. fi
  792. done < ${models_tflite_config}
  793. # Run caffe converted models:
  794. while read line; do
  795. model_name=${line}
  796. if [[ $model_name == \#* ]]; then
  797. continue
  798. fi
  799. echo ${model_name} >> "${run_arm64_log_file}"
  800. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  801. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out' >> "${run_arm64_log_file}"
  802. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out' >> adb_run_cmd.txt
  803. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  804. if [ $? = 0 ]; then
  805. run_result='arm64: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  806. else
  807. run_result='arm64: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  808. fi
  809. # run benchmark test without clib data
  810. echo ${model_name} >> "${run_arm64_log_file}"
  811. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  812. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --warmUpLoopCount=1 --loopCount=2' >> "${run_arm64_log_file}"
  813. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --warmUpLoopCount=1 --loopCount=2' >> adb_run_cmd.txt
  814. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  815. if [ $? = 0 ]; then
  816. run_result='arm64: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  817. else
  818. run_result='arm64: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  819. fi
  820. done < ${models_caffe_config}
  821. # Run caffe posttraing models:
  822. while read line; do
  823. model_name=${line}
  824. if [[ $model_name == \#* ]]; then
  825. continue
  826. fi
  827. echo ${model_name} >> "${run_arm64_log_file}"
  828. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  829. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'_posttraining.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'_posttraining.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'_posttraining.ms.out' --accuracyThreshold=146 >> "${run_arm64_log_file}"
  830. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'_posttraining.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'_posttraining.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'_posttraining.ms.out' --accuracyThreshold=146 >> adb_run_cmd.txt
  831. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  832. if [ $? = 0 ]; then
  833. run_result='arm64: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  834. else
  835. run_result='arm64: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  836. fi
  837. # run benchmark test without clib data
  838. echo ${model_name} >> "${run_arm64_log_file}"
  839. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  840. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'_posttraining.ms --warmUpLoopCount=1 --loopCount=2' >> "${run_arm64_log_file}"
  841. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'_posttraining.ms --warmUpLoopCount=1 --loopCount=2' >> adb_run_cmd.txt
  842. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  843. if [ $? = 0 ]; then
  844. run_result='arm64: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  845. else
  846. run_result='arm64: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  847. fi
  848. done < ${models_caffe_posttraining_config}
  849. # Run onnx converted models:
  850. while read line; do
  851. model_name=${line%;*}
  852. length=${#model_name}
  853. input_shapes=${line:length+1}
  854. if [[ $model_name == \#* ]]; then
  855. continue
  856. fi
  857. echo ${model_name} >> "${run_arm64_log_file}"
  858. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  859. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --inputShapes='${input_shapes}' --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out' >> "${run_arm64_log_file}"
  860. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --inputShapes='${input_shapes}' --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out' >> adb_run_cmd.txt
  861. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  862. if [ $? = 0 ]; then
  863. run_result='arm64: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  864. else
  865. run_result='arm64: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  866. fi
  867. # run benchmark test without clib data
  868. echo ${model_name} >> "${run_arm64_log_file}"
  869. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  870. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --inputShapes='${input_shapes}' --warmUpLoopCount=1 --loopCount=2' >> "{run_arm64_log_file}"
  871. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --inputShapes='${input_shapes}' --warmUpLoopCount=1 --loopCount=2' >> adb_run_cmd.txt
  872. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  873. if [ $? = 0 ]; then
  874. run_result='arm64: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  875. else
  876. run_result='arm64: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  877. fi
  878. done < ${models_onnx_config}
  879. # Run fp16 converted models:
  880. while read line; do
  881. fp16_line_info=${line}
  882. if [[ $fp16_line_info == \#* ]]; then
  883. continue
  884. fi
  885. model_name=`echo ${fp16_line_info}|awk -F ' ' '{print $1}'`
  886. accuracy_limit=`echo ${fp16_line_info}|awk -F ' ' '{print $2}'`
  887. echo "---------------------------------------------------------" >> "${run_arm64_log_file}"
  888. echo "fp16 run: ${model_name}, accuracy limit:${accuracy_limit}" >> "${run_arm64_log_file}"
  889. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  890. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test' >> adb_run_cmd.txt
  891. echo './benchmark --modelFile='${model_name}'.fp16.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out --enableFp16=true --accuracyThreshold='${accuracy_limit} >> adb_run_cmd.txt
  892. cat adb_run_cmd.txt >> "${run_arm64_log_file}"
  893. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  894. if [ $? = 0 ]; then
  895. run_result='arm64_fp16: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  896. else
  897. run_result='arm64_fp16: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  898. fi
  899. # run benchmark test without clib data
  900. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  901. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test' >> adb_run_cmd.txt
  902. echo './benchmark --modelFile='${model_name}'.fp16.ms --warmUpLoopCount=1 --loopCount=2 --enableFp16=true' >> adb_run_cmd.txt
  903. cat adb_run_cmd.txt >> "${run_arm64_log_file}"
  904. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  905. if [ $? = 0 ]; then
  906. run_result='arm64_fp16: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  907. else
  908. run_result='arm64_fp16: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  909. fi
  910. done < ${models_fp16_config}
  911. # Run tflite aware training quantization converted models:
  912. while read line; do
  913. model_name=${line}
  914. if [[ $model_name == \#* ]]; then
  915. continue
  916. fi
  917. echo ${model_name} >> "${run_arm64_log_file}"
  918. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  919. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out' >> "${run_arm64_log_file}"
  920. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out' >> adb_run_cmd.txt
  921. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  922. if [ $? = 0 ]; then
  923. run_result='arm64: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  924. else
  925. run_result='arm64: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  926. fi
  927. # run benchmark test without clib data
  928. echo ${model_name} >> "${run_arm64_log_file}"
  929. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  930. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --warmUpLoopCount=1 --loopCount=2' >> "${run_arm64_log_file}"
  931. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --warmUpLoopCount=1 --loopCount=2' >> adb_run_cmd.txt
  932. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  933. if [ $? = 0 ]; then
  934. run_result='arm64_awq: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  935. else
  936. run_result='arm64_awq: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  937. fi
  938. done < ${models_tflite_awaretraining_config}
  939. # Run gpu tflite converted models:
  940. while read line; do
  941. model_name=${line}
  942. if [[ $model_name == \#* ]]; then
  943. continue
  944. fi
  945. echo ${model_name} >> "${run_arm64_log_file}"
  946. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  947. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --device=GPU --modelFile='${model_name}'.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out' >> "${run_arm64_log_file}"
  948. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --device=GPU --modelFile='${model_name}'.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out' >> adb_run_cmd.txt
  949. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  950. if [ $? = 0 ]; then
  951. run_result='arm64_gpu: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  952. else
  953. run_result='arm64_gpu: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  954. fi
  955. # run benchmark test without clib data
  956. #echo ${model_name}
  957. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  958. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --device=GPU --modelFile='${model_name}'.ms --warmUpLoopCount=1 --loopCount=2' >> "${run_arm64_log_file}"
  959. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --device=GPU --modelFile='${model_name}'.ms --warmUpLoopCount=1 --loopCount=2' >> adb_run_cmd.txt
  960. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  961. if [ $? = 0 ]; then
  962. run_result='arm64_gpu: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  963. else
  964. run_result='arm64_gpu: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  965. fi
  966. done < ${models_tflite_gpu_config}
  967. # Run GPU fp16 converted models:
  968. while read line; do
  969. model_name=${line}
  970. if [[ $model_name == \#* ]]; then
  971. continue
  972. fi
  973. echo ${model_name} >> "${run_arm64_log_file}"
  974. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  975. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --device=GPU --modelFile='${model_name}'.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out --enableFp16=true --accuracyThreshold=5' >> "${run_arm64_log_file}"
  976. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --device=GPU --modelFile='${model_name}'.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out --enableFp16=true --accuracyThreshold=5' >> adb_run_cmd.txt
  977. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  978. if [ $? = 0 ]; then
  979. run_result='arm64_gpu_fp16: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  980. else
  981. run_result='arm64_gpu_fp16: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  982. fi
  983. # run benchmark test without clib data
  984. echo ${model_name} >> "${run_arm64_log_file}"
  985. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  986. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --device=GPU --modelFile='${model_name}'.ms --warmUpLoopCount=1 --loopCount=2 --enableFp16=true' >> "${run_arm64_log_file}"
  987. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --device=GPU --modelFile='${model_name}'.ms --warmUpLoopCount=1 --loopCount=2 --enableFp16=true' >> adb_run_cmd.txt
  988. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  989. if [ $? = 0 ]; then
  990. run_result='arm64_gpu_fp16: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  991. else
  992. run_result='arm64_gpu_fp16: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  993. fi
  994. #sleep 1
  995. done < ${models_fp16_gpu_config}
  996. # Run mindir converted models:
  997. while read line; do
  998. mindspore_line_info=${line}
  999. if [[ $mindspore_line_info == \#* ]]; then
  1000. continue
  1001. fi
  1002. model_name=`echo ${mindspore_line_info}|awk -F ' ' '{print $1}'`
  1003. accuracy_limit=`echo ${mindspore_line_info}|awk -F ' ' '{print $2}'`
  1004. echo "mindspore run: ${model_name}, accuracy limit:${accuracy_limit}" >> "${run_arm64_log_file}"
  1005. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  1006. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out --accuracyThreshold='${accuracy_limit} >> "${run_arm64_log_file}"
  1007. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out --accuracyThreshold='${accuracy_limit} >> adb_run_cmd.txt
  1008. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  1009. if [ $? = 0 ]; then
  1010. run_result='arm64: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  1011. else
  1012. run_result='arm64: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  1013. fi
  1014. # run benchmark test without clib data
  1015. echo ${model_name} >> "${run_arm64_log_file}"
  1016. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  1017. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --warmUpLoopCount=1 --loopCount=2' >> "{run_arm64_log_file}"
  1018. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --warmUpLoopCount=1 --loopCount=2' >> adb_run_cmd.txt
  1019. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  1020. if [ $? = 0 ]; then
  1021. run_result='arm64: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  1022. else
  1023. run_result='arm64: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  1024. fi
  1025. done < ${models_mindspore_config}
  1026. # Run mindir converted train models:
  1027. while read line; do
  1028. model_name=${line}
  1029. if [[ $model_name == \#* ]]; then
  1030. continue
  1031. fi
  1032. echo ${model_name}'_train' >> "${run_arm64_log_file}"
  1033. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  1034. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'_train.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.train.ms.out --accuracyThreshold=1.5' >> "${run_arm64_log_file}"
  1035. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'_train.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.train.ms.out --accuracyThreshold=1.5' >> adb_run_cmd.txt
  1036. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  1037. if [ $? = 0 ]; then
  1038. run_result='arm64: '${model_name}'_train pass'; echo ${run_result} >> ${run_benchmark_result_file}
  1039. else
  1040. run_result='arm64: '${model_name}'_train failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  1041. fi
  1042. # run benchmark test without clib data
  1043. echo ${model_name} >> "${run_arm64_log_file}"
  1044. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  1045. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'_train.ms --warmUpLoopCount=1 --loopCount=2' >> "{run_arm64_log_file}"
  1046. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'_train.ms --warmUpLoopCount=1 --loopCount=2' >> adb_run_cmd.txt
  1047. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  1048. if [ $? = 0 ]; then
  1049. run_result='arm64: '${model_name}'_train pass'; echo ${run_result} >> ${run_benchmark_result_file}
  1050. else
  1051. run_result='arm64: '${model_name}'_train failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  1052. fi
  1053. done < ${models_mindspore_train_config}
  1054. # Run mindir weightquant converted train models:
  1055. while read line; do
  1056. model_name=${line}
  1057. if [[ $model_name == \#* ]]; then
  1058. continue
  1059. fi
  1060. echo ${model_name}'_train' >> "${run_arm64_log_file}"
  1061. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  1062. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'_weightquant.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.weightquant.ms.out --loopCount=1' >> "${run_arm64_log_file}"
  1063. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'_weightquant.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.weightquant.ms.out --loopCount=1' >> adb_run_cmd.txt
  1064. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  1065. if [ $? = 0 ]; then
  1066. run_result='arm64: '${model_name}'_train pass'; echo ${run_result} >> ${run_benchmark_result_file}
  1067. else
  1068. run_result='arm64: '${model_name}'_train failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  1069. fi
  1070. done < ${models_mindspore_weightquant_config}
  1071. # Run converted models which has several inputs or does not need to be cared about the accuracy:
  1072. while read line; do
  1073. model_name=${line%%;*}
  1074. model_name_len=${#model_name}
  1075. input_params=${line:model_name_len+1}
  1076. input_num=${input_params%%;*}
  1077. input_shape=${input_params##*;}
  1078. input_files=''
  1079. output_file=''
  1080. if [[ -z "$input_files" || $input_files == 1 ]] && [ -e ${ms_models_path}/${model_name}'.ms.bin' ]; then
  1081. input_files=$model_name'.ms.bin'
  1082. elif [[ ! -z "$input_files" && $input_files > 1 ]]; then
  1083. for i in $(seq 1 $input_num)
  1084. do
  1085. input_files=$input_files$model_name'.ms.bin_'$i','
  1086. done
  1087. fi
  1088. if [ -e ${ms_models_path}/${model_name}'.ms.out' ]; then
  1089. output_file=${ms_models_path}/${model_name}'.ms.out'
  1090. fi
  1091. if [[ ${model_name##*.} == "caffemodel" ]]; then
  1092. model_name=${model_name%.*}
  1093. fi
  1094. echo ${model_name} >> "${run_arm64_log_file}"
  1095. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  1096. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --inDataFile='${input_files}' --benchmarkDataFile='${output_file} >> "${run_arm64_log_file}"
  1097. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --inDataFile='${input_files}' --benchmarkDataFile='${output_file} >> adb_run_cmd.txt
  1098. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_log_file}"
  1099. if [ $? = 0 ]; then
  1100. run_result='arm64: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  1101. else
  1102. run_result='arm64: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  1103. fi
  1104. done < ${models_only_for_process_config}
  1105. }
  1106. # Run on arm32 platform:
  1107. function Run_arm32() {
  1108. # Unzip arm32
  1109. cd ${arm32_path} || exit 1
  1110. tar -zxf mindspore-lite-${version}-runtime-arm32-${process_unit_arm32}.tar.gz || exit 1
  1111. # If build with minddata, copy the minddata related libs
  1112. cd ${benchmark_test_path} || exit 1
  1113. if [ -f ${arm32_path}/mindspore-lite-${version}-runtime-arm32-${process_unit_arm32}/lib/libminddata-lite.so ]; then
  1114. cp -a ${arm32_path}/mindspore-lite-${version}-runtime-arm32-${process_unit_arm32}/third_party/libjpeg-turbo/lib/libjpeg.so ${benchmark_test_path}/libjpeg.so || exit 1
  1115. cp -a ${arm32_path}/mindspore-lite-${version}-runtime-arm32-${process_unit_arm32}/third_party/libjpeg-turbo/lib/libturbojpeg.so ${benchmark_test_path}/libturbojpeg.so || exit 1
  1116. cp -a ${arm32_path}/mindspore-lite-${version}-runtime-arm32-${process_unit_arm32}/third_party/opencv/lib/libopencv_core.so ${benchmark_test_path}/libopencv_core.so || exit 1
  1117. cp -a ${arm32_path}/mindspore-lite-${version}-runtime-arm32-${process_unit_arm32}/third_party/opencv/lib/libopencv_imgcodecs.so ${benchmark_test_path}/libopencv_imgcodecs.so || exit 1
  1118. cp -a ${arm32_path}/mindspore-lite-${version}-runtime-arm32-${process_unit_arm32}/third_party/opencv/lib/libopencv_imgproc.so ${benchmark_test_path}/libopencv_imgproc.so || exit 1
  1119. cp -a ${arm32_path}/mindspore-lite-${version}-runtime-arm32-${process_unit_arm32}/lib/libminddata-lite.so ${benchmark_test_path}/libminddata-lite.so || exit 1
  1120. fi
  1121. cp -a ${arm32_path}/mindspore-lite-${version}-runtime-arm32-${process_unit_arm32}/lib/libmindspore-lite.so ${benchmark_test_path}/libmindspore-lite.so || exit 1
  1122. cp -a ${arm32_path}/mindspore-lite-${version}-runtime-arm32-${process_unit_arm32}/benchmark/benchmark ${benchmark_test_path}/benchmark || exit 1
  1123. # adb push all needed files to the phone
  1124. adb -s ${device_id} push ${benchmark_test_path} /data/local/tmp/ > adb_push_log.txt
  1125. # run adb ,run session ,check the result:
  1126. echo 'cd /data/local/tmp/benchmark_test' > adb_cmd.txt
  1127. echo 'cp /data/local/tmp/arm32/libc++_shared.so ./' >> adb_cmd.txt
  1128. echo 'chmod 777 benchmark' >> adb_cmd.txt
  1129. adb -s ${device_id} shell < adb_cmd.txt
  1130. # Run fp32 models:
  1131. while read line; do
  1132. model_name=${line}
  1133. if [[ $model_name == \#* ]]; then
  1134. continue
  1135. fi
  1136. echo ${model_name} >> "${run_arm32_log_file}"
  1137. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  1138. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out' >> "${run_arm32_log_file}"
  1139. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --inDataFile=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out' >> adb_run_cmd.txt
  1140. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm32_log_file}"
  1141. if [ $? = 0 ]; then
  1142. run_result='arm32: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  1143. else
  1144. run_result='arm32: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  1145. fi
  1146. # run benchmark test without clib data
  1147. echo ${model_name} >> "${run_arm32_log_file}"
  1148. echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt
  1149. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --warmUpLoopCount=1 --loopCount=2' >> "${run_arm32_log_file}"
  1150. echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelFile='${model_name}'.ms --warmUpLoopCount=1 --loopCount=2' >> adb_run_cmd.txt
  1151. adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm32_log_file}"
  1152. if [ $? = 0 ]; then
  1153. run_result='arm32: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file}
  1154. else
  1155. run_result='arm32: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1
  1156. fi
  1157. done < ${models_arm32_config}
  1158. }
  1159. # Print start msg before run testcase
  1160. function MS_PRINT_TESTCASE_START_MSG() {
  1161. echo ""
  1162. echo -e "-----------------------------------------------------------------------------------------------------------------------------------"
  1163. echo -e "env Testcase Result "
  1164. echo -e "--- -------- ------ "
  1165. }
  1166. # Print start msg after run testcase
  1167. function MS_PRINT_TESTCASE_END_MSG() {
  1168. echo -e "-----------------------------------------------------------------------------------------------------------------------------------"
  1169. }
  1170. basepath=$(pwd)
  1171. echo ${basepath}
  1172. #set -e
  1173. # Example:sh run_benchmark_nets.sh -r /home/temp_test -m /home/temp_test/models -d "8KE5T19620002408"
  1174. while getopts "r:m:d:" opt; do
  1175. case ${opt} in
  1176. r)
  1177. release_path=${OPTARG}
  1178. echo "release_path is ${OPTARG}"
  1179. ;;
  1180. m)
  1181. models_path=${OPTARG}
  1182. echo "models_path is ${OPTARG}"
  1183. ;;
  1184. d)
  1185. device_id=${OPTARG}
  1186. echo "device_id is ${OPTARG}"
  1187. ;;
  1188. ?)
  1189. echo "unknown para"
  1190. exit 1;;
  1191. esac
  1192. done
  1193. mkdir train
  1194. arm64_path=${release_path}/android_aarch64
  1195. mv ${arm64_path}/*runtime-*train* ./train
  1196. file_name=$(ls ${arm64_path}/*runtime-arm64*.tar.gz)
  1197. IFS="-" read -r -a file_name_array <<< "$file_name"
  1198. version=${file_name_array[2]}
  1199. IFS="." read -r -a suffix <<< "${file_name_array[-1]}"
  1200. process_unit_arm64=${suffix[0]}
  1201. arm32_path=${release_path}/android_aarch32
  1202. mv ${arm32_path}/*runtime-*train* ./train
  1203. file_name=$(ls ${arm32_path}/*runtime-arm32*.tar.gz)
  1204. IFS="-" read -r -a file_name_array <<< "$file_name"
  1205. IFS="." read -r -a suffix <<< "${file_name_array[-1]}"
  1206. process_unit_arm32=${suffix[0]}
  1207. x86_path=${release_path}/ubuntu_x86
  1208. mv ${x86_path}/*runtime-*train* ./train
  1209. file_name=$(ls ${x86_path}/*runtime-x86-cpu*.tar.gz)
  1210. IFS="-" read -r -a file_name_array <<< "$file_name"
  1211. IFS="." read -r -a suffix <<< "${file_name_array[-1]}"
  1212. process_unit_x86=${suffix[0]}
  1213. x86_path=${release_path}/ubuntu_x86
  1214. file_name=$(ls ${x86_path}/*runtime-x86-sse*.tar.gz)
  1215. IFS="-" read -r -a file_name_array <<< "$file_name"
  1216. IFS="." read -r -a suffix <<< "${file_name_array[-1]}"
  1217. process_unit_x86=${suffix[0]}
  1218. # Set models config filepath
  1219. models_tflite_config=${basepath}/models_tflite.cfg
  1220. models_caffe_config=${basepath}/models_caffe.cfg
  1221. models_tflite_awaretraining_config=${basepath}/models_tflite_awaretraining.cfg
  1222. models_tflite_posttraining_config=${basepath}/models_tflite_posttraining.cfg
  1223. models_caffe_posttraining_config=${basepath}/models_caffe_posttraining.cfg
  1224. models_tflite_weightquant_config=${basepath}/models_tflite_weightquant.cfg
  1225. models_onnx_config=${basepath}/models_onnx.cfg
  1226. models_fp16_config=${basepath}/models_fp16.cfg
  1227. models_mindspore_config=${basepath}/models_mindspore.cfg
  1228. models_mindspore_train_config=${basepath}/models_mindspore_train.cfg
  1229. models_mindspore_mixbit_config=${basepath}/models_mindspore_mixbit.cfg
  1230. models_tflite_gpu_config=${basepath}/models_fp32_gpu.cfg
  1231. models_mindspore_weightquant_config=${basepath}/models_mindspore_weightquant.cfg
  1232. models_fp16_gpu_config=${basepath}/models_fp16_gpu.cfg
  1233. models_arm32_config=${basepath}/models_arm32.cfg
  1234. models_compatibility_config=${basepath}/models_compatibility.cfg
  1235. models_only_for_process_config=${basepath}/models_with_several_inputs_or_without_outputs.cfg
  1236. ms_models_path=${basepath}/ms_models
  1237. # Write converter result to temp file
  1238. run_converter_log_file=${basepath}/run_converter_log.txt
  1239. echo ' ' > ${run_converter_log_file}
  1240. run_converter_result_file=${basepath}/run_converter_result.txt
  1241. echo ' ' > ${run_converter_result_file}
  1242. # Run converter
  1243. echo "start Run converter ..."
  1244. Run_Converter
  1245. Run_converter_PID=$!
  1246. sleep 1
  1247. wait ${Run_converter_PID}
  1248. Run_converter_status=$?
  1249. function Print_Converter_Result() {
  1250. MS_PRINT_TESTCASE_END_MSG
  1251. while read line; do
  1252. arr=("${line}")
  1253. printf "%-15s %-20s %-90s %-7s\n" ${arr[0]} ${arr[1]} ${arr[2]} ${arr[3]}
  1254. done < ${run_converter_result_file}
  1255. MS_PRINT_TESTCASE_END_MSG
  1256. }
  1257. # Check converter result and return value
  1258. if [[ ${Run_converter_status} = 0 ]];then
  1259. echo "Run converter success"
  1260. Print_Converter_Result
  1261. else
  1262. echo "Run converter failed"
  1263. cat ${run_converter_log_file}
  1264. Print_Converter_Result
  1265. exit 1
  1266. fi
  1267. # Write benchmark result to temp file
  1268. run_benchmark_result_file=${basepath}/run_benchmark_result.txt
  1269. echo ' ' > ${run_benchmark_result_file}
  1270. run_x86_log_file=${basepath}/run_x86_log.txt
  1271. echo 'run x86 logs: ' > ${run_x86_log_file}
  1272. run_x86_sse_log_file=${basepath}/run_x86_sse_log.txt
  1273. echo 'run x86 sse logs: ' > ${run_x86_sse_log_file}
  1274. run_arm64_log_file=${basepath}/run_arm64_log.txt
  1275. echo 'run arm64 logs: ' > ${run_arm64_log_file}
  1276. run_arm32_log_file=${basepath}/run_arm32_log.txt
  1277. echo 'run arm32 logs: ' > ${run_arm32_log_file}
  1278. # Copy the MindSpore models:
  1279. echo "Push files to the arm and run benchmark"
  1280. benchmark_test_path=${basepath}/benchmark_test
  1281. rm -rf ${benchmark_test_path}
  1282. mkdir -p ${benchmark_test_path}
  1283. cp -a ${ms_models_path}/*.ms ${benchmark_test_path} || exit 1
  1284. # Copy models converted using old release of mslite converter for compatibility test
  1285. cp -a ${models_path}/compatibility_test/*.ms ${benchmark_test_path} || exit 1
  1286. # Run on x86
  1287. echo "start Run x86 ..."
  1288. Run_x86 &
  1289. Run_x86_PID=$!
  1290. sleep 1
  1291. # Run on x86-sse
  1292. echo "start Run x86 sse ..."
  1293. Run_x86_sse &
  1294. Run_x86_sse_PID=$!
  1295. sleep 1
  1296. # Run on arm64
  1297. echo "start Run arm64 ..."
  1298. Run_arm64
  1299. Run_arm64_status=$?
  1300. sleep 1
  1301. # Run on arm32
  1302. echo "start Run arm32 ..."
  1303. Run_arm32
  1304. Run_arm32_status=$?
  1305. sleep 1
  1306. wait ${Run_x86_PID}
  1307. Run_x86_status=$?
  1308. function Print_Benchmark_Result() {
  1309. MS_PRINT_TESTCASE_START_MSG
  1310. while read line; do
  1311. arr=("${line}")
  1312. printf "%-20s %-100s %-7s\n" ${arr[0]} ${arr[1]} ${arr[2]}
  1313. done < ${run_benchmark_result_file}
  1314. MS_PRINT_TESTCASE_END_MSG
  1315. }
  1316. # Check benchmark result and return value
  1317. if [[ ${Run_x86_status} != 0 ]];then
  1318. echo "Run_x86 failed"
  1319. cat ${run_x86_log_file}
  1320. Print_Benchmark_Result
  1321. exit 1
  1322. fi
  1323. wait ${Run_x86_sse_PID}
  1324. Run_x86_sse_status=$?
  1325. if [[ ${Run_x86_sse_status} != 0 ]];then
  1326. echo "Run_x86 sse failed"
  1327. cat ${run_x86_sse_log_file}
  1328. Print_Benchmark_Result
  1329. exit 1
  1330. fi
  1331. if [[ ${Run_arm64_status} != 0 ]];then
  1332. echo "Run_arm64 failed"
  1333. cat ${run_arm64_log_file}
  1334. Print_Benchmark_Result
  1335. exit 1
  1336. fi
  1337. if [[ ${Run_arm32_status} != 0 ]];then
  1338. echo "Run_arm32 failed"
  1339. cat ${run_arm32_log_file}
  1340. Print_Benchmark_Result
  1341. exit 1
  1342. fi
  1343. echo "Run_x86 and Run_x86_sse and Run_arm64 and Run_arm32 is ended"
  1344. Print_Benchmark_Result
  1345. exit 0