starpu_heteroprio.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2015 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 __STARPU_SCHEDULER_HETEROPRIO_H__
  17. #define __STARPU_SCHEDULER_HETEROPRIO_H__
  18. #include <starpu.h>
  19. #ifdef __cplusplus
  20. extern "C"
  21. {
  22. #endif
  23. #define STARPU_HETEROPRIO_MAX_PRIO 100
  24. /* #define STARPU_NB_TYPES 3 */
  25. /* #define STARPU_CPU_IDX 0 */
  26. /* #define STARPU_CUDA_IDX 1 */
  27. /* #define STARPU_OPENCL_IDX 2 */
  28. #define STARPU_HETEROPRIO_MAX_PREFETCH 2
  29. #if STARPU_HETEROPRIO_MAX_PREFETCH <= 0
  30. #error STARPU_HETEROPRIO_MAX_PREFETCH == 1 means no prefetch so STARPU_HETEROPRIO_MAX_PREFETCH must >= 1
  31. #endif
  32. enum starpu_heteroprio_types
  33. {
  34. // First will be zero
  35. #ifdef STARPU_USE_CPU
  36. STARPU_CPU_IDX, // = 0
  37. #endif
  38. #ifdef STARPU_USE_CUDA
  39. STARPU_CUDA_IDX,
  40. #endif
  41. #ifdef STARPU_USE_OPENCL
  42. STARPU_OPENCL_IDX,
  43. #endif
  44. #ifdef STARPU_USE_MIC
  45. STARPU_MIC_IDX,
  46. #endif
  47. #ifdef STARPU_USE_SCC
  48. STARPU_SCC_IDX,
  49. #endif
  50. // This will be the number of archs
  51. STARPU_NB_TYPES
  52. };
  53. static const unsigned starpu_heteroprio_types_to_arch[STARPU_NB_TYPES+1] =
  54. {
  55. #ifdef STARPU_USE_CPU
  56. STARPU_CPU,
  57. #endif
  58. #ifdef STARPU_USE_CUDA
  59. STARPU_CUDA,
  60. #endif
  61. #ifdef STARPU_USE_OPENCL
  62. STARPU_OPENCL,
  63. #endif
  64. #ifdef STARPU_USE_MIC
  65. STARPU_MIC,
  66. #endif
  67. #ifdef STARPU_USE_SCC
  68. STARPU_SCC,
  69. #endif
  70. 0
  71. };
  72. /** Tell how many prio there are for a given arch */
  73. void starpu_heteroprio_set_nb_prios(unsigned sched_ctx_id, enum starpu_heteroprio_types arch, unsigned max_prio);
  74. /** Set the mapping for a given arch prio=>bucket */
  75. void starpu_heteroprio_set_mapping(unsigned sched_ctx_id, enum starpu_heteroprio_types arch, unsigned source_prio, unsigned dest_bucket_id);
  76. /** Tell which arch is the faster for the tasks of a bucket (optional) */
  77. void starpu_heteroprio_set_faster_arch(unsigned sched_ctx_id, enum starpu_heteroprio_types arch, unsigned bucket_id);
  78. /** Tell how slow is a arch for the tasks of a bucket (optional) */
  79. void starpu_heteroprio_set_arch_slow_factor(unsigned sched_ctx_id, enum starpu_heteroprio_types arch, unsigned bucket_id, float slow_factor);
  80. #ifdef __cplusplus
  81. }
  82. #endif
  83. #endif /* __STARPU_SCHEDULER_HETEROPRIO_H__ */