perturbate.r 3.7 KB

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