Lines Matching refs:team
26 /* This file handles the maintenance of threads in response to team
67 loop in which a thread waits to be called up to become part of a team. */
102 thr->ts.team->ordered_release[thr->ts.team_id] = &thr->release;
109 struct gomp_team *team = thr->ts.team;
112 gomp_barrier_wait (&team->barrier);
115 gomp_team_barrier_wait_final (&team->barrier);
117 gomp_barrier_wait_last (&team->barrier);
126 struct gomp_team *team = thr->ts.team;
130 gomp_team_barrier_wait_final (&team->barrier);
154 if (thr->ts.team == NULL)
167 /* Create a new team data structure. */
172 struct gomp_team *team;
175 team = get_last_team (nthreads);
176 if (team == NULL)
178 size_t extra = sizeof (team->ordered_release[0])
179 + sizeof (team->implicit_task[0]);
181 team = gomp_aligned_alloc (__alignof (struct gomp_team),
182 sizeof (*team) + nthreads * extra);
184 team = team_malloc (sizeof (*team) + nthreads * extra);
188 gomp_mutex_init (&team->work_share_list_free_lock);
190 gomp_barrier_init (&team->barrier, nthreads);
191 gomp_mutex_init (&team->task_lock);
193 team->nthreads = nthreads;
196 team->work_share_chunk = 8;
198 team->single_count = 0;
200 team->work_shares_to_free = &team->work_shares[0];
201 gomp_init_work_share (&team->work_shares[0], 0, nthreads);
202 team->work_shares[0].next_alloc = NULL;
203 team->work_share_list_free = NULL;
204 team->work_share_list_alloc = &team->work_shares[1];
206 team->work_shares[i].next_free = &team->work_shares[i + 1];
207 team->work_shares[i].next_free = NULL;
209 gomp_sem_init (&team->master_release, 0);
210 team->ordered_release = (void *) &team->implicit_task[nthreads];
211 team->ordered_release[0] = &team->master_release;
213 priority_queue_init (&team->task_queue);
214 team->task_count = 0;
215 team->task_queued_count = 0;
216 team->task_running_count = 0;
217 team->work_share_cancelled = 0;
218 team->team_cancelled = 0;
220 team->task_detach_count = 0;
222 return team;
226 /* Free a team data structure. */
229 free_team (struct gomp_team *team)
232 gomp_mutex_destroy (&team->work_share_list_free_lock);
234 gomp_barrier_destroy (&team->barrier);
235 gomp_mutex_destroy (&team->task_lock);
236 priority_queue_free (&team->task_queue);
237 team_free (team);
305 if (thr->ts.level == 0 && __builtin_expect (thr->ts.team != NULL, 0))
315 /* Launch a team. */
320 unsigned flags, struct gomp_team *team,
351 /* Always save the previous state, even if this isn't a nested team.
354 team->prev_ts = thr->ts;
356 thr->ts.team = team;
361 thr->ts.work_share = &team->work_shares[0];
367 thr->task = &team->implicit_task[0];
384 team->implicit_task[0].icv.nthreads_var = nthreads_var;
385 team->implicit_task[0].icv.bind_var = bind_var;
481 threads arrive before the team is released. */
487 team will exit. */
519 if (p == (team->prev_ts.place_partition_off
520 + team->prev_ts.place_partition_len))
521 p = team->prev_ts.place_partition_off;
539 if (p == (team->prev_ts.place_partition_off
540 + team->prev_ts.place_partition_len))
541 p = team->prev_ts.place_partition_off;
554 if (p == (team->prev_ts.place_partition_off
555 + team->prev_ts.place_partition_len))
556 p = team->prev_ts.place_partition_off;
581 if (team->prev_ts.place_partition_len > 64)
583 = gomp_malloc (team->prev_ts.place_partition_len
587 = gomp_alloca (team->prev_ts.place_partition_len
590 team->prev_ts.place_partition_len
595 > team->prev_ts.place_partition_off
597 <= (team->prev_ts.place_partition_off
598 + team->prev_ts.place_partition_len)))
601 - team->prev_ts.place_partition_off;
617 if (affinity_thr[l - team->prev_ts.place_partition_off]
625 if (affinity_thr[l - team->prev_ts.place_partition_off]
631 nthr = affinity_thr[l - team->prev_ts.place_partition_off];
632 affinity_thr[l - team->prev_ts.place_partition_off]
643 nthr->ts.team = team;
644 nthr->ts.work_share = &team->work_shares[0];
647 nthr->ts.level = team->prev_ts.level + 1;
658 nthr->task = &team->implicit_task[i];
661 team->implicit_task[i].icv.nthreads_var = nthreads_var;
662 team->implicit_task[i].icv.bind_var = bind_var;
666 team->ordered_release[i] = &nthr->release;
680 if (team->prev_ts.place_partition_len > 64)
712 s = nthreads / team->prev_ts.place_partition_len;
720 arrive before the team is released. */
780 if (p == (team->prev_ts.place_partition_off
781 + team->prev_ts.place_partition_len))
782 p = team->prev_ts.place_partition_off;
800 if (p == (team->prev_ts.place_partition_off
801 + team->prev_ts.place_partition_len))
802 p = team->prev_ts.place_partition_off;
815 if (p == (team->prev_ts.place_partition_off
816 + team->prev_ts.place_partition_len))
817 p = team->prev_ts.place_partition_off;
837 start_data->ts.team = team;
838 start_data->ts.work_share = &team->work_shares[0];
841 start_data->ts.level = team->prev_ts.level + 1;
850 start_data->task = &team->implicit_task[i];
852 team->implicit_task[i].icv.nthreads_var = nthreads_var;
853 team->implicit_task[i].icv.bind_var = bind_var;
871 gomp_barrier_wait (&team->barrier);
876 that should arrive back at the end of this team. The extra
938 && team->prev_ts.place_partition_len > 64)
944 /* Terminate the current team. This is only to be called by the master
951 struct gomp_team *team = thr->ts.team;
955 team->barrier in a inconsistent state, we need to use a different
957 gomp_team_barrier_wait_final (&team->barrier);
958 if (__builtin_expect (team->team_cancelled, 0))
960 struct gomp_work_share *ws = team->work_shares_to_free;
975 thr->ts = team->prev_ts;
980 __sync_fetch_and_add (&gomp_managed_threads, 1L - team->nthreads);
983 gomp_managed_threads -= team->nthreads - 1L;
987 and ensures the team can be safely destroyed. */
988 gomp_barrier_wait (&team->barrier);
991 if (__builtin_expect (team->work_shares[0].next_alloc != NULL, 0))
993 struct gomp_work_share *ws = team->work_shares[0].next_alloc;
1002 gomp_sem_destroy (&team->master_release);
1004 if (__builtin_expect (thr->ts.team != NULL, 0)
1005 || __builtin_expect (team->nthreads == 1, 0))
1006 free_team (team);
1012 pool->last_team = team;