stack_queues.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. /* Stack queues, ready for use by schedulers */
  17. #ifndef __STACK_QUEUES_H__
  18. #define __STACK_QUEUES_H__
  19. #include <starpu.h>
  20. #include <common/config.h>
  21. #include <core/jobs.h>
  22. struct _starpu_stack_jobq
  23. {
  24. /* the actual list */
  25. struct _starpu_job_list *jobq;
  26. /* the number of tasks currently in the queue */
  27. unsigned njobs;
  28. /* the number of tasks that were processed */
  29. unsigned nprocessed;
  30. /* only meaningful if the queue is only used by a single worker */
  31. double exp_start; /* Expected start date of first task in the queue */
  32. double exp_end; /* Expected end date of last task in the queue */
  33. double exp_len; /* Expected duration of the set of tasks in the queue */
  34. };
  35. struct _starpu_stack_jobq *_starpu_create_stack(void);
  36. void _starpu_stack_push_task(struct _starpu_stack_jobq *stack, pthread_mutex_t *sched_mutex, pthread_cond_t *sched_cond, struct _starpu_job *task);
  37. struct _starpu_job *_starpu_stack_pop_task(struct _starpu_stack_jobq *stack, pthread_mutex_t *sched_mutex, int workerid);
  38. void _starpu_init_stack_queues_mechanisms(void);
  39. unsigned _starpu_get_stack_njobs(struct _starpu_stack_jobq *stack);
  40. unsigned _starpu_get_stack_nprocessed(struct _starpu_stack_jobq *stack);
  41. #endif // __STACK_QUEUES_H__