StarPU Internal Handbook
workers.h
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2  *
3  * Copyright (C) 2008-2023 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
4  * Copyright (C) 2013 Thibaut Lambert
5  * Copyright (C) 2016 Uppsala University
6  *
7  * StarPU is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation; either version 2.1 of the License, or (at
10  * your option) any later version.
11  *
12  * StarPU is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  *
16  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
17  */
18 
19 #ifndef __WORKERS_H__
20 #define __WORKERS_H__
21 
23 /* @{ */
24 
25 #include <limits.h>
26 
27 #include <starpu.h>
28 #include <common/config.h>
29 #include <common/timing.h>
30 #include <common/fxt.h>
31 #include <common/thread.h>
32 #include <common/utils.h>
33 #include <core/jobs.h>
35 #include <core/sched_policy.h>
36 #include <core/topology.h>
37 #include <core/errorcheck.h>
38 #include <core/sched_ctx.h>
39 #include <core/sched_ctx_list.h>
40 #include <core/simgrid.h>
41 #ifdef STARPU_HAVE_HWLOC
42 #include <hwloc.h>
43 #endif
44 #include <common/knobs.h>
45 
46 #include <core/drivers.h>
48 #include <drivers/hip/driver_hip.h>
50 
51 #ifdef STARPU_USE_MPI_MASTER_SLAVE
53 #endif
54 
55 #ifdef STARPU_USE_TCPIP_MASTER_SLAVE
56 #include <drivers/tcpip/driver_tcpip_source.h>
57 #endif
58 
59 #include <drivers/cpu/driver_cpu.h>
60 
61 #include <datawizard/datawizard.h>
62 #include <datawizard/malloc.h>
63 
64 #pragma GCC visibility push(hidden)
65 
66 #define STARPU_MAX_PIPELINE 4
67 
68 struct mc_cache_entry;
70 {
71  /*
72  * used by memalloc.c
73  */
75  /* Note: handle header lock is always taken before this (normal add/remove case) */
77 
81  struct _starpu_mem_chunk_list mc_list;
84  struct _starpu_mem_chunk *mc_dirty_head;
85  /* TODO: introduce head of data to be evicted */
89  unsigned mc_nb, mc_clean_nb;
90 
91  struct mc_cache_entry *mc_cache;
92  int mc_cache_nb;
93  starpu_ssize_t mc_cache_size;
94 
96  unsigned tidying;
98  unsigned reclaiming;
99 
104 
106  unsigned evictable;
107 
108  /*
109  * used by data_request.c
110  */
112  struct _starpu_data_request_prio_list data_requests[STARPU_MAXNODES][2];
113  struct _starpu_data_request_prio_list prefetch_requests[STARPU_MAXNODES][2]; /* Contains both task_prefetch and prefetch */
114  struct _starpu_data_request_prio_list idle_requests[STARPU_MAXNODES][2];
115  starpu_pthread_mutex_t data_requests_list_mutex[STARPU_MAXNODES][2];
116 
118  struct _starpu_data_request_prio_list data_requests_pending[STARPU_MAXNODES][2];
119  unsigned data_requests_npending[STARPU_MAXNODES][2];
120  starpu_pthread_mutex_t data_requests_pending_list_mutex[STARPU_MAXNODES][2];
121 
122  /*
123  * used by malloc.c
124  */
125  int malloc_on_node_default_flags;
127  struct _starpu_chunk_list chunks;
131  starpu_pthread_mutex_t chunk_mutex;
132 
133  /*
134  * used by memory_manager.c
135  */
136  size_t global_size;
137  size_t used_size;
138 
139  /* This is used as an optimization to avoid to wake up allocating threads for
140  * each and every deallocation, only to find that there is still not enough
141  * room. */
142  /* Minimum amount being waited for */
143  size_t waiting_size;
144 
145  starpu_pthread_mutex_t lock_nodes;
146  starpu_pthread_cond_t cond_nodes;
147 
150  char padding[STARPU_CACHELINE_SIZE];
151 };
152 
153 struct _starpu_ctx_change_list;
155 LIST_TYPE(_starpu_worker,
156  struct _starpu_machine_config *config;
157  starpu_pthread_mutex_t mutex;
158  enum starpu_worker_archtype arch;
159  uint32_t worker_mask;
160  struct starpu_perfmodel_arch perf_arch;
161  starpu_pthread_t worker_thread;
162  unsigned devid;
163  unsigned devnum;
164  unsigned subworkerid;
165  int bindid;
166  int workerid;
170  starpu_pthread_cond_t started_cond;
171  starpu_pthread_cond_t ready_cond;
172  unsigned memory_node;
173  unsigned numa_memory_node;
178  starpu_pthread_cond_t sched_cond;
179  starpu_pthread_mutex_t sched_mutex;
181 #ifdef STARPU_SPINLOCK_CHECK
182  const char *relax_on_file;
183  int relax_on_line;
184  const char *relax_on_func;
185  const char *relax_off_file;
186  int relax_off_line;
187  const char *relax_off_func;
188 #endif
206  starpu_pthread_t thread_changing_ctx;
214  struct _starpu_ctx_change_list ctx_change_list;
215  struct starpu_task_prio_list local_tasks;
216  struct starpu_task **local_ordered_tasks;
220  struct starpu_task *current_task;
221  struct starpu_task *current_tasks[STARPU_MAX_PIPELINE];
222 #ifdef STARPU_SIMGRID
223  starpu_pthread_wait_t wait;
224 #endif
225 
226  struct timespec cl_start;
227  struct timespec cl_expend;
228  struct timespec cl_end;
229  unsigned char first_task;
230  unsigned char ntasks;
231  unsigned char pipeline_length;
232  unsigned char pipeline_stuck;
235  unsigned worker_is_running;
236  unsigned worker_is_initialized;
237  unsigned wait_for_worker_initialization;
238  enum _starpu_worker_status status;
239  unsigned state_keep_awake;
240  char name[128];
241  char short_name[32];
242  unsigned run_by_starpu;
243  const struct _starpu_driver_ops *driver_ops;
244 
245  struct _starpu_sched_ctx_list *sched_ctx_list;
246  int tmp_sched_ctx;
247  unsigned nsched_ctxs;
248  struct _starpu_barrier_counter tasks_barrier;
250  unsigned has_prev_init;
252  unsigned removed_from_ctx[STARPU_NMAX_SCHED_CTXS+1];
253 
254  unsigned spinning_backoff ;
258  struct starpu_task *task_transferring;
264  unsigned shares_tasks_lists[STARPU_NMAX_SCHED_CTXS+1];
265 
266  unsigned poped_in_ctx[STARPU_NMAX_SCHED_CTXS+1];
272  unsigned reverse_phase[2];
273 
274  unsigned pop_ctx_priority;
277  struct _starpu_sched_ctx *stream_ctx;
278 
279 #ifdef __GLIBC__
280  cpu_set_t cpu_set;
281 #endif /* __GLIBC__ */
282 #ifdef STARPU_HAVE_HWLOC
283  hwloc_bitmap_t hwloc_cpu_set;
284  hwloc_obj_t hwloc_obj;
285 #endif
286 
287  struct starpu_profiling_worker_info profiling_info;
288  /* TODO: rather use rwlock? */
289  starpu_pthread_mutex_t profiling_info_mutex;
290 
291  /* In case the worker is still sleeping when the user request profiling info,
292  * we need to account for the time elasped while sleeping. */
293  unsigned profiling_registered_start[STATUS_INDEX_NR];
294  struct timespec profiling_registered_start_date[STATUS_INDEX_NR];
295  enum _starpu_worker_status profiling_status;
296  struct timespec profiling_status_start_date;
297 
298  struct starpu_perf_counter_sample perf_counter_sample;
299  int64_t __w_total_executed__value;
300  double __w_cumul_execution_time__value;
301 
302  int enable_knob;
303  int bindid_requested;
304 
307  char padding[STARPU_CACHELINE_SIZE];
308 );
309 
311 {
312  struct starpu_perfmodel_arch perf_arch;
313  uint32_t worker_mask;
314  int worker_size;
315  unsigned memory_node;
316  int combined_workerid[STARPU_NMAXWORKERS];
317 #ifdef STARPU_USE_MP
318  int count;
319  starpu_pthread_mutex_t count_mutex;
320 #endif
321 
322 #ifdef __GLIBC__
323  cpu_set_t cpu_set;
324 #endif /* __GLIBC__ */
325 #ifdef STARPU_HAVE_HWLOC
326  hwloc_bitmap_t hwloc_cpu_set;
327 #endif
328 
331  char padding[STARPU_CACHELINE_SIZE];
332 };
333 
339 {
340  starpu_pthread_mutex_t mutex;
341  starpu_pthread_t worker_thread;
342  unsigned nworkers;
343  unsigned started;
344  void *retval;
345  struct _starpu_worker *workers;
346  starpu_pthread_cond_t ready_cond;
347  unsigned set_is_initialized;
348  unsigned wait_for_set_initialization;
349 };
350 
352 {
354  unsigned nworkers;
355 
358 
359  unsigned nsched_ctxs;
360 
361 #ifdef STARPU_HAVE_HWLOC
363  hwloc_topology_t hwtopology;
364  hwloc_bitmap_t log_cpuset;
365  hwloc_bitmap_t log_coreset;
366 #endif
368  struct starpu_tree *tree;
369 
373  unsigned nhwpus;
374 
378  unsigned firstusedpu;
379 
383  unsigned nusedpus;
384 
392  unsigned nhwworker[STARPU_NARCH][STARPU_NMAXDEVS];
393 
397 
400  unsigned nworker[STARPU_NARCH][STARPU_NMAXDEVS];
401 
404  int devid[STARPU_NARCH][STARPU_NMAXDEVS];
405 
410 
415 
424 
429  unsigned workers_nbindid;
430 
438 };
439 
441 {
442  struct _starpu_machine_topology topology;
443 
444 #ifdef STARPU_HAVE_HWLOC
445  int cpu_depth;
446  int pu_depth;
447 #endif
448 
451  char currently_bound[STARPU_NMAXWORKERS];
452  char currently_shared[STARPU_NMAXWORKERS];
453 
456 
459 
462 
464  char padding1[STARPU_CACHELINE_SIZE];
465 
469 
472 
475  struct _starpu_combined_worker combined_workers[STARPU_NMAX_COMBINEDWORKERS];
476 
477  starpu_pthread_mutex_t submitted_mutex;
478 
480  char padding2[STARPU_CACHELINE_SIZE];
481 
483  struct
484  {
485  int *workerids;
486  unsigned nworkers;
488  unsigned nbindid;
493  uint32_t worker_mask;
494 
496  struct starpu_conf conf;
497 
499  unsigned running;
500 
501  int disable_kernels;
502 
506 
508  struct _starpu_sched_ctx sched_ctxs[STARPU_NMAX_SCHED_CTXS+1];
509 
511  unsigned submitting;
512 
513  int watchdog_ok;
514 
517 };
518 
520 
523 {
524  const char *name_upper;
525  const char *name_var;
526  const char *name_lower;
528  double alpha;
531  void *(*run_worker)(void *);
532  void (*init_worker_binding)(struct _starpu_machine_config *config, int no_mp_config STARPU_ATTRIBUTE_UNUSED, struct _starpu_worker *workerarg);
533  void (*init_worker_memory)(struct _starpu_machine_config *config, int no_mp_config STARPU_ATTRIBUTE_UNUSED, struct _starpu_worker *workerarg);
534 #ifdef STARPU_HAVE_HWLOC
535  hwloc_obj_t (*get_hwloc_obj)(hwloc_topology_t topology, int devid);
537 #endif
538 };
539 
541 extern struct _starpu_driver_info starpu_driver_info[STARPU_NARCH];
542 
543 void _starpu_driver_info_register(enum starpu_worker_archtype archtype, const struct _starpu_driver_info *info);
544 
547 {
548  const char *name_upper;
550  const struct _starpu_node_ops *ops;
551 };
552 
554 extern struct _starpu_memory_driver_info starpu_memory_driver_info[STARPU_MAX_RAM+1];
555 
556 void _starpu_memory_driver_info_register(enum starpu_node_kind kind, const struct _starpu_memory_driver_info *info);
557 
558 extern int _starpu_worker_parallel_blocks;
559 
560 extern struct _starpu_machine_config _starpu_config;
561 extern int _starpu_keys_initialized;
562 extern starpu_pthread_key_t _starpu_worker_key;
563 extern starpu_pthread_key_t _starpu_worker_set_key;
564 
565 void _starpu_set_catch_signals(int do_catch_signal);
566 
568 void _starpu_set_argc_argv(int *argc, char ***argv);
569 int *_starpu_get_argc();
570 char ***_starpu_get_argv();
571 
573 void _starpu_conf_check_environment(struct starpu_conf *conf);
574 
576 void _starpu_may_pause(void);
577 
579 static inline unsigned _starpu_machine_is_running(void)
580 {
581  unsigned ret;
582  /* running is just protected by a memory barrier */
583  STARPU_RMB();
584 
585  ANNOTATE_HAPPENS_AFTER(&_starpu_config.running);
586  ret = _starpu_config.running;
587  ANNOTATE_HAPPENS_BEFORE(&_starpu_config.running);
588  return ret;
589 }
590 
591 
593 void _starpu_worker_init(struct _starpu_worker *workerarg, struct _starpu_machine_config *pconfig);
594 
596 uint32_t _starpu_worker_exists(struct starpu_task *) STARPU_ATTRIBUTE_VISIBILITY_DEFAULT;
597 
599 uint32_t _starpu_can_submit_ms_task(void);
600 
602 uint32_t _starpu_can_submit_cuda_task(void);
603 
605 uint32_t _starpu_can_submit_hip_task(void);
606 
608 uint32_t _starpu_can_submit_cpu_task(void);
609 
611 uint32_t _starpu_can_submit_opencl_task(void);
612 
615 unsigned _starpu_worker_can_block(unsigned memnode, struct _starpu_worker *worker);
616 
618 void _starpu_driver_start(struct _starpu_worker *worker, enum starpu_worker_archtype archtype, unsigned sync);
620 void _starpu_worker_start(struct _starpu_worker *worker, enum starpu_worker_archtype archtype, unsigned sync);
621 
622 static inline unsigned _starpu_worker_get_count(void)
623 {
624  return _starpu_config.topology.nworkers;
625 }
626 #define starpu_worker_get_count _starpu_worker_get_count
627 
631 static inline void _starpu_set_local_worker_key(struct _starpu_worker *worker)
632 {
633  STARPU_ASSERT(_starpu_keys_initialized);
634  STARPU_PTHREAD_SETSPECIFIC(_starpu_worker_key, worker);
635 }
636 
639 static inline struct _starpu_worker *_starpu_get_local_worker_key(void)
640 {
641  if (!_starpu_keys_initialized)
642  return NULL;
643  return (struct _starpu_worker *) STARPU_PTHREAD_GETSPECIFIC(_starpu_worker_key);
644 }
645 
649 static inline void _starpu_set_local_worker_set_key(struct _starpu_worker_set *worker)
650 {
651  STARPU_ASSERT(_starpu_keys_initialized);
652  STARPU_PTHREAD_SETSPECIFIC(_starpu_worker_set_key, worker);
653 }
654 
657 static inline struct _starpu_worker_set *_starpu_get_local_worker_set_key(void)
658 {
659  if (!_starpu_keys_initialized)
660  return NULL;
661  return (struct _starpu_worker_set *) STARPU_PTHREAD_GETSPECIFIC(_starpu_worker_set_key);
662 }
663 
666 static inline struct _starpu_worker *_starpu_get_worker_struct(unsigned id)
667 {
668  STARPU_ASSERT(id < STARPU_NMAXWORKERS);
669  return &_starpu_config.workers[id];
670 }
671 
674 static inline struct _starpu_node *_starpu_get_node_struct(unsigned id)
675 {
676  STARPU_ASSERT(id < STARPU_MAXNODES);
677  return &_starpu_config.nodes[id];
678 }
679 
682 static inline struct _starpu_sched_ctx *_starpu_get_sched_ctx_struct(unsigned id)
683 {
684  return (id > STARPU_NMAX_SCHED_CTXS) ? NULL : &_starpu_config.sched_ctxs[id];
685 }
686 
687 struct _starpu_combined_worker *_starpu_get_combined_worker_struct(unsigned id);
688 
691 static inline struct _starpu_machine_config *_starpu_get_machine_config(void)
692 {
693  return &_starpu_config;
694 }
695 
697 static inline int _starpu_get_disable_kernels(void)
698 {
699  return _starpu_config.disable_kernels;
700 }
701 
703 static inline enum _starpu_worker_status _starpu_worker_get_status(int workerid)
704 {
705  return _starpu_config.workers[workerid].status;
706 }
707 
710 static inline void _starpu_worker_add_status(int workerid, enum _starpu_worker_status_index status)
711 {
712  STARPU_ASSERT(!(_starpu_config.workers[workerid].status & (1 << status)));
713  if (starpu_profiling_status_get())
714  _starpu_worker_start_state(workerid, status, NULL);
715  _starpu_config.workers[workerid].status |= (1 << status);
716 }
717 
720 static inline void _starpu_worker_clear_status(int workerid, enum _starpu_worker_status_index status)
721 {
722  STARPU_ASSERT((_starpu_config.workers[workerid].status & (1 << status)));
723  if (starpu_profiling_status_get())
724  _starpu_worker_stop_state(workerid, status, NULL);
725  _starpu_config.workers[workerid].status &= ~(1 << status);
726 }
727 
729 static inline struct _starpu_sched_ctx* _starpu_get_initial_sched_ctx(void)
730 {
731  return &_starpu_config.sched_ctxs[STARPU_GLOBAL_SCHED_CTX];
732 }
733 
734 int _starpu_worker_get_nids_by_type(enum starpu_worker_archtype type, int *workerids, int maxsize);
735 
740 int _starpu_worker_get_nids_ctx_free_by_type(enum starpu_worker_archtype type, int *workerids, int maxsize);
741 
742 static inline unsigned _starpu_worker_mutex_is_sched_mutex(int workerid, starpu_pthread_mutex_t *mutex)
743 {
744  struct _starpu_worker *w = _starpu_get_worker_struct(workerid);
745  return &w->sched_mutex == mutex;
746 }
747 
748 static inline int _starpu_worker_get_nsched_ctxs(int workerid)
749 {
750  return _starpu_config.workers[workerid].nsched_ctxs;
751 }
752 
754 static inline unsigned _starpu_get_nsched_ctxs(void)
755 {
756  /* topology.nsched_ctxs may be increased asynchronously in sched_ctx_create */
757  STARPU_RMB();
758  return _starpu_config.topology.nsched_ctxs;
759 }
760 
762 static inline int _starpu_worker_get_id(void)
763 {
764  struct _starpu_worker * worker;
765 
766  worker = _starpu_get_local_worker_key();
767  if (worker)
768  {
769  return worker->workerid;
770  }
771  else
772  {
773  /* there is no worker associated to that thread, perhaps it is
774  * a thread from the application or this is some SPU worker */
775  return -1;
776  }
777 }
778 #define starpu_worker_get_id _starpu_worker_get_id
779 
782 static inline unsigned __starpu_worker_get_id_check(const char *f, int l)
783 {
784  (void) l;
785  (void) f;
786  int id = starpu_worker_get_id();
787  STARPU_ASSERT_MSG(id>=0, "%s:%d Cannot be called from outside a worker\n", f, l);
788  return id;
789 }
790 #define _starpu_worker_get_id_check(f,l) __starpu_worker_get_id_check(f,l)
791 
792 void _starpu_worker_set_stream_ctx(unsigned workerid, struct _starpu_sched_ctx *sched_ctx);
793 
794 struct _starpu_sched_ctx* _starpu_worker_get_ctx_stream(unsigned stream_workerid);
795 
801 static inline void _starpu_worker_request_blocking_in_parallel(struct _starpu_worker * const worker)
802 {
803  _starpu_worker_parallel_blocks = 1;
804  /* flush pending requests to start on a fresh transaction epoch */
805  while (worker->state_unblock_in_parallel_req)
806  STARPU_PTHREAD_COND_WAIT(&worker->sched_cond, &worker->sched_mutex);
807 
808  /* announce blocking intent */
809  STARPU_ASSERT(worker->block_in_parallel_ref_count < UINT_MAX);
810  worker->block_in_parallel_ref_count++;
811 
812  if (worker->block_in_parallel_ref_count == 1)
813  {
814  /* only the transition from 0 to 1 triggers the block_in_parallel_req */
815 
816  STARPU_ASSERT(!worker->state_blocked_in_parallel);
817  STARPU_ASSERT(!worker->state_block_in_parallel_req);
818  STARPU_ASSERT(!worker->state_block_in_parallel_ack);
819  STARPU_ASSERT(!worker->state_unblock_in_parallel_req);
820  STARPU_ASSERT(!worker->state_unblock_in_parallel_ack);
821 
822  /* trigger the block_in_parallel_req */
823  worker->state_block_in_parallel_req = 1;
824  STARPU_PTHREAD_COND_BROADCAST(&worker->sched_cond);
825 #ifdef STARPU_SIMGRID
826  starpu_pthread_queue_broadcast(&_starpu_simgrid_task_queue[worker->workerid]);
827 #endif
828 
829  /* wait for block_in_parallel_req to be processed */
830  while (!worker->state_block_in_parallel_ack)
831  STARPU_PTHREAD_COND_WAIT(&worker->sched_cond, &worker->sched_mutex);
832 
833  STARPU_ASSERT(worker->block_in_parallel_ref_count >= 1);
834  STARPU_ASSERT(worker->state_block_in_parallel_req);
835  STARPU_ASSERT(worker->state_blocked_in_parallel);
836 
837  /* reset block_in_parallel_req state flags */
838  worker->state_block_in_parallel_req = 0;
839  worker->state_block_in_parallel_ack = 0;
840 
841  /* broadcast block_in_parallel_req state flags reset */
842  STARPU_PTHREAD_COND_BROADCAST(&worker->sched_cond);
843  }
844 }
845 
850 static inline void _starpu_worker_request_unblocking_in_parallel(struct _starpu_worker * const worker)
851 {
852  /* flush pending requests to start on a fresh transaction epoch */
853  while (worker->state_block_in_parallel_req)
854  STARPU_PTHREAD_COND_WAIT(&worker->sched_cond, &worker->sched_mutex);
855 
856  /* unblocking may be requested unconditionnally
857  * thus, check is unblocking is really needed */
858  if (worker->state_blocked_in_parallel)
859  {
860  if (worker->block_in_parallel_ref_count == 1)
861  {
862  /* only the transition from 1 to 0 triggers the unblock_in_parallel_req */
863 
864  STARPU_ASSERT(!worker->state_block_in_parallel_req);
865  STARPU_ASSERT(!worker->state_block_in_parallel_ack);
866  STARPU_ASSERT(!worker->state_unblock_in_parallel_req);
867  STARPU_ASSERT(!worker->state_unblock_in_parallel_ack);
868 
869  /* trigger the unblock_in_parallel_req */
870  worker->state_unblock_in_parallel_req = 1;
871  STARPU_PTHREAD_COND_BROADCAST(&worker->sched_cond);
872 
873  /* wait for the unblock_in_parallel_req to be processed */
874  while (!worker->state_unblock_in_parallel_ack)
875  STARPU_PTHREAD_COND_WAIT(&worker->sched_cond, &worker->sched_mutex);
876 
877  STARPU_ASSERT(worker->state_unblock_in_parallel_req);
878  STARPU_ASSERT(!worker->state_blocked_in_parallel);
879 
880  /* reset unblock_in_parallel_req state flags */
881  worker->state_unblock_in_parallel_req = 0;
882  worker->state_unblock_in_parallel_ack = 0;
883 
884  /* broadcast unblock_in_parallel_req state flags reset */
885  STARPU_PTHREAD_COND_BROADCAST(&worker->sched_cond);
886  }
887 
888  /* announce unblocking complete */
889  STARPU_ASSERT(worker->block_in_parallel_ref_count > 0);
890  worker->block_in_parallel_ref_count--;
891  }
892 }
893 
899 static inline void _starpu_worker_process_block_in_parallel_requests(struct _starpu_worker * const worker)
900 {
901  while (worker->state_block_in_parallel_req)
902  {
903  STARPU_ASSERT(!worker->state_blocked_in_parallel);
904  STARPU_ASSERT(!worker->state_block_in_parallel_ack);
905  STARPU_ASSERT(!worker->state_unblock_in_parallel_req);
906  STARPU_ASSERT(!worker->state_unblock_in_parallel_ack);
907  STARPU_ASSERT(worker->block_in_parallel_ref_count > 0);
908 
909  /* enter effective blocked state */
910  worker->state_blocked_in_parallel = 1;
911 
912  /* notify block_in_parallel_req processing */
913  worker->state_block_in_parallel_ack = 1;
914  STARPU_PTHREAD_COND_BROADCAST(&worker->sched_cond);
915 
916  /* block */
917  while (!worker->state_unblock_in_parallel_req)
918  STARPU_PTHREAD_COND_WAIT(&worker->sched_cond, &worker->sched_mutex);
919 
920  STARPU_ASSERT(worker->state_blocked_in_parallel);
921  STARPU_ASSERT(!worker->state_block_in_parallel_req);
922  STARPU_ASSERT(!worker->state_block_in_parallel_ack);
923  STARPU_ASSERT(!worker->state_unblock_in_parallel_ack);
924  STARPU_ASSERT(worker->block_in_parallel_ref_count > 0);
925 
926  /* leave effective blocked state */
927  worker->state_blocked_in_parallel = 0;
928 
929  /* notify unblock_in_parallel_req processing */
930  worker->state_unblock_in_parallel_ack = 1;
931  STARPU_PTHREAD_COND_BROADCAST(&worker->sched_cond);
932  }
933 }
934 
935 #ifdef STARPU_SPINLOCK_CHECK
936 #define _starpu_worker_enter_sched_op(worker) __starpu_worker_enter_sched_op((worker), __FILE__, __LINE__, __starpu_func__)
937 static inline void __starpu_worker_enter_sched_op(struct _starpu_worker * const worker, const char*file, int line, const char* func)
938 #else
955 static inline void _starpu_worker_enter_sched_op(struct _starpu_worker * const worker)
956 #endif
957 {
958  STARPU_ASSERT(!worker->state_sched_op_pending);
960  {
961  /* process pending block requests before entering a sched_op region */
962  _starpu_worker_process_block_in_parallel_requests(worker);
963  while (worker->state_changing_ctx_notice)
964  {
965  STARPU_PTHREAD_COND_WAIT(&worker->sched_cond, &worker->sched_mutex);
966 
967  /* new block requests may have been triggered during the wait,
968  * need to check again */
969  _starpu_worker_process_block_in_parallel_requests(worker);
970  }
971  }
972  else
973  {
974  /* if someone observed the worker state since the last call, postpone block request
975  * processing for one sched_op turn more, because the observer will not have seen
976  * new block requests between its observation and now.
977  *
978  * however, the worker still has to wait for context change operations to complete
979  * before entering sched_op again*/
980  while (worker->state_changing_ctx_notice)
981  {
982  STARPU_PTHREAD_COND_WAIT(&worker->sched_cond, &worker->sched_mutex);
983  }
984  }
985 
986  /* no block request and no ctx change ahead,
987  * enter sched_op */
988  worker->state_sched_op_pending = 1;
990  worker->state_relax_refcnt = 0;
991 #ifdef STARPU_SPINLOCK_CHECK
992  worker->relax_on_file = file;
993  worker->relax_on_line = line;
994  worker->relax_on_func = func;
995 #endif
996 }
997 
999 
1000 #ifdef STARPU_SPINLOCK_CHECK
1001 #define _starpu_worker_leave_sched_op(worker) __starpu_worker_leave_sched_op((worker), __FILE__, __LINE__, __starpu_func__)
1002 static inline void __starpu_worker_leave_sched_op(struct _starpu_worker * const worker, const char*file, int line, const char* func)
1003 #else
1008 static inline void _starpu_worker_leave_sched_op(struct _starpu_worker * const worker)
1009 #endif
1010 {
1011  STARPU_ASSERT(worker->state_sched_op_pending);
1012  worker->state_relax_refcnt = 1;
1013 #ifdef STARPU_SPINLOCK_CHECK
1014  worker->relax_off_file = file;
1015  worker->relax_off_line = line;
1016  worker->relax_off_func = func;
1017 #endif
1018  worker->state_sched_op_pending = 0;
1019  STARPU_PTHREAD_COND_BROADCAST(&worker->sched_cond);
1021 }
1022 
1023 static inline int _starpu_worker_sched_op_pending(void)
1024 {
1025  int workerid = starpu_worker_get_id();
1026  if (workerid == -1)
1027  return 0;
1028  struct _starpu_worker *worker = _starpu_get_worker_struct(workerid);
1029  STARPU_ASSERT(worker != NULL);
1030  return worker->state_sched_op_pending;
1031 }
1032 
1042 static inline void _starpu_worker_enter_changing_ctx_op(struct _starpu_worker * const worker)
1043 {
1044  STARPU_ASSERT(!starpu_pthread_equal(worker->thread_changing_ctx, starpu_pthread_self()));
1045  /* flush pending requests to start on a fresh transaction epoch */
1046  while (worker->state_changing_ctx_notice)
1047  STARPU_PTHREAD_COND_WAIT(&worker->sched_cond, &worker->sched_mutex);
1048 
1049  /* announce changing_ctx intent
1050  *
1051  * - an already started sched_op is allowed to complete
1052  * - no new sched_op may be started
1053  */
1054  worker->state_changing_ctx_notice = 1;
1055 
1056  worker->thread_changing_ctx = starpu_pthread_self();
1057 
1058  /* allow for an already started sched_op to complete */
1059  if (worker->state_sched_op_pending)
1060  {
1061  /* request sched_op to broadcast when way is cleared */
1062  worker->state_changing_ctx_waiting = 1;
1063 
1064  /* wait for sched_op completion */
1065  STARPU_PTHREAD_COND_BROADCAST(&worker->sched_cond);
1066 #ifdef STARPU_SIMGRID
1067  starpu_pthread_queue_broadcast(&_starpu_simgrid_task_queue[worker->workerid]);
1068 #endif
1069  do
1070  {
1071  STARPU_PTHREAD_COND_WAIT(&worker->sched_cond, &worker->sched_mutex);
1072  }
1073  while (worker->state_sched_op_pending);
1074 
1075  /* reset flag so other sched_ops wont have to broadcast state */
1076  worker->state_changing_ctx_waiting = 0;
1077  }
1078 }
1079 
1084 static inline void _starpu_worker_leave_changing_ctx_op(struct _starpu_worker * const worker)
1085 {
1086  worker->thread_changing_ctx = (starpu_pthread_t)0;
1087  worker->state_changing_ctx_notice = 0;
1088  STARPU_PTHREAD_COND_BROADCAST(&worker->sched_cond);
1089 }
1090 
1091 #ifdef STARPU_SPINLOCK_CHECK
1092 #define _starpu_worker_relax_on() __starpu_worker_relax_on(__FILE__, __LINE__, __starpu_func__)
1093 static inline void __starpu_worker_relax_on(const char*file, int line, const char* func)
1094 #else
1097 static inline void _starpu_worker_relax_on(void)
1098 #endif
1099 {
1100  struct _starpu_worker *worker = _starpu_get_local_worker_key();
1101  if (worker == NULL)
1102  return;
1103  if (!worker->state_sched_op_pending)
1104  return;
1105  STARPU_PTHREAD_MUTEX_LOCK_SCHED(&worker->sched_mutex);
1106 #ifdef STARPU_SPINLOCK_CHECK
1107  STARPU_ASSERT_MSG(worker->state_relax_refcnt<UINT_MAX, "relax last turn on in %s (%s:%d)\n", worker->relax_on_func, worker->relax_on_file, worker->relax_on_line);
1108 #else
1109  STARPU_ASSERT(worker->state_relax_refcnt<UINT_MAX);
1110 #endif
1111  worker->state_relax_refcnt++;
1112 #ifdef STARPU_SPINLOCK_CHECK
1113  worker->relax_on_file = file;
1114  worker->relax_on_line = line;
1115  worker->relax_on_func = func;
1116 #endif
1117  STARPU_PTHREAD_COND_BROADCAST(&worker->sched_cond);
1118  STARPU_PTHREAD_MUTEX_UNLOCK_SCHED(&worker->sched_mutex);
1119 }
1120 #define starpu_worker_relax_on _starpu_worker_relax_on
1121 
1122 #ifdef STARPU_SPINLOCK_CHECK
1123 #define _starpu_worker_relax_on_locked(worker) __starpu_worker_relax_on_locked(worker,__FILE__, __LINE__, __starpu_func__)
1124 static inline void __starpu_worker_relax_on_locked(struct _starpu_worker *worker, const char*file, int line, const char* func)
1125 #else
1127 static inline void _starpu_worker_relax_on_locked(struct _starpu_worker *worker)
1128 #endif
1129 {
1130  if (!worker->state_sched_op_pending)
1131  return;
1132 #ifdef STARPU_SPINLOCK_CHECK
1133  STARPU_ASSERT_MSG(worker->state_relax_refcnt<UINT_MAX, "relax last turn on in %s (%s:%d)\n", worker->relax_on_func, worker->relax_on_file, worker->relax_on_line);
1134 #else
1135  STARPU_ASSERT(worker->state_relax_refcnt<UINT_MAX);
1136 #endif
1137  worker->state_relax_refcnt++;
1138 #ifdef STARPU_SPINLOCK_CHECK
1139  worker->relax_on_file = file;
1140  worker->relax_on_line = line;
1141  worker->relax_on_func = func;
1142 #endif
1143  STARPU_PTHREAD_COND_BROADCAST(&worker->sched_cond);
1144 }
1145 
1146 #ifdef STARPU_SPINLOCK_CHECK
1147 #define _starpu_worker_relax_off() __starpu_worker_relax_off(__FILE__, __LINE__, __starpu_func__)
1148 static inline void __starpu_worker_relax_off(const char*file, int line, const char* func)
1149 #else
1150 static inline void _starpu_worker_relax_off(void)
1151 #endif
1152 {
1154  if (workerid == -1)
1155  return;
1156  struct _starpu_worker *worker = _starpu_get_worker_struct(workerid);
1157  STARPU_ASSERT(worker != NULL);
1158  if (!worker->state_sched_op_pending)
1159  return;
1160  STARPU_PTHREAD_MUTEX_LOCK_SCHED(&worker->sched_mutex);
1161 #ifdef STARPU_SPINLOCK_CHECK
1162  STARPU_ASSERT_MSG(worker->state_relax_refcnt>0, "relax last turn off in %s (%s:%d)\n", worker->relax_on_func, worker->relax_on_file, worker->relax_on_line);
1163 #else
1164  STARPU_ASSERT(worker->state_relax_refcnt>0);
1165 #endif
1166  worker->state_relax_refcnt--;
1167 #ifdef STARPU_SPINLOCK_CHECK
1168  worker->relax_off_file = file;
1169  worker->relax_off_line = line;
1170  worker->relax_off_func = func;
1171 #endif
1172  STARPU_PTHREAD_MUTEX_UNLOCK_SCHED(&worker->sched_mutex);
1173 }
1174 #define starpu_worker_relax_off _starpu_worker_relax_off
1175 
1176 #ifdef STARPU_SPINLOCK_CHECK
1177 #define _starpu_worker_relax_off_locked() __starpu_worker_relax_off_locked(__FILE__, __LINE__, __starpu_func__)
1178 static inline void __starpu_worker_relax_off_locked(const char*file, int line, const char* func)
1179 #else
1180 static inline void _starpu_worker_relax_off_locked(void)
1181 #endif
1182 {
1184  if (workerid == -1)
1185  return;
1186  struct _starpu_worker *worker = _starpu_get_worker_struct(workerid);
1187  STARPU_ASSERT(worker != NULL);
1188  if (!worker->state_sched_op_pending)
1189  return;
1190 #ifdef STARPU_SPINLOCK_CHECK
1191  STARPU_ASSERT_MSG(worker->state_relax_refcnt>0, "relax last turn off in %s (%s:%d)\n", worker->relax_on_func, worker->relax_on_file, worker->relax_on_line);
1192 #else
1193  STARPU_ASSERT(worker->state_relax_refcnt>0);
1194 #endif
1195  worker->state_relax_refcnt--;
1196 #ifdef STARPU_SPINLOCK_CHECK
1197  worker->relax_off_file = file;
1198  worker->relax_off_line = line;
1199  worker->relax_off_func = func;
1200 #endif
1201 }
1202 
1203 static inline int _starpu_worker_get_relax_state(void)
1204 {
1206  if (workerid < 0)
1207  return 1;
1208  struct _starpu_worker *worker = _starpu_get_worker_struct(workerid);
1209  STARPU_ASSERT(worker != NULL);
1210  return worker->state_relax_refcnt != 0;
1211 }
1212 #define starpu_worker_get_relax_state _starpu_worker_get_relax_state
1213 
1218 static inline void _starpu_worker_lock(int workerid)
1219 {
1220  struct _starpu_worker *worker = _starpu_get_worker_struct(workerid);
1221  STARPU_ASSERT(worker != NULL);
1222  int cur_workerid = starpu_worker_get_id();
1223  if (workerid != cur_workerid)
1224  {
1226 
1227  STARPU_PTHREAD_MUTEX_LOCK_SCHED(&worker->sched_mutex);
1228  while (!worker->state_relax_refcnt)
1229  {
1230  STARPU_PTHREAD_COND_WAIT(&worker->sched_cond, &worker->sched_mutex);
1231  }
1232  }
1233  else
1234  {
1235  STARPU_PTHREAD_MUTEX_LOCK_SCHED(&worker->sched_mutex);
1236  }
1237 }
1238 #define starpu_worker_lock _starpu_worker_lock
1239 
1240 static inline int _starpu_worker_trylock(int workerid)
1241 {
1242  struct _starpu_worker *cur_worker = _starpu_get_local_worker_key();
1243  STARPU_ASSERT(cur_worker != NULL);
1244  int cur_workerid = cur_worker->workerid;
1245  struct _starpu_worker *worker = _starpu_get_worker_struct(workerid);
1246  STARPU_ASSERT(worker != NULL);
1247 
1248  /* Start with ourself */
1249  int ret = STARPU_PTHREAD_MUTEX_TRYLOCK_SCHED(&cur_worker->sched_mutex);
1250  if (ret)
1251  return ret;
1252  if (workerid == cur_workerid)
1253  /* We only needed to lock ourself */
1254  return 0;
1255 
1256  /* Now try to lock the other worker */
1257  ret = STARPU_PTHREAD_MUTEX_TRYLOCK_SCHED(&worker->sched_mutex);
1258  if (!ret)
1259  {
1260  /* Good, check that it is relaxed */
1261  ret = !worker->state_relax_refcnt;
1262  if (ret)
1263  STARPU_PTHREAD_MUTEX_UNLOCK_SCHED(&worker->sched_mutex);
1264  }
1265  if (!ret)
1266  _starpu_worker_relax_on_locked(cur_worker);
1267  STARPU_PTHREAD_MUTEX_UNLOCK_SCHED(&cur_worker->sched_mutex);
1268  return ret;
1269 }
1270 #define starpu_worker_trylock _starpu_worker_trylock
1271 
1272 static inline void _starpu_worker_unlock(int workerid)
1273 {
1274  struct _starpu_worker *worker = _starpu_get_worker_struct(workerid);
1275  STARPU_ASSERT(worker != NULL);
1276  STARPU_PTHREAD_MUTEX_UNLOCK_SCHED(&worker->sched_mutex);
1277  int cur_workerid = starpu_worker_get_id();
1278  if (workerid != cur_workerid)
1279  {
1281  }
1282 }
1283 #define starpu_worker_unlock _starpu_worker_unlock
1284 
1285 static inline void _starpu_worker_lock_self(void)
1286 {
1288  struct _starpu_worker *worker = _starpu_get_worker_struct(workerid);
1289  STARPU_ASSERT(worker != NULL);
1290  STARPU_PTHREAD_MUTEX_LOCK_SCHED(&worker->sched_mutex);
1291 }
1292 #define starpu_worker_lock_self _starpu_worker_lock_self
1293 
1294 static inline void _starpu_worker_unlock_self(void)
1295 {
1297  struct _starpu_worker *worker = _starpu_get_worker_struct(workerid);
1298  STARPU_ASSERT(worker != NULL);
1299  STARPU_PTHREAD_MUTEX_UNLOCK_SCHED(&worker->sched_mutex);
1300 }
1301 #define starpu_worker_unlock_self _starpu_worker_unlock_self
1302 
1303 static inline int _starpu_wake_worker_relax(int workerid)
1304 {
1305  _starpu_worker_lock(workerid);
1306  int ret = starpu_wake_worker_locked(workerid);
1307  _starpu_worker_unlock(workerid);
1308  return ret;
1309 }
1310 #define starpu_wake_worker_relax _starpu_wake_worker_relax
1311 
1312 int starpu_wake_worker_relax_light(int workerid) STARPU_ATTRIBUTE_VISIBILITY_DEFAULT;
1313 
1318 void _starpu_worker_refuse_task(struct _starpu_worker *worker, struct starpu_task *task);
1319 
1320 void _starpu_set_catch_signals(int do_catch_signal);
1321 int _starpu_get_catch_signals(void);
1322 
1324 static inline int _starpu_perf_counter_paused(void)
1325 {
1326  STARPU_RMB();
1327  return STARPU_UNLIKELY(_starpu_config.perf_counter_pause_depth > 0);
1328 }
1329 
1330 void _starpu_crash_add_hook(void (*hook_func)(void));
1331 void _starpu_crash_call_hooks();
1332 
1333 uint32_t _starpu_worker_exists(struct starpu_task *task);
1334 
1335 /* @}*/
1336 
1337 #pragma GCC visibility pop
1338 
1339 #endif // __WORKERS_H__
Definition: barrier_counter.h:29
_starpu_worker_status
Definition: errorcheck.h:44
_starpu_worker_status_index
Definition: errorcheck.h:32
starpu_worker_archtype
Definition: starpu_worker.h:66
#define starpu_worker_get_id_check()
Definition: starpu_worker.h:257
starpu_node_kind
Definition: starpu_worker.h:44
#define STARPU_MAXNODES
Definition: starpu_config.h:217
void starpu_worker_relax_off(void)
int starpu_worker_get_id(void)
void starpu_worker_relax_on(void)
#define STARPU_NMAXWORKERS
Definition: starpu_config.h:284
@ STARPU_NARCH
Definition: starpu_worker.h:74
@ STARPU_MAX_RAM
Definition: starpu_worker.h:54
Definition: knobs.h:163
void _starpu_worker_start_state(int workerid, enum _starpu_worker_status_index index, struct timespec *start_time)
void _starpu_worker_apply_deferred_ctx_changes(void)
Definition: sched_ctx_list.h:27
Definition: starpu_spinlock.h:82
Definition: workers.h:311
char padding[STARPU_CACHELINE_SIZE]
Definition: workers.h:331
unsigned memory_node
Definition: workers.h:315
struct starpu_perfmodel_arch perf_arch
Definition: workers.h:312
uint32_t worker_mask
Definition: workers.h:313
Definition: workers.h:523
hwloc_obj_t(* get_hwloc_obj)(hwloc_topology_t topology, int devid)
Definition: workers.h:535
void(* init_worker_binding)(struct _starpu_machine_config *config, int no_mp_config STARPU_ATTRIBUTE_UNUSED, struct _starpu_worker *workerarg)
Definition: workers.h:532
const struct _starpu_driver_ops * driver_ops
Definition: workers.h:530
unsigned wait_for_worker_initialization
Definition: workers.h:529
void(* init_worker_memory)(struct _starpu_machine_config *config, int no_mp_config STARPU_ATTRIBUTE_UNUSED, struct _starpu_worker *workerarg)
Definition: workers.h:533
double alpha
Definition: workers.h:528
enum starpu_node_kind memory_kind
Definition: workers.h:527
const char * name_upper
Definition: workers.h:524
const char * name_var
Definition: workers.h:525
const char * name_lower
Definition: workers.h:526
Definition: drivers.h:26
Definition: workers.h:441
struct _starpu_combined_worker combined_workers[STARPU_NMAX_COMBINEDWORKERS]
Definition: workers.h:475
struct _starpu_machine_config::@6 * bindid_workers
unsigned running
Definition: workers.h:499
unsigned nbindid
Definition: workers.h:488
int pause_depth
Definition: workers.h:505
int current_tcpip_deviceid
Definition: workers.h:458
struct _starpu_sched_ctx sched_ctxs[STARPU_NMAX_SCHED_CTXS+1]
Definition: workers.h:508
int arch_nodeid[STARPU_NARCH]
Definition: workers.h:461
struct _starpu_node nodes[STARPU_MAXNODES]
Definition: workers.h:471
int current_bindid
Definition: workers.h:450
struct _starpu_worker workers[STARPU_NMAXWORKERS]
Definition: workers.h:468
uint32_t worker_mask
Definition: workers.h:493
char padding2[STARPU_CACHELINE_SIZE]
Definition: workers.h:480
int perf_counter_pause_depth
Definition: workers.h:516
unsigned submitting
Definition: workers.h:511
int current_devid[STARPU_NARCH]
Definition: workers.h:455
char padding1[STARPU_CACHELINE_SIZE]
Definition: workers.h:464
struct starpu_conf conf
Definition: workers.h:496
Definition: workers.h:352
unsigned nhwdevices[STARPU_NARCH]
Definition: workers.h:388
struct starpu_tree * tree
Definition: workers.h:368
hwloc_topology_t hwtopology
Definition: workers.h:363
int hip_th_per_dev
Definition: workers.h:414
int devid[STARPU_NARCH][STARPU_NMAXDEVS]
Definition: workers.h:404
unsigned workers_devid[STARPU_NARCH][STARPU_NMAXWORKERS]
Definition: workers.h:437
unsigned nworker[STARPU_NARCH][STARPU_NMAXDEVS]
Definition: workers.h:400
int cuda_th_per_stream
Definition: workers.h:407
unsigned nworkers
Definition: workers.h:354
unsigned ncombinedworkers
Definition: workers.h:357
unsigned nhwworker[STARPU_NARCH][STARPU_NMAXDEVS]
Definition: workers.h:392
unsigned nusedpus
Definition: workers.h:383
unsigned ndevices[STARPU_NARCH]
Definition: workers.h:396
unsigned workers_nbindid
Definition: workers.h:429
int cuda_th_per_dev
Definition: workers.h:409
unsigned nhwpus
Definition: workers.h:373
unsigned workers_bindid[STARPU_NMAXWORKERS]
Definition: workers.h:423
int hip_th_per_stream
Definition: workers.h:412
unsigned firstusedpu
Definition: workers.h:378
Definition: workers.h:547
enum starpu_worker_archtype worker_archtype
Definition: workers.h:549
const struct _starpu_node_ops * ops
Definition: workers.h:550
const char * name_upper
Definition: workers.h:548
Definition: node_ops.h:92
Definition: workers.h:70
struct _starpu_spinlock mc_lock
Definition: workers.h:76
unsigned evictable
Definition: workers.h:106
volatile int prefetch_out_of_memory
Definition: workers.h:103
struct _starpu_data_request_prio_list data_requests[STARPU_MAXNODES][2]
Definition: workers.h:112
unsigned mc_nb
Definition: workers.h:89
unsigned reclaiming
Definition: workers.h:98
int nfreechunks
Definition: workers.h:129
struct _starpu_mem_chunk_list mc_list
Definition: workers.h:81
starpu_pthread_mutex_t chunk_mutex
Definition: workers.h:131
char padding[STARPU_CACHELINE_SIZE]
Definition: workers.h:150
struct _starpu_data_request_prio_list data_requests_pending[STARPU_MAXNODES][2]
Definition: workers.h:118
struct _starpu_chunk_list chunks
Definition: workers.h:127
struct _starpu_mem_chunk * mc_dirty_head
Definition: workers.h:84
unsigned tidying
Definition: workers.h:96
Definition: sched_ctx.h:48
unsigned id
Definition: sched_ctx.h:50
Definition: workers.h:339
unsigned started
Definition: workers.h:343
starpu_pthread_t worker_thread
Definition: workers.h:341
starpu_pthread_cond_t ready_cond
Definition: workers.h:346
Definition: workers.h:155
unsigned state_blocked_in_parallel_observed
Definition: workers.h:193
struct starpu_task * current_task
Definition: workers.h:220
unsigned state_block_in_parallel_ack
Definition: workers.h:195
unsigned state_relax_refcnt
Definition: workers.h:180
struct starpu_task * task_transferring
Definition: workers.h:258
unsigned state_changing_ctx_waiting
Definition: workers.h:190
unsigned subworkerid
Definition: workers.h:164
unsigned devid
Definition: workers.h:162
starpu_pthread_t thread_changing_ctx
Definition: workers.h:206
int current_rank
Definition: workers.h:168
unsigned state_unblock_in_parallel_req
Definition: workers.h:196
unsigned nb_buffers_transferred
Definition: workers.h:256
starpu_pthread_t worker_thread
Definition: workers.h:161
starpu_pthread_cond_t ready_cond
Definition: workers.h:171
unsigned memory_node
Definition: workers.h:172
int workerid
Definition: workers.h:166
unsigned nb_buffers_totransfer
Definition: workers.h:257
unsigned devnum
Definition: workers.h:163
unsigned state_keep_awake
Definition: workers.h:239
struct _starpu_worker_set * set
Definition: workers.h:233
int worker_size
Definition: workers.h:169
unsigned pop_ctx_priority
Definition: workers.h:274
unsigned state_unblock_in_parallel_ack
Definition: workers.h:197
unsigned numa_memory_node
Definition: workers.h:173
unsigned char pipeline_stuck
Definition: workers.h:232
unsigned char pipeline_length
Definition: workers.h:231
unsigned nsched_ctxs
Definition: workers.h:247
unsigned spinning_backoff
Definition: workers.h:254
unsigned state_blocked_in_parallel
Definition: workers.h:192
unsigned current_ordered_task_order
Definition: workers.h:219
starpu_pthread_cond_t started_cond
Definition: workers.h:170
starpu_pthread_mutex_t sched_mutex
Definition: workers.h:179
unsigned run_by_starpu
Definition: workers.h:242
unsigned local_ordered_tasks_size
Definition: workers.h:217
struct starpu_task ** local_ordered_tasks
Definition: workers.h:216
unsigned is_slave_somewhere
Definition: workers.h:275
struct _starpu_worker_set * driver_worker_set
Definition: workers.h:234
starpu_pthread_cond_t sched_cond
Definition: workers.h:178
unsigned has_prev_init
Definition: workers.h:250
unsigned char ntasks
Definition: workers.h:230
int bindid
Definition: workers.h:165
unsigned state_block_in_parallel_req
Definition: workers.h:194
unsigned state_changing_ctx_notice
Definition: workers.h:191
unsigned state_sched_op_pending
Definition: workers.h:189
int combined_workerid
Definition: workers.h:167
unsigned char first_task
Definition: workers.h:229
unsigned current_ordered_task
Definition: workers.h:218
unsigned block_in_parallel_ref_count
Definition: workers.h:205
enum _starpu_worker_status status
Definition: workers.h:238