starpu_worker.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 __cplusplus
  22. extern "C"
  23. {
  24. #endif
  25. enum starpu_worker_archtype
  26. {
  27. STARPU_CPU_WORKER,
  28. STARPU_CUDA_WORKER,
  29. STARPU_OPENCL_WORKER,
  30. STARPU_MIC_WORKER,
  31. STARPU_SCC_WORKER,
  32. STARPU_ANY_WORKER
  33. };
  34. struct starpu_sched_ctx_iterator
  35. {
  36. int cursor;
  37. };
  38. enum starpu_worker_collection_type
  39. {
  40. STARPU_WORKER_LIST
  41. };
  42. struct starpu_worker_collection
  43. {
  44. void *workerids;
  45. unsigned nworkers;
  46. enum starpu_worker_collection_type type;
  47. unsigned (*has_next)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it);
  48. int (*get_next)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it);
  49. int (*add)(struct starpu_worker_collection *workers, int worker);
  50. int (*remove)(struct starpu_worker_collection *workers, int worker);
  51. void (*init)(struct starpu_worker_collection *workers);
  52. void (*deinit)(struct starpu_worker_collection *workers);
  53. void (*init_iterator)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it);
  54. };
  55. unsigned starpu_worker_get_count(void);
  56. unsigned starpu_combined_worker_get_count(void);
  57. unsigned starpu_worker_is_combined_worker(int id);
  58. unsigned starpu_cpu_worker_get_count(void);
  59. unsigned starpu_cuda_worker_get_count(void);
  60. unsigned starpu_opencl_worker_get_count(void);
  61. unsigned starpu_mic_worker_get_count(void);
  62. unsigned starpu_scc_worker_get_count(void);
  63. unsigned starpu_mic_device_get_count(void);
  64. int starpu_worker_get_id(void);
  65. int starpu_combined_worker_get_id(void);
  66. int starpu_combined_worker_get_size(void);
  67. int starpu_combined_worker_get_rank(void);
  68. enum starpu_worker_archtype starpu_worker_get_type(int id);
  69. int starpu_worker_get_count_by_type(enum starpu_worker_archtype type);
  70. int starpu_worker_get_ids_by_type(enum starpu_worker_archtype type, int *workerids, int maxsize);
  71. int starpu_worker_get_by_type(enum starpu_worker_archtype type, int num);
  72. int starpu_worker_get_by_devid(enum starpu_worker_archtype type, int devid);
  73. void starpu_worker_get_name(int id, char *dst, size_t maxlen);
  74. int starpu_worker_get_devid(int id);
  75. int starpu_worker_get_mp_nodeid(int id);
  76. int starpu_worker_get_nsched_ctxs(int workerid);
  77. #ifdef __cplusplus
  78. }
  79. #endif
  80. #endif /* __STARPU_WORKER_H__ */