sched.r 3.2 KB

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