run_interp.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. echo -en "\t\t\t\t\t native\tiwasm-interp\n" >> $REPORT
  32. for t in $POLYBENCH_CASES
  33. do
  34. print_bench_name $t
  35. echo "run $t with native .."
  36. echo -en "\t" >> $REPORT
  37. $TIME -f "real-%e-time" ./${t}_native 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT
  38. echo "run $t with iwasm interp .."
  39. echo -en "\t" >> $REPORT
  40. $TIME -f "real-%e-time" $IWASM_CMD ${t}.wasm 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT
  41. echo -en "\n" >> $REPORT
  42. done