starpu_codelet_histo_profile.in 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/bin/sh
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2009-2011,2013-2014 Université de Bordeaux
  5. # Copyright (C) 2010,2013,2015 CNRS
  6. #
  7. # StarPU is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU Lesser General Public License as published by
  9. # the Free Software Foundation; either version 2.1 of the License, or (at
  10. # your option) any later version.
  11. #
  12. # StarPU is distributed in the hope that it will be useful, but
  13. # WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. #
  16. # See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. #
  18. PROGNAME=$0
  19. usage()
  20. {
  21. echo "Offline tool to draw codelet profile histogram over a traced execution"
  22. echo ""
  23. echo "Usage: $PROGNAME distrib.data"
  24. echo ""
  25. echo "Options:"
  26. echo " -h, --help display this help and exit"
  27. echo " -v, --version output version information and exit"
  28. echo ""
  29. echo "Report bugs to <@PACKAGE_BUGREPORT@>"
  30. exit 1
  31. }
  32. if [ "$1" = "-v" ] || [ "$1" = "--version" ] ; then
  33. echo "$PROGNAME (@PACKAGE_NAME@) @PACKAGE_VERSION@"
  34. exit 0
  35. fi
  36. if [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "" ] ; then
  37. usage
  38. fi
  39. create_histograms()
  40. {
  41. inputfile=$1
  42. R --no-save > /dev/null << EOF
  43. handle_hash <- function (codelet, arch, hash)
  44. {
  45. mytable <- table
  46. mytable <- mytable[mytable[,1]==codelet,]
  47. mytable <- mytable[mytable[,2]==arch,]
  48. mytable <- mytable[mytable[,4]==hash,]
  49. val <- mytable[,5]
  50. # there is certainly a better way to do this !
  51. size <- unique(mytable[,3])
  52. pdf(paste("$inputfile", codelet, arch, hash, size, "pdf", sep="."));
  53. try ( { h <- hist(val[val > quantile(val,0.01) & val<quantile(val,0.99)], col="red", breaks=50, density=10) } )
  54. dev.off()
  55. }
  56. table <- read.table("$inputfile")
  57. codeletlist <- unique(table[,1])
  58. for (codelet in codeletlist)
  59. {
  60. archlist <- unique(table[table[,1]==codelet,2])
  61. for (arch in archlist)
  62. {
  63. hashlist <- unique(table[table[,2]==arch,4])
  64. for (hash in hashlist)
  65. {
  66. print(codelet)
  67. print(arch)
  68. print(hash)
  69. handle_hash(codelet, arch, hash)
  70. }
  71. }
  72. }
  73. EOF
  74. }
  75. for inputfile in $@
  76. do
  77. create_histograms $inputfile
  78. done