prio.r 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. # StarPU --- Runtime system for heterogeneous multicore architectures.
  2. #
  3. # Copyright (C) 2008-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. #
  5. # StarPU is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU Lesser General Public License as published by
  7. # the Free Software Foundation; either version 2.1 of the License, or (at
  8. # your option) any later version.
  9. #
  10. # StarPU is distributed in the hope that it will be useful, but
  11. # WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. #
  14. # See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. #
  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, lwd=2);
  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("prio", "blue", 4);
  81. trace_sched("no-prio", "red", 5);
  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("with priority", "no priority")
  87. legend("topleft", inset=.05, title="Scheduling policy", labels, lwd=2, col=c("blue", "red"), bty="y", bg="white", cex=1.6)
  88. mtext("matrix size", side=1, line=2, cex=1.6)
  89. mtext("GFlops", side=2, line=2, las=0, cex=1.6)
  90. title("Cholesky decomposition");
  91. }
  92. display_sched()