starpu_worker.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2013 Université de Bordeaux 1
  4. * Copyright (C) 2010-2013 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. #ifndef __STARPU_WORKER_H__
  18. #define __STARPU_WORKER_H__
  19. #include <stdlib.h>
  20. #include <starpu_config.h>
  21. #ifdef STARPU_HAVE_HWLOC
  22. #include <hwloc.h>
  23. #endif
  24. #ifdef __cplusplus
  25. extern "C"
  26. {
  27. #endif
  28. enum starpu_worker_archtype
  29. {
  30. STARPU_ANY_WORKER,
  31. STARPU_CPU_WORKER,
  32. STARPU_CUDA_WORKER,
  33. STARPU_OPENCL_WORKER,
  34. STARPU_MIC_WORKER,
  35. STARPU_SCC_WORKER
  36. };
  37. struct starpu_sched_ctx_iterator
  38. {
  39. int cursor;
  40. };
  41. enum starpu_worker_collection_type
  42. {
  43. STARPU_WORKER_LIST
  44. };
  45. struct starpu_worker_collection
  46. {
  47. void *workerids;
  48. unsigned nworkers;
  49. enum starpu_worker_collection_type type;
  50. unsigned (*has_next)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it);
  51. int (*get_next)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it);
  52. int (*add)(struct starpu_worker_collection *workers, int worker);
  53. int (*remove)(struct starpu_worker_collection *workers, int worker);
  54. void (*init)(struct starpu_worker_collection *workers);
  55. void (*deinit)(struct starpu_worker_collection *workers);
  56. void (*init_iterator)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it);
  57. };
  58. unsigned starpu_worker_get_count(void);
  59. unsigned starpu_combined_worker_get_count(void);
  60. unsigned starpu_worker_is_combined_worker(int id);
  61. unsigned starpu_cpu_worker_get_count(void);
  62. unsigned starpu_cuda_worker_get_count(void);
  63. unsigned starpu_opencl_worker_get_count(void);
  64. unsigned starpu_mic_worker_get_count(void);
  65. unsigned starpu_scc_worker_get_count(void);
  66. unsigned starpu_mic_device_get_count(void);
  67. int starpu_worker_get_id(void);
  68. int starpu_combined_worker_get_id(void);
  69. int starpu_combined_worker_get_size(void);
  70. int starpu_combined_worker_get_rank(void);
  71. enum starpu_worker_archtype starpu_worker_get_type(int id);
  72. int starpu_worker_get_count_by_type(enum starpu_worker_archtype type);
  73. int starpu_worker_get_ids_by_type(enum starpu_worker_archtype type, int *workerids, int maxsize);
  74. int starpu_worker_get_by_type(enum starpu_worker_archtype type, int num);
  75. int starpu_worker_get_by_devid(enum starpu_worker_archtype type, int devid);
  76. void starpu_worker_get_name(int id, char *dst, size_t maxlen);
  77. int starpu_worker_get_devid(int id);
  78. int starpu_worker_get_mp_nodeid(int id);
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82. #endif /* __STARPU_WORKER_H__ */