barrier_counter.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2011 INRIA
  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. #ifndef __BARRIER_COUNTER_H__
  17. #define __BARRIER_COUNTER_H__
  18. #include <common/utils.h>
  19. #include <common/barrier.h>
  20. struct _starpu_barrier_counter
  21. {
  22. struct _starpu_barrier barrier;
  23. unsigned min_threshold;
  24. unsigned max_threshold;
  25. starpu_pthread_cond_t cond2;
  26. };
  27. int _starpu_barrier_counter_init(struct _starpu_barrier_counter *barrier_c, unsigned count);
  28. int _starpu_barrier_counter_destroy(struct _starpu_barrier_counter *barrier_c);
  29. int _starpu_barrier_counter_wait_for_empty_counter(struct _starpu_barrier_counter *barrier_c);
  30. int _starpu_barrier_counter_wait_until_counter_reaches_down_to_n(struct _starpu_barrier_counter *barrier_c, unsigned n);
  31. int _starpu_barrier_counter_wait_until_counter_reaches_up_to_n(struct _starpu_barrier_counter *barrier_c, unsigned n);
  32. int _starpu_barrier_counter_wait_for_full_counter(struct _starpu_barrier_counter *barrier_c);
  33. int _starpu_barrier_counter_decrement_until_empty_counter(struct _starpu_barrier_counter *barrier_c, double flops);
  34. int _starpu_barrier_counter_increment_until_full_counter(struct _starpu_barrier_counter *barrier_c, double flops);
  35. int _starpu_barrier_counter_increment(struct _starpu_barrier_counter *barrier_c, double flops);
  36. int _starpu_barrier_counter_check(struct _starpu_barrier_counter *barrier_c);
  37. int _starpu_barrier_counter_get_reached_start(struct _starpu_barrier_counter *barrier_c);
  38. double _starpu_barrier_counter_get_reached_flops(struct _starpu_barrier_counter *barrier_c);
  39. #endif