deps.r 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. list <- handle_size(size, sched);
  38. gflopstab <- c(gflopstab, list);
  39. sizetab <- c(sizetab, array(size, c(length(list))));
  40. }
  41. return(
  42. data.frame(gflops=gflopstab, size=sizetab, sched=array(sched, c(length(gflopstab)) ))
  43. );
  44. }
  45. handle_sched_mean <- function(sched)
  46. {
  47. meantab <- NULL;
  48. sizetab <- NULL;
  49. for (size in sizelist) {
  50. list <- mean(handle_size(size, sched));
  51. meantab <- c(meantab, list);
  52. sizetab <- c(sizetab, array(size, c(length(list))));
  53. }
  54. return(
  55. data.frame(gflops=meantab, size=sizetab, sched=array(sched, c(length(meantab)) ))
  56. # meantab
  57. );
  58. }
  59. trace_sched <- function(sched, color)
  60. {
  61. # points(handle_sched(sched)$size, handle_sched(sched)$gflops, col=color);
  62. lines(handle_sched_mean(sched)$size, handle_sched_mean(sched)$gflops, col=color, lwd=2);
  63. }
  64. display_sched <- function()
  65. {
  66. xlist <- range(sizelist);
  67. ylist <- range(c(0,90));
  68. plot.new();
  69. plot.window(xlist, ylist);
  70. trace_sched("v1", "red");
  71. trace_sched("v2", "blue");
  72. axis(1, at=sizelist)
  73. axis(2, at=seq(0, 100, 10), tck=1)
  74. # axis(4, at=seq(0, 100, 10))
  75. box(bty="u")
  76. labels <- c("with support", "no support")
  77. 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)
  78. mtext("matrix size", side=1, line=2, cex=1.6)
  79. mtext("GFlops", side=2, line=2, las=0, cex=1.6)
  80. title("Support for task dependencies within LU decomposition");
  81. }
  82. display_sched()