prio.r 2.8 KB

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