starpu_clusters.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2015-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), 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_CLUSTERS_UTIL_H__
  17. #define __STARPU_CLUSTERS_UTIL_H__
  18. #include <starpu_config.h>
  19. #ifdef STARPU_CLUSTER
  20. #ifdef STARPU_HAVE_HWLOC
  21. #include <hwloc.h>
  22. #ifdef __cplusplus
  23. extern "C"
  24. {
  25. #endif
  26. /**
  27. @defgroup API_Clustering_Machine Clustering Machine
  28. @{
  29. */
  30. /**
  31. Used when calling starpu_cluster_machine()
  32. */
  33. #define STARPU_CLUSTER_MIN_NB (1<<STARPU_MODE_SHIFT)
  34. /**
  35. Used when calling starpu_cluster_machine()
  36. */
  37. #define STARPU_CLUSTER_MAX_NB (2<<STARPU_MODE_SHIFT)
  38. /**
  39. Used when calling starpu_cluster_machine()
  40. */
  41. #define STARPU_CLUSTER_NB (3<<STARPU_MODE_SHIFT)
  42. /**
  43. Used when calling starpu_cluster_machine()
  44. */
  45. #define STARPU_CLUSTER_PREFERE_MIN (4<<STARPU_MODE_SHIFT)
  46. /**
  47. Used when calling starpu_cluster_machine()
  48. */
  49. #define STARPU_CLUSTER_KEEP_HOMOGENEOUS (5<<STARPU_MODE_SHIFT)
  50. /**
  51. Used when calling starpu_cluster_machine()
  52. */
  53. #define STARPU_CLUSTER_POLICY_NAME (6<<STARPU_MODE_SHIFT)
  54. /**
  55. Used when calling starpu_cluster_machine()
  56. */
  57. #define STARPU_CLUSTER_POLICY_STRUCT (7<<STARPU_MODE_SHIFT)
  58. /**
  59. Used when calling starpu_cluster_machine()
  60. */
  61. #define STARPU_CLUSTER_CREATE_FUNC (8<<STARPU_MODE_SHIFT)
  62. /**
  63. Used when calling starpu_cluster_machine()
  64. */
  65. #define STARPU_CLUSTER_CREATE_FUNC_ARG (9<<STARPU_MODE_SHIFT)
  66. /**
  67. Used when calling starpu_cluster_machine()
  68. */
  69. #define STARPU_CLUSTER_TYPE (10<<STARPU_MODE_SHIFT)
  70. /**
  71. Used when calling starpu_cluster_machine()
  72. */
  73. #define STARPU_CLUSTER_AWAKE_WORKERS (11<<STARPU_MODE_SHIFT)
  74. /**
  75. Used when calling starpu_cluster_machine()
  76. */
  77. #define STARPU_CLUSTER_PARTITION_ONE (12<<STARPU_MODE_SHIFT)
  78. /**
  79. Used when calling starpu_cluster_machine()
  80. */
  81. #define STARPU_CLUSTER_NEW (13<<STARPU_MODE_SHIFT)
  82. /**
  83. Used when calling starpu_cluster_machine()
  84. */
  85. #define STARPU_CLUSTER_NCORES (14<<STARPU_MODE_SHIFT)
  86. /**
  87. These represent the default available functions to enforce cluster
  88. use by the sub-runtime
  89. */
  90. enum starpu_cluster_types
  91. {
  92. STARPU_CLUSTER_OPENMP, /**< todo */
  93. STARPU_CLUSTER_INTEL_OPENMP_MKL, /**< todo */
  94. #ifdef STARPU_MKL
  95. STARPU_CLUSTER_GNU_OPENMP_MKL, /**< todo */
  96. #endif
  97. };
  98. struct starpu_cluster_machine;
  99. struct starpu_cluster_machine* starpu_cluster_machine(hwloc_obj_type_t cluster_level, ...);
  100. int starpu_uncluster_machine(struct starpu_cluster_machine* clusters);
  101. int starpu_cluster_print(struct starpu_cluster_machine* clusters);
  102. /** Prologue functions */
  103. void starpu_openmp_prologue(void*);
  104. #define starpu_intel_openmp_mkl_prologue starpu_openmp_prologue
  105. #ifdef STARPU_MKL
  106. void starpu_gnu_openmp_mkl_prologue(void*);
  107. #endif /* STARPU_MKL */
  108. /** @} */
  109. #ifdef __cplusplus
  110. }
  111. #endif
  112. #endif
  113. #endif
  114. #endif /* __STARPU_CLUSTERS_UTIL_H__ */