perturbate.r 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. # StarPU --- Runtime system for heterogeneous multicore architectures.
  2. #
  3. # Copyright (C) 2010 Université de Bordeaux 1
  4. # Copyright (C) 2010, 2011 Centre National de la Recherche Scientifique
  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. sizelist <- seq(2048, 24576, 2048);
  17. schedlist <- c("greedy", "prio", "dm", "random");
  18. print(schedlist);
  19. print(sizelist);
  20. gflops <- function (x, size)
  21. {
  22. 2*size*size*size/(3000000*x);
  23. }
  24. parse <- function (size, ampl)
  25. {
  26. filename = paste("timing-perturbate/pertubate", size, ampl, sep=".");
  27. if (file.exists(filename))
  28. {
  29. ret <- scan(filename);
  30. return(ret);
  31. };
  32. return(NULL);
  33. }
  34. parse_ref <- function (size)
  35. {
  36. filename = paste("timings-sched/sched.greedy", size, sep=".");
  37. if (file.exists(filename))
  38. {
  39. ret <- scan(filename);
  40. return(ret);
  41. };
  42. return(NULL);
  43. }
  44. handle_size <- function (size, ampl)
  45. {
  46. gflops <- gflops(parse(size, ampl), size);
  47. return(gflops);
  48. }
  49. handle_size_ref <- function (size)
  50. {
  51. gflops <- gflops(parse_ref(size), size);
  52. return(gflops);
  53. }
  54. handle_ampl <- function(ampl)
  55. {
  56. gflopstab <- NULL;
  57. sizetab <- NULL;
  58. for (size in sizelist)
  59. {
  60. list <- handle_size(size, ampl);
  61. gflopstab <- c(gflopstab, list);
  62. sizetab <- c(sizetab, array(size, c(length(list))));
  63. }
  64. return(
  65. data.frame(gflops=gflopstab, size=sizetab, ampl=array(ampl, c(length(gflopstab)) ))
  66. );
  67. }
  68. handle_ampl_mean <- function(ampl)
  69. {
  70. meantab <- NULL;
  71. sizetab <- NULL;
  72. for (size in sizelist)
  73. {
  74. list <- mean(handle_size(size, ampl));
  75. meantab <- c(meantab, list);
  76. sizetab <- c(sizetab, array(size, c(length(list))));
  77. }
  78. return(
  79. data.frame(gflops=meantab, size=sizetab, ampl=array(ampl, c(length(meantab)) ))
  80. # meantab
  81. );
  82. }
  83. handle_ref_mean <- function()
  84. {
  85. meantab <- NULL;
  86. sizetab <- NULL;
  87. for (size in sizelist)
  88. {
  89. list <- mean(handle_size_ref(size));
  90. meantab <- c(meantab, list);
  91. sizetab <- c(sizetab, array(size, c(length(list))));
  92. }
  93. return(
  94. data.frame(gflops=meantab, size=sizetab)
  95. # meantab
  96. );
  97. }
  98. trace_ampl <- function(ampl, color, style)
  99. {
  100. #points(handle_ampl(ampl)$size, handle_ampl(ampl)$gflops, col=color);
  101. lines(handle_ampl_mean(ampl)$size, handle_ampl_mean(ampl)$gflops, type = "o", col=color, lwd= 1, lty=1, pch = style);
  102. }
  103. trace_ref <- function(color)
  104. {
  105. lines(handle_ref_mean()$size, handle_ref_mean()$gflops, col=color, lwd=3, lty=2);
  106. }
  107. display_ampl <- function()
  108. {
  109. xlist <- range(sizelist);
  110. ylist <- range(c(0,100));
  111. plot.new();
  112. plot.window(xlist, ylist);
  113. trace_ref("black");
  114. trace_ampl("1.0", "black", 4);
  115. trace_ampl("0.50", "black", 5);
  116. trace_ampl("0.25", "black", 2);
  117. trace_ampl("0.1", "black", 1);
  118. trace_ampl("0.0", "black", 0);
  119. axis(1, at=sizelist, font=1.6)
  120. axis(2, at=seq(0, 100, 10), tck=1, font=1.6)
  121. # axis(4, at=seq(0, 100, 10))
  122. box(bty="u")
  123. labels <- c("greedy", "0 %", "10 %", "25 %", "50 %", "100 %")
  124. legend("topleft", inset=.05, title="Perturbation", labels, lwd=c(2, 1, 1, 1, 1, 1), pch=c(-1, 0, 1, 2, 5, 4), lty=c(2, 1, 1, 1, 1, 1), col=c("black", "black", "black", "black", "black", "black"), bty="y", bg="white")
  125. mtext("matrix size", side=1, line=2, cex=1.6)
  126. mtext("GFlops", side=2, line=2, las=0, cex=1.6)
  127. # title("Impact of performance prediction innacuracies on LU decomposition");
  128. }
  129. display_ampl()