sched_policy.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * StarPU
  3. * Copyright (C) INRIA 2008-2009 (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 __SCHED_POLICY_H__
  17. #define __SCHED_POLICY_H__
  18. #include <starpu.h>
  19. #include <core/mechanisms/queues.h>
  20. //#include <core/mechanisms/work_stealing_queues.h>
  21. //#include <core/mechanisms/central_queues.h>
  22. //#include <core/mechanisms/central_queues_priorities.h>
  23. #include <core/workers.h>
  24. struct machine_config_s;
  25. struct sched_policy_s {
  26. /* create all the queues */
  27. void (*init_sched)(struct machine_config_s *, struct sched_policy_s *);
  28. /* cleanup method at termination */
  29. void (*deinit_sched)(struct machine_config_s *, struct sched_policy_s *);
  30. /* anyone can request which queue it is associated to */
  31. struct jobq_s *(*get_local_queue)(struct sched_policy_s *);
  32. /* some worker may block until some activity happens in the machine */
  33. pthread_cond_t sched_activity_cond;
  34. pthread_mutex_t sched_activity_mutex;
  35. pthread_key_t local_queue_key;
  36. };
  37. struct sched_policy_s *get_sched_policy(void);
  38. void init_sched_policy(struct machine_config_s *config, struct starpu_conf *user_conf);
  39. void deinit_sched_policy(struct machine_config_s *config);
  40. //void set_local_queue(struct jobq_s *jobq);
  41. int push_task(job_t task);
  42. struct job_s *pop_task(void);
  43. struct job_s *pop_task_from_queue(struct jobq_s *queue);
  44. struct job_list_s *pop_every_task(uint32_t where);
  45. struct job_list_s * pop_every_task_from_queue(struct jobq_s *queue, uint32_t where);
  46. void wait_on_sched_event(void);
  47. #endif // __SCHED_POLICY_H__