starpu_codelet_histo_profile.in 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #!/bin/sh
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2009-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. PROGNAME=$0
  18. usage()
  19. {
  20. echo "Offline tool to draw codelet profile histogram over a traced execution"
  21. echo ""
  22. echo "Usage: $PROGNAME distrib.data"
  23. echo ""
  24. echo "Options:"
  25. echo " -h, --help display this help and exit"
  26. echo " -v, --version output version information and exit"
  27. echo ""
  28. echo "Report bugs to <@PACKAGE_BUGREPORT@>"
  29. exit 1
  30. }
  31. if [ "$1" = "-v" ] || [ "$1" = "--version" ] ; then
  32. echo "$PROGNAME (@PACKAGE_NAME@) @PACKAGE_VERSION@"
  33. exit 0
  34. fi
  35. if [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "" ] ; then
  36. usage
  37. fi
  38. create_histograms()
  39. {
  40. inputfile=$1
  41. R --no-save > /dev/null << EOF
  42. handle_hash <- function (codelet, arch, hash)
  43. {
  44. mytable <- table
  45. mytable <- mytable[mytable[,1]==codelet,]
  46. mytable <- mytable[mytable[,2]==arch,]
  47. mytable <- mytable[mytable[,4]==hash,]
  48. val <- mytable[,5]
  49. # there is certainly a better way to do this !
  50. size <- unique(mytable[,3])
  51. pdf(paste("$inputfile", codelet, arch, hash, size, "pdf", sep="."));
  52. try ( { h <- hist(val[val > quantile(val,0.01) & val<quantile(val,0.99)], col="red", breaks=50, density=10) } )
  53. dev.off()
  54. }
  55. table <- read.table("$inputfile")
  56. codeletlist <- unique(table[,1])
  57. for (codelet in codeletlist)
  58. {
  59. archlist <- unique(table[table[,1]==codelet,2])
  60. for (arch in archlist)
  61. {
  62. hashlist <- unique(table[table[,2]==arch,4])
  63. for (hash in hashlist)
  64. {
  65. print(codelet)
  66. print(arch)
  67. print(hash)
  68. handle_hash(codelet, arch, hash)
  69. }
  70. }
  71. }
  72. EOF
  73. }
  74. for inputfile in $@
  75. do
  76. create_histograms $inputfile
  77. done