microbench.sh 2.9 KB

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