deque_queues.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2011 Université de Bordeaux 1
  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. /* Deque queues, ready for use by schedulers */
  17. #ifndef __DEQUE_QUEUES_H__
  18. #define __DEQUE_QUEUES_H__
  19. #include <starpu.h>
  20. #include <common/config.h>
  21. #include <core/jobs.h>
  22. struct starpu_deque_jobq_s {
  23. /* the actual list */
  24. starpu_job_list_t jobq;
  25. /* the number of tasks currently in the queue */
  26. unsigned njobs;
  27. /* the number of tasks that were processed */
  28. unsigned nprocessed;
  29. /* only meaningful if the queue is only used by a single worker */
  30. double exp_start; /* Expected start date of first task in the queue */
  31. double exp_end; /* Expected end date of last task in the queue */
  32. double exp_len; /* Expected duration of the set of tasks in the queue */
  33. };
  34. struct starpu_deque_jobq_s *_starpu_create_deque(void);
  35. void _starpu_destroy_deque(struct starpu_deque_jobq_s *deque);
  36. struct starpu_task *_starpu_deque_pop_task(struct starpu_deque_jobq_s *deque_queue, int workerid);
  37. struct starpu_job_list_s *_starpu_deque_pop_every_task(struct starpu_deque_jobq_s *deque_queue, pthread_mutex_t *sched_mutex, int workerid);
  38. unsigned _starpu_get_deque_njobs(struct starpu_deque_jobq_s *deque_queue);
  39. unsigned _starpu_get_deque_nprocessed(struct starpu_deque_jobq_s *deque_queue);
  40. #endif // __DEQUE_QUEUES_H__