starpu_mlr_analysis.in 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/bin/bash
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2016-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  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. # Script for giving statistical analysis of the paje trace
  18. set -e # fail fast
  19. # File names
  20. SOURCE_DIR=@abs_srcdir@
  21. outputfile="mlr_analysis.html"
  22. analysis_script="$SOURCE_DIR/starpu_mlr_analysis.Rmd"
  23. # Command line arguments
  24. inputfile=""
  25. help_script()
  26. {
  27. cat << EOF
  28. Give an example of the trace analysis for computing multiple linear regression model
  29. Options:
  30. -h Show this message
  31. Examples:
  32. $0 .starpu/sampling/codelets/tmp/test_mlr.out
  33. $0
  34. Report bugs to <@PACKAGE_BUGREPORT@>
  35. EOF
  36. }
  37. if [ "$1" = "--version" ] ; then
  38. echo "$PROGNAME (@PACKAGE_NAME@) @PACKAGE_VERSION@"
  39. exit 0
  40. fi
  41. if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
  42. help_script
  43. exit 0
  44. fi
  45. while getopts "h" opt; do
  46. case $opt in
  47. \?)
  48. echo "Invalid option: -$OPTARG"
  49. help_script
  50. exit 3
  51. ;;
  52. esac
  53. done
  54. # Reading files that need to be analyzed
  55. shift $((OPTIND - 1))
  56. inputfile=$1
  57. if [[ $# < 1 ]]; then
  58. inputfile="$SOURCE_DIR/perfmodels/sampling/codelets/tmp/mlr_init.out"
  59. else
  60. # Error if there is more than one input file
  61. if [[ $# > 1 ]]; then
  62. echo "Error!"
  63. help_script
  64. exit 2
  65. fi
  66. fi
  67. if [ ! -s $inputfile ]
  68. then
  69. echo "Error: file $inputfile does not exist!"
  70. exit 5
  71. fi
  72. #####################################
  73. # Running analysis file to get actual results
  74. in="$(cd "$(dirname "$inputfile")"; pwd)/$(basename "$inputfile")"
  75. Rscript -e "library(knitr); input_trace = '$in' ; outputhtml='$outputfile';\
  76. outputRmd = gsub('.html\$','.Rmd',outputhtml);\
  77. knit('$analysis_script',output=outputRmd); knitr::knit2html(outputRmd)"