starpu_codelet_histo_profile 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/bash
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2009, 2010, 2013 Université de Bordeaux 1
  5. # Copyright (C) 2010 Centre National de la Recherche Scientifique
  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. if [ "$#" -lt 2 -o "$1" = --help -o "$1" = -h ]
  18. then
  19. echo "Offline tool to draw codelet profile histogram over a traced execution"
  20. echo ""
  21. echo "Usage: $0 distrib.data"
  22. exit 1
  23. fi
  24. create_histograms()
  25. {
  26. inputfile=$1
  27. R --no-save > /dev/null << EOF
  28. handle_hash <- function (codelet, arch, hash)
  29. {
  30. mytable <- table
  31. mytable <- mytable[mytable[,1]==codelet,]
  32. mytable <- mytable[mytable[,2]==arch,]
  33. mytable <- mytable[mytable[,4]==hash,]
  34. val <- mytable[,5]
  35. # there is certainly a better way to do this !
  36. size <- unique(mytable[,3])
  37. pdf(paste("$inputfile", codelet, arch, hash, size, "pdf", sep="."));
  38. h <- hist(val[val > quantile(val,0.01) & val<quantile(val,0.99)], col="red", breaks=50, density=10)
  39. dev.off()
  40. }
  41. table <- read.table("$inputfile")
  42. codeletlist <- unique(table[,1])
  43. for (codelet in codeletlist)
  44. {
  45. archlist <- unique(table[table[,1]==codelet,2])
  46. for (arch in archlist)
  47. {
  48. hashlist <- unique(table[table[,2]==arch,4])
  49. for (hash in hashlist)
  50. {
  51. print(codelet)
  52. print(arch)
  53. print(hash)
  54. handle_hash(codelet, arch, hash)
  55. }
  56. }
  57. }
  58. EOF
  59. }
  60. for inputfile in $@
  61. do
  62. create_histograms $inputfile
  63. done