sc_hypervisor_lp.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2013 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. #ifndef SCHED_CTX_HYPERVISOR_LP_H
  17. #define SCHED_CTX_HYPERVISOR_LP_H
  18. #include <sc_hypervisor.h>
  19. #include <starpu_config.h>
  20. #ifdef __cplusplus
  21. extern "C"
  22. {
  23. #endif
  24. /*
  25. * GNU Linear Programming Kit backend
  26. */
  27. #ifdef STARPU_HAVE_GLPK_H
  28. #include <glpk.h>
  29. #endif //STARPU_HAVE_GLPK_H
  30. /* returns 1/tmax, and computes in table res the nr of workers needed by each context st the system ends up in the smallest tmax*/
  31. double _lp_compute_nworkers_per_ctx(int nsched_ctxs, int ntypes_of_workers, double velocity[nsched_ctxs][ntypes_of_workers], double flops[nsched_ctxs],
  32. double res[nsched_ctxs][ntypes_of_workers], int total_nw[ntypes_of_workers]);
  33. /* returns tmax, and computes in table res the nr of workers needed by each context st the system ends up in the smallest tmax*/
  34. double _lp_get_nworkers_per_ctx(int nsched_ctxs, int ntypes_of_workers, double res[nsched_ctxs][ntypes_of_workers], int total_nw[ntypes_of_workers]);
  35. /* returns tmax of the system */
  36. double _lp_get_tmax(int nw, int *workers);
  37. /* the linear programme determins a rational number of ressources for each ctx, we round them depending on the type of ressource */
  38. void _lp_round_double_to_int(int ns, int nw, double res[ns][nw], int res_rounded[ns][nw]);
  39. /* redistribute the ressource in contexts by assigning the first x available ressources to each one */
  40. void _lp_redistribute_resources_in_ctxs(int ns, int nw, int res_rounded[ns][nw], double res[ns][nw]);
  41. /* make the first distribution of ressource in contexts by assigning the first x available ressources to each one */
  42. void _lp_distribute_resources_in_ctxs(int* sched_ctxs, int ns, int nw, int res_rounded[ns][nw], double res[ns][nw], int *workers, int nworkers);
  43. /* place resources in contexts dependig on whether they already have workers or not */
  44. void _lp_place_resources_in_ctx(int ns, int nw, double w_in_s[ns][nw], int *sched_ctxs, int *workers, unsigned do_size);
  45. /* dichotomy btw t1 & t2 */
  46. double _lp_find_tmax(double t1, double t2);
  47. #ifdef __cplusplus
  48. }
  49. #endif
  50. #endif