blas_model.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2012 Université de Bordeaux 1
  4. * Copyright (C) 2010 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. */
  17. #include "blas_model.h"
  18. #include <starpu.h>
  19. /*
  20. * As a convention, in that file, descr[0] is represented by A,
  21. * descr[1] is B ...
  22. */
  23. /*
  24. * Number of flops of Gemm
  25. */
  26. double gemm_cost(struct starpu_task *task, unsigned nimpl)
  27. {
  28. /* C = A * B */
  29. uint32_t nxC, nyC, nxA;
  30. nxC = starpu_matrix_get_nx(task->descr[2].handle);
  31. nyC = starpu_matrix_get_ny(task->descr[2].handle);
  32. nxA = starpu_matrix_get_nx(task->descr[0].handle);
  33. /* printf("nxC %d nxC %d nxA %d\n", nxC, nyC, nxA); */
  34. double cost = ((double)nxC)*((double)nyC)*((double)nxA/1000.0f/4.11f);
  35. /* printf("cost %e \n", cost); */
  36. return cost;
  37. }