sched.r 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. # StarPU --- Runtime system for heterogeneous multicore architectures.
  2. #
  3. # Copyright (C) 2010 Université de Bordeaux
  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. size*size*size/(3000000*x);
  23. }
  24. parse <- function (size, sched)
  25. {
  26. filename = paste("timings_sched/sched", sched, size, sep=".");
  27. if (file.exists(filename))
  28. {
  29. ret <- scan(paste("timings_sched/sched", sched, size, sep="."));
  30. return(ret);
  31. };
  32. return(NULL);
  33. }
  34. handle_size <- function (size, sched)
  35. {
  36. gflops <- gflops(parse(size, sched), size);
  37. return(gflops);
  38. }
  39. handle_sched <- function(sched)
  40. {
  41. gflopstab <- NULL;
  42. sizetab <- NULL;
  43. for (size in sizelist)
  44. {
  45. list <- handle_size(size, sched);
  46. gflopstab <- c(gflopstab, list);
  47. sizetab <- c(sizetab, array(size, c(length(list))));
  48. }
  49. return(
  50. data.frame(gflops=gflopstab, size=sizetab, sched=array(sched, c(length(gflopstab)) ))
  51. );
  52. }
  53. handle_sched_mean <- function(sched)
  54. {
  55. meantab <- NULL;
  56. sizetab <- NULL;
  57. for (size in sizelist)
  58. {
  59. list <- mean(handle_size(size, sched));
  60. meantab <- c(meantab, list);
  61. sizetab <- c(sizetab, array(size, c(length(list))));
  62. }
  63. return(
  64. data.frame(gflops=meantab, size=sizetab, sched=array(sched, c(length(meantab)) ))
  65. # meantab
  66. );
  67. }
  68. trace_sched <- function(sched, color, style)
  69. {
  70. # points(handle_sched(sched)$size, handle_sched(sched)$gflops, col=color);
  71. #lines(handle_sched_mean(sched)$size, handle_sched_mean(sched)$gflops, col=color, legend.text=TRUE);
  72. lines(handle_sched_mean(sched)$size, handle_sched_mean(sched)$gflops, col=color, pch = style, type ="o");
  73. }
  74. display_sched <- function()
  75. {
  76. xlist <- range(sizelist);
  77. ylist <- range(c(0,80));
  78. plot.new();
  79. plot.window(xlist, ylist);
  80. trace_sched("dm", "black", 0);
  81. trace_sched("prio", "black", 4);
  82. # trace_sched("random", "black", 1);
  83. trace_sched("no-prio", "black", 5);
  84. trace_sched("greedy", "red", 2);
  85. axis(1, at=sizelist)
  86. axis(2, at=seq(0, 100, 10), tck=1)
  87. # axis(4, at=seq(0, 100, 10))
  88. box(bty="u")
  89. # labels <- c("greedy", "priority", "model", "random", "no-prio")
  90. # labels <- c("model", "priority", "weigthed random", "no priority")
  91. labels <- c("model", "priority", "no priority")
  92. # col <- c("red", "blue", "green", "orange", "black")
  93. legend("topleft", inset=.05, title="Scheduling policy", labels, lwd=1, lty=1, pch=c(0, 4, 5, 2), col="black", bty="y", bg="white")
  94. mtext("matrix size", side=1, line=2, cex=1.6)
  95. mtext("GFlops", side=2, line=2, las=0, cex=1.6)
  96. # title("Impact of the scheduling strategy on Cholesky decomposition");
  97. }
  98. display_sched()