perturbate.r 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. list <- handle_size(size, ampl);
  60. gflopstab <- c(gflopstab, list);
  61. sizetab <- c(sizetab, array(size, c(length(list))));
  62. }
  63. return(
  64. data.frame(gflops=gflopstab, size=sizetab, ampl=array(ampl, c(length(gflopstab)) ))
  65. );
  66. }
  67. handle_ampl_mean <- function(ampl)
  68. {
  69. meantab <- NULL;
  70. sizetab <- NULL;
  71. for (size in sizelist) {
  72. list <- mean(handle_size(size, ampl));
  73. meantab <- c(meantab, list);
  74. sizetab <- c(sizetab, array(size, c(length(list))));
  75. }
  76. return(
  77. data.frame(gflops=meantab, size=sizetab, ampl=array(ampl, c(length(meantab)) ))
  78. # meantab
  79. );
  80. }
  81. handle_ref_mean <- function()
  82. {
  83. meantab <- NULL;
  84. sizetab <- NULL;
  85. for (size in sizelist) {
  86. list <- mean(handle_size_ref(size));
  87. meantab <- c(meantab, list);
  88. sizetab <- c(sizetab, array(size, c(length(list))));
  89. }
  90. return(
  91. data.frame(gflops=meantab, size=sizetab)
  92. # meantab
  93. );
  94. }
  95. trace_ampl <- function(ampl, color, style)
  96. {
  97. #points(handle_ampl(ampl)$size, handle_ampl(ampl)$gflops, col=color);
  98. lines(handle_ampl_mean(ampl)$size, handle_ampl_mean(ampl)$gflops, type = "o", col=color, lwd= 1, lty=1, pch = style);
  99. }
  100. trace_ref <- function(color)
  101. {
  102. lines(handle_ref_mean()$size, handle_ref_mean()$gflops, col=color, lwd=3, lty=2);
  103. }
  104. display_ampl <- function()
  105. {
  106. xlist <- range(sizelist);
  107. ylist <- range(c(0,100));
  108. plot.new();
  109. plot.window(xlist, ylist);
  110. trace_ref("black");
  111. trace_ampl("1.0", "black", 4);
  112. trace_ampl("0.50", "black", 5);
  113. trace_ampl("0.25", "black", 2);
  114. trace_ampl("0.1", "black", 1);
  115. trace_ampl("0.0", "black", 0);
  116. axis(1, at=sizelist, font=1.6)
  117. axis(2, at=seq(0, 100, 10), tck=1, font=1.6)
  118. # axis(4, at=seq(0, 100, 10))
  119. box(bty="u")
  120. labels <- c("greedy", "0 %", "10 %", "25 %", "50 %", "100 %")
  121. 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")
  122. mtext("matrix size", side=1, line=2, cex=1.6)
  123. mtext("GFlops", side=2, line=2, las=0, cex=1.6)
  124. # title("Impact of performance prediction innacuracies on LU decomposition");
  125. }
  126. display_ampl()