no-prio-policy.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #include <core/policies/no-prio-policy.h>
  17. /*
  18. * This is just the trivial policy where every worker use the same
  19. * JOB QUEUE.
  20. */
  21. /* the former is the actual queue, the latter some container */
  22. static struct jobq_s *jobq;
  23. static void init_no_prio_design(void)
  24. {
  25. /* there is only a single queue in that trivial design */
  26. jobq = create_fifo();
  27. init_fifo_queues_mechanisms();
  28. jobq->push_task = fifo_push_task;
  29. /* no priority in that policy, let's be stupid here */
  30. jobq->push_prio_task = fifo_push_task;
  31. jobq->pop_task = fifo_pop_task;
  32. }
  33. static struct jobq_s *func_init_central_queue(void)
  34. {
  35. /* once again, this is trivial */
  36. return jobq;
  37. }
  38. void initialize_no_prio_policy(struct machine_config_s *config,
  39. __attribute__ ((unused)) struct sched_policy_s *_policy)
  40. {
  41. setup_queues(init_no_prio_design, func_init_central_queue, config);
  42. }
  43. struct jobq_s *get_local_queue_no_prio(struct sched_policy_s *policy
  44. __attribute__ ((unused)))
  45. {
  46. /* this is trivial for that strategy :) */
  47. return jobq;
  48. }
  49. struct sched_policy_s sched_no_prio_policy = {
  50. .init_sched = initialize_no_prio_policy,
  51. .deinit_sched = NULL,
  52. .get_local_queue = get_local_queue_no_prio,
  53. .policy_name = "no-prio",
  54. .policy_description = "eager without priority"
  55. };