model.r 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. sizelist <- seq(2048, 24576, 2048);
  2. #schedlist <- c("greedy", "prio", "dm", "random", "no-prio", "ws");
  3. schedlist <- c("prio", "dm", "random");
  4. print(schedlist);
  5. print(sizelist);
  6. gflops <- function (x, size)
  7. {
  8. 2*size*size*size/(3000000*x);
  9. }
  10. parse <- function (size, sched)
  11. {
  12. ret <- scan(paste("timings-sched/sched", sched, size, sep="."));
  13. return(ret);
  14. }
  15. handle_size <- function (size, sched)
  16. {
  17. gflops <- gflops(parse(size, sched), size);
  18. # return(data.frame(gflops=gflops, size=array(size, c(length(gflops))), sched=array(sched, c(length(gflops)))));
  19. return(gflops);
  20. }
  21. handle_sched <- function(sched)
  22. {
  23. gflopstab <- NULL;
  24. sizetab <- NULL;
  25. for (size in sizelist) {
  26. list <- handle_size(size, sched);
  27. gflopstab <- c(gflopstab, list);
  28. sizetab <- c(sizetab, array(size, c(length(list))));
  29. }
  30. return(
  31. data.frame(gflops=gflopstab, size=sizetab, sched=array(sched, c(length(gflopstab)) ))
  32. );
  33. }
  34. handle_sched_mean <- function(sched)
  35. {
  36. meantab <- NULL;
  37. sizetab <- NULL;
  38. for (size in sizelist) {
  39. list <- mean(handle_size(size, sched));
  40. meantab <- c(meantab, list);
  41. sizetab <- c(sizetab, array(size, c(length(list))));
  42. }
  43. return(
  44. data.frame(gflops=meantab, size=sizetab, sched=array(sched, c(length(meantab)) ))
  45. # meantab
  46. );
  47. }
  48. trace_sched <- function(sched, color, style)
  49. {
  50. #points(handle_sched(sched)$size, handle_sched(sched)$gflops, col=color);
  51. lines(handle_sched_mean(sched)$size, handle_sched_mean(sched)$gflops, col=color, legend.text=TRUE, type = "o", pch = style, lwd=2);
  52. }
  53. display_sched <- function()
  54. {
  55. xlist <- range(sizelist);
  56. ylist <- range(c(0,100));
  57. plot.new();
  58. plot.window(xlist, ylist);
  59. trace_sched("dm", "blue", 0);
  60. trace_sched("random", "red", 1);
  61. trace_sched("prio", "green3", 4);
  62. axis(1, at=sizelist)
  63. axis(2, at=seq(0, 100, 10), tck=1)
  64. # axis(4, at=seq(0, 100, 10))
  65. box(bty="u")
  66. labels <- c("model tasks", "model workers", "priority")
  67. legend("bottomright", inset=.05, title="Scheduling policy", labels, lwd=2, lty=c(1, 1, 1, 1, 1, 1), pch=c(0, 1, 2, 4),col=c("blue", "red", "green3"), bty="y", bg="white", cex=1.6)
  68. mtext("matrix size", side=1, line=2, cex=1.6)
  69. mtext("GFlops", side=2, line=2, las=0, cex=1.6)
  70. title("LU decomposition");
  71. }
  72. display_sched()
  73. # boxplot(result, col=c("yellow", "red", "green"), xlab=sizelist);
  74. # plot(c(sizelist,sizelist,sizelist), c(result_greedy, result_prio, result_dm));
  75. # plot(sizelist, result_dm);
  76. # plot.new()
  77. # plot.window(range(c(sizelist,0) ), c(0, 6))