microbench.sh 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # StarPU --- Runtime system for heterogeneous multicore architectures.
  2. #
  3. # Copyright (C) 2016,2017 CNRS
  4. # Copyright (C) 2016,2017,2019 Université de Bordeaux
  5. #
  6. # StarPU is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU Lesser General Public License as published by
  8. # the Free Software Foundation; either version 2.1 of the License, or (at
  9. # your option) any later version.
  10. #
  11. # StarPU is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. #
  15. # See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. #
  17. # This provides a helper function to be used for microbenchs that should be run
  18. # under the various schedulers.
  19. #
  20. # The caller should fill either the XFAIL or XSUCCESS variable with the list of
  21. # schedulers which are supposed to fail or succeed, and then call test_scheds
  22. set -e
  23. # Testing a specific scheduler
  24. if [ -n "$STARPU_SCHED" ]
  25. then
  26. SCHEDS=$STARPU_SCHED
  27. else
  28. SCHEDS=`$(dirname $0)/../../tools/starpu_sched_display`
  29. fi
  30. test_scheds()
  31. {
  32. TEST=$1
  33. shift
  34. xfailed=""
  35. failed=""
  36. pass=""
  37. skip=""
  38. if [ -n "$STARPU_MIC_SINK_PROGRAM_PATH" ] ; then
  39. STARPU_MIC_SINK_PROGRAM_NAME=$STARPU_MIC_SINK_PROGRAM_PATH/$TEST
  40. # in case libtool got into play
  41. [ -x "$STARPU_MIC_SINK_PROGRAM_PATH/.libs/$TEST" ] && STARPU_MIC_SINK_PROGRAM_NAME=$STARPU_MIC_SINK_PROGRAM_PATH/.libs/$TEST
  42. fi
  43. RESULT=0
  44. for sched in $SCHEDS;
  45. do
  46. set +e
  47. STARPU_SCHED=$sched $(dirname $0)/$TEST "$@"
  48. ret=$?
  49. set -e
  50. if test $ret = 0
  51. then
  52. echo "SUCCESS: STARPU_SCHED=$sched ./microbenchs/$TEST"
  53. pass="$pass $sched"
  54. continue
  55. fi
  56. if test $ret = 77
  57. then
  58. echo "SKIP: STARPU_SCHED=$sched ./microbenchs/$TEST"
  59. skip="$skip $sched"
  60. continue
  61. fi
  62. if [ -n "$XSUCCESS" ]
  63. then
  64. # We have a list of schedulers that are expected to
  65. # succeed, others are allowed to fail
  66. case " $XSUCCESS " in
  67. *\ $sched\ *)
  68. echo "FAIL: STARPU_SCHED=$sched ./microbenchs/$TEST" | ( tee /dev/tty || true )
  69. failed="$failed $sched"
  70. RESULT=1
  71. ;;
  72. *)
  73. echo "XFAIL: STARPU_SCHED=$sched ./microbenchs/$TEST"
  74. xfailed="$xfailed $sched"
  75. ;;
  76. esac
  77. else
  78. # We have a list of schedulers that are expected to
  79. # fail, others are expected to succeed
  80. case " $XFAIL " in
  81. *\ $sched\ *)
  82. echo "XFAIL: STARPU_SCHED=$sched ./microbenchs/$TEST"
  83. xfailed="$xfailed $sched"
  84. ;;
  85. *)
  86. echo "FAIL: STARPU_SCHED=$sched ./microbenchs/$TEST" | ( tee /dev/tty || true )
  87. failed="$failed $sched"
  88. RESULT=1
  89. ;;
  90. esac
  91. fi
  92. done
  93. echo "passed schedulers:$pass"| ( tee /dev/tty || true )
  94. echo "skipped schedulers:$skip"| ( tee /dev/tty || true )
  95. echo "failed schedulers:$failed"| ( tee /dev/tty || true )
  96. echo "xfailed schedulers:$xfailed"| ( tee /dev/tty || true )
  97. return $RESULT
  98. }