starpu_scheduler.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * StarPU
  3. * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file)
  4. *
  5. * This program 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. * This program 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_H__
  17. #define __STARPU_SCHEDULER_H__
  18. #include <starpu.h>
  19. #include <starpu_config.h>
  20. #ifdef STARPU_HAVE_HWLOC
  21. #include <hwloc.h>
  22. #endif
  23. struct starpu_machine_topology_s {
  24. unsigned nworkers;
  25. #ifdef STARPU_HAVE_HWLOC
  26. hwloc_topology_t hwtopology;
  27. #endif
  28. unsigned nhwcpus;
  29. unsigned nhwcudagpus;
  30. unsigned nhwopenclgpus;
  31. unsigned ncpus;
  32. unsigned ncudagpus;
  33. unsigned nopenclgpus;
  34. unsigned ngordon_spus;
  35. /* Where to bind workers ? */
  36. unsigned workers_bindid[STARPU_NMAXWORKERS];
  37. /* Which GPU(s) do we use for CUDA ? */
  38. unsigned workers_cuda_gpuid[STARPU_NMAXWORKERS];
  39. /* Which GPU(s) do we use for OpenCL ? */
  40. unsigned workers_opencl_gpuid[STARPU_NMAXWORKERS];
  41. };
  42. struct starpu_sched_policy_s {
  43. /* create all the queues */
  44. void (*init_sched)(struct starpu_machine_topology_s *, struct starpu_sched_policy_s *);
  45. /* cleanup method at termination */
  46. void (*deinit_sched)(struct starpu_machine_topology_s *, struct starpu_sched_policy_s *);
  47. /* some methods to manipulate the previous queue */
  48. int (*push_task)(struct starpu_task *);
  49. int (*push_prio_task)(struct starpu_task *);
  50. struct starpu_task *(*pop_task)(void);
  51. /* returns the number of tasks that were retrieved
  52. * the function is reponsible for allocating the output but the driver
  53. * has to free it
  54. *
  55. * NB : this function is non blocking
  56. * */
  57. struct starpu_task_list *(*pop_every_task)(uint32_t where);
  58. /* name of the policy (optionnal) */
  59. const char *policy_name;
  60. /* description of the policy (optionnal) */
  61. const char *policy_description;
  62. };
  63. #endif // __STARPU_SCHEDULER_H__