Exemplo n.º 1
0
void
GOMP_parallel (void (*fn) (void *), void *data, unsigned num_threads, unsigned int flags)
{
  num_threads = gomp_resolve_num_threads (num_threads, 0);
  gomp_team_start (fn, data, num_threads, flags, gomp_new_team (num_threads));
  fn (data);
  ialias_call (GOMP_parallel_end) ();
}
Exemplo n.º 2
0
inline void
gomp_master_region_start (void *fn, void *data, int specified, gomp_team_t **team)
{
	unsigned int i, nprocs, myid, local_id_gen, num_threads,
		curr_team_ptr, my_team_ptr;
	unsigned long long mask;
	gomp_team_t *new_team, *parent_team;
	
	nprocs = prv_num_procs;
	myid = prv_proc_num;
	
	curr_team_ptr = (unsigned int) CURR_TEAM_PTR(0);
	/* Proc 0 calls this... */
	my_team_ptr = curr_team_ptr;
	
	/* Fetch free processor(s) */
	GLOBAL_INFOS_WAIT();


	num_threads = gomp_resolve_num_threads (specified);
	/* Create the team descriptor for current parreg */
	new_team = gomp_new_team();
	
	new_team->omp_task_f = (void *)(fn);
	new_team->omp_args = data;
	new_team->nthreads = num_threads; // also the master

	new_team->team = 0xFFFF;
	
	/* Use the global array to fetch idle cores */
	local_id_gen = 1; // '0' is master
	
	num_threads--; // Decrease NUM_THREADS to account for the master
	new_team->thread_ids[myid] = 0;
	new_team->proc_ids[0] = myid;

#ifdef P2012_HW_BAR
	//NOTE _P2012_ this is the dock barrier
	new_team->hw_event = DOCK_EVENT;
#elif defined (VSOC_HW_BAR) && defined (VSOC)
	new_team->hw_event = get_new_hw_event(16);
	DOCK_EVENT = new_team->hw_event;
#endif
	// to make SW barrier work
	for(i=1; i<prv_num_procs; i++)
	{
		new_team->proc_ids[local_id_gen] = i;
		new_team->thread_ids[i] = local_id_gen++;
	}
	GLOBAL_INFOS_SIGNAL();
	new_team->level = 0;
	
	new_team->parent = 0x0;
	*((gomp_team_t **) my_team_ptr) = new_team;
	*team = new_team;
	
}
void
GOMP_parallel_sections_start (void (*fn) (void *), void *data,
			      unsigned num_threads, unsigned count)
{
  struct gomp_team *team;

  num_threads = gomp_resolve_num_threads (num_threads, count);
  team = gomp_new_team (num_threads);
  gomp_sections_init (&team->work_shares[0], count);
  gomp_team_start (fn, data, num_threads, team);
}
Exemplo n.º 4
0
void
GOMP_parallel_start (void (*fn) (void *), void *data, unsigned num_threads)
{
  num_threads = gomp_resolve_num_threads (num_threads, 0);
  gomp_team_start (fn, data, num_threads, 0, gomp_new_team (num_threads));
}