deps.r 2.6 KB

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