run.sh 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #!/bin/env bash
  2. MAKE_OPTS=${MAKE_OPTS:-""}
  3. RUNON=${RUNON-fpga}
  4. CONFIG=${CONFIG-"n900,ux900"}
  5. BACKUP=${BACKUP:-Backups}
  6. CFGSET=${CFGSET:-full}
  7. BITSET=${BITSET:-latest}
  8. RUNMODE=${RUNMODE-all}
  9. MYSCRIPTDIR=$(dirname $(readlink -f $BASH_SOURCE))
  10. MYSCRIPTDIR=$(readlink -f $MYSCRIPTDIR)
  11. COMMON_ENV=$(readlink -f $MYSCRIPTDIR/../env.sh)
  12. FPGALOC=
  13. CFGLOC=
  14. source $COMMON_ENV
  15. gen_logdir barebench
  16. describe_env
  17. function setup_suite {
  18. local cfgloc=${1:-mini}
  19. local fpgaloc=${2:-latest}
  20. local configpath=${MYSCRIPTDIR}/configs/${cfgloc}
  21. local fpgapath=${MYSCRIPTDIR}/bitstreams/$fpgaloc
  22. if [ ! -d $configpath ] ; then
  23. echo "Can't find proper test suite $cfgloc located in $configpath"
  24. echo "Please pass correct CFGSET value, such as CFGSET=mini or CFGSET=full"
  25. exit 1
  26. fi
  27. if [ ! -d $fpgapath ] ; then
  28. echo "Can't find proper test suite $fpgaloc located in $fpgapath"
  29. echo "Please pass correct FPGASET value, such as FPGASET=latest or FPGASET=202206"
  30. exit 1
  31. fi
  32. CFGLOC=$configpath
  33. FPGALOC=$fpgapath
  34. }
  35. function runbench {
  36. local yfn=$1
  37. local logdir=$2
  38. local mkoptions=${@:3}
  39. local RUNNER_CMD="python3 $NSDK_RUNNER_PY --appyaml ${MYSCRIPTDIR}/$yfn.yaml --logdir $LOGDIR/$logdir --runon $RUNON --cfgloc $CFGLOC --fpgaloc $FPGALOC"
  40. if [ "x$CONFIG" != "x" ] ; then
  41. RUNNER_CMD="${RUNNER_CMD} --config \"$CONFIG\""
  42. fi
  43. if [ "x$mkoptions" != "x" ] ; then
  44. RUNNER_CMD="${RUNNER_CMD} --make_options \"$mkoptions\""
  45. fi
  46. echo $RUNNER_CMD
  47. if [[ $DRYRUN == 0 ]] ; then
  48. export OLDRUNMODE=$RUNMODE
  49. unset RUNMODE
  50. eval $RUNNER_CMD
  51. export RUNMODE=$OLDRUNMODE
  52. unset OLDRUNMODE
  53. fi
  54. }
  55. function do_barebench {
  56. pushd $NSDK_ROOT
  57. if [ "x${RUNMODE}" == "xall" ] || [ "x${RUNMODE}" == "xbare" ] ; then
  58. echo "Run all baremetal benchmark for all cores"
  59. runbench barebench barebench ""
  60. fi
  61. if [ "x${RUNMODE}" == "xall" ] || [ "x${RUNMODE}" == "xclib" ] ; then
  62. echo "Run all baremetal benchmark for all cores"
  63. runbench clibbench clibbench ""
  64. fi
  65. if [ "x${RUNMODE}" == "xall" ] || [ "x${RUNMODE}" == "xdhry" ] ; then
  66. echo "Run dhrystone for different options for all cores"
  67. for dhrymode in ground inline best
  68. do
  69. MKOPTS="DHRY_MODE=$dhrymode"
  70. local dhrylogdir=dhrystone/$dhrymode
  71. runbench dhrystone $dhrylogdir "$MKOPTS"
  72. done
  73. RUNCMD="python3 $NSDK_REPORT_PY --logdir $LOGDIR/dhrystone --split --run"
  74. if [[ $DRYRUN == 0 ]] ; then
  75. eval $RUNCMD
  76. fi
  77. fi
  78. # generate report for all baremetal benchmark/libncrt/dhrystone benchmarks
  79. RUNCMD="python3 $NSDK_REPORT_PY --logdir $LOGDIR --split --run"
  80. if [[ $DRYRUN == 0 ]] ; then
  81. eval $RUNCMD
  82. fi
  83. popd
  84. }
  85. setup_suite ${CFGSET} ${FPGASET}
  86. do_barebench | tee $LOGDIR/build.log
  87. zip_logdir