starpu_heteroprio.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2015-2017 Inria
  4. * Copyright (C) 2015,2017 CNRS
  5. * Copyright (C) 2015-2017 Université de Bordeaux
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. #ifndef __STARPU_SCHEDULER_HETEROPRIO_H__
  19. #define __STARPU_SCHEDULER_HETEROPRIO_H__
  20. #include <starpu.h>
  21. #ifdef __cplusplus
  22. extern "C"
  23. {
  24. #endif
  25. #define STARPU_HETEROPRIO_MAX_PRIO 100
  26. /* #define STARPU_NB_TYPES 3 */
  27. /* #define STARPU_CPU_IDX 0 */
  28. /* #define STARPU_CUDA_IDX 1 */
  29. /* #define STARPU_OPENCL_IDX 2 */
  30. #define STARPU_HETEROPRIO_MAX_PREFETCH 2
  31. #if STARPU_HETEROPRIO_MAX_PREFETCH <= 0
  32. #error STARPU_HETEROPRIO_MAX_PREFETCH == 1 means no prefetch so STARPU_HETEROPRIO_MAX_PREFETCH must >= 1
  33. #endif
  34. enum starpu_heteroprio_types
  35. {
  36. // First will be zero
  37. STARPU_CPU_IDX, // = 0
  38. STARPU_CUDA_IDX,
  39. STARPU_OPENCL_IDX,
  40. STARPU_MIC_IDX,
  41. STARPU_SCC_IDX,
  42. STARPU_MPI_MS_IDX,
  43. // This will be the number of archs
  44. STARPU_NB_TYPES
  45. };
  46. static const unsigned starpu_heteroprio_types_to_arch[STARPU_NB_TYPES+1] =
  47. {
  48. STARPU_CPU,
  49. STARPU_CUDA,
  50. STARPU_OPENCL,
  51. STARPU_MIC,
  52. STARPU_SCC,
  53. STARPU_MPI_MS,
  54. 0
  55. };
  56. /** Tell how many prio there are for a given arch */
  57. void starpu_heteroprio_set_nb_prios(unsigned sched_ctx_id, enum starpu_heteroprio_types arch, unsigned max_prio);
  58. /** Set the mapping for a given arch prio=>bucket */
  59. void starpu_heteroprio_set_mapping(unsigned sched_ctx_id, enum starpu_heteroprio_types arch, unsigned source_prio, unsigned dest_bucket_id);
  60. /** Tell which arch is the faster for the tasks of a bucket (optional) */
  61. void starpu_heteroprio_set_faster_arch(unsigned sched_ctx_id, enum starpu_heteroprio_types arch, unsigned bucket_id);
  62. /** Tell how slow is a arch for the tasks of a bucket (optional) */
  63. void starpu_heteroprio_set_arch_slow_factor(unsigned sched_ctx_id, enum starpu_heteroprio_types arch, unsigned bucket_id, float slow_factor);
  64. #ifdef __cplusplus
  65. }
  66. #endif
  67. #endif /* __STARPU_SCHEDULER_HETEROPRIO_H__ */