deps.r 2.7 KB

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