prio.r 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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, lwd=2);
  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("prio", "blue", 4);
  78. trace_sched("no-prio", "red", 5);
  79. axis(1, at=sizelist)
  80. axis(2, at=seq(0, 100, 10), tck=1)
  81. # axis(4, at=seq(0, 100, 10))
  82. box(bty="u")
  83. labels <- c("with priority", "no priority")
  84. legend("topleft", inset=.05, title="Scheduling policy", labels, lwd=2, col=c("blue", "red"), bty="y", bg="white", cex=1.6)
  85. mtext("matrix size", side=1, line=2, cex=1.6)
  86. mtext("GFlops", side=2, line=2, las=0, cex=1.6)
  87. title("Cholesky decomposition");
  88. }
  89. display_sched()