run_aot.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/bash
  2. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. CUR_DIR=$PWD
  5. OUT_DIR=$CUR_DIR/out
  6. REPORT=$CUR_DIR/report.txt
  7. TIME=/usr/bin/time
  8. PLATFORM=$(uname -s | tr A-Z a-z)
  9. IWASM_CMD=$CUR_DIR/../../../product-mini/platforms/${PLATFORM}/build/iwasm
  10. BENCH_NAME_MAX_LEN=20
  11. POLYBENCH_CASES="2mm 3mm adi atax bicg cholesky correlation covariance \
  12. deriche doitgen durbin fdtd-2d floyd-warshall gemm gemver \
  13. gesummv gramschmidt heat-3d jacobi-1d jacobi-2d ludcmp lu \
  14. mvt nussinov seidel-2d symm syr2k syrk trisolv trmm"
  15. rm -f $REPORT
  16. touch $REPORT
  17. function print_bench_name()
  18. {
  19. name=$1
  20. echo -en "$name" >> $REPORT
  21. name_len=${#name}
  22. if [ $name_len -lt $BENCH_NAME_MAX_LEN ]
  23. then
  24. spaces=$(( $BENCH_NAME_MAX_LEN - $name_len ))
  25. for i in $(eval echo "{1..$spaces}"); do echo -n " " >> $REPORT; done
  26. fi
  27. }
  28. echo "Start to run cases, the result is written to report.txt"
  29. #run benchmarks
  30. cd $OUT_DIR
  31. if [[ ${PLATFORM} == "linux" ]]; then
  32. echo -en "\t\t\t\t\t native\tiwasm-aot\tiwasm-aot-segue\n" >> $REPORT
  33. else
  34. echo -en "\t\t\t\t\t native\tiwasm-aot\n" >> $REPORT
  35. fi
  36. for t in $POLYBENCH_CASES
  37. do
  38. print_bench_name $t
  39. echo "run $t with native .."
  40. echo -en "\t" >> $REPORT
  41. $TIME -f "real-%e-time" ./${t}_native 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT
  42. echo "run $t with iwasm aot .."
  43. echo -en "\t" >> $REPORT
  44. $TIME -f "real-%e-time" $IWASM_CMD ${t}.aot 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT
  45. if [[ ${PLATFORM} == "linux" ]]; then
  46. echo "run $t with iwasm aot segue .."
  47. echo -en "\t" >> $REPORT
  48. $TIME -f "real-%e-time" $IWASM_CMD ${t}_segue.aot 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT
  49. fi
  50. echo -en "\n" >> $REPORT
  51. done