inline void gomp_work_share_end_nowait (gomp_work_share_t *ws) { unsigned int myid, i; gomp_team_t *team; myid = prv_proc_num; team = (gomp_team_t *) CURR_TEAM(myid); if(ws->completed == team->nthreads) { ws->end = 0; ws->next = 0; ws->checkfirst = 0; ws->completed = 0; ws->checkfirst = WS_NOT_INITED; ws->chunk_size = 0; ws->incr = 0; } }
void GOMP_parallel_end (void) { int i; unsigned int myid, timer; gomp_team_t *the_team; #ifdef STATS_ENABLE timers[8]= stop_timer(); #endif myid = prv_proc_num; the_team = (gomp_team_t *) CURR_TEAM(myid); MSlaveBarrier_Wait(_ms_barrier, the_team->nthreads, the_team->proc_ids); gomp_team_end(); #ifdef STATS_ENABLE timers[13]= stop_timer(); #endif }
int omp_in_parallel() { unsigned int myid = prv_proc_num; return CURR_TEAM(myid)->level != 0; }
int omp_get_thread_num() { unsigned int myid = prv_proc_num; return CURR_TEAM(myid)->thread_ids[myid]; }
int omp_get_num_threads() { unsigned int myid = prv_proc_num; return CURR_TEAM(myid)->nthreads; }
//#################################################################### // Functions from memutils.c void omp_initenv(int nprocs, int pid) { int i; gomp_team_t * root_team; shmalloc_init(STATIC_TCDM_SIZE + sizeof(int)); #ifdef HEAP_HANDLERS heap_handler = heap_init(2048); //change pr("####################################", 0x0, PR_STRING | PR_NEWL); #endif gomp_hal_init_locks(FIRST_FREE_LOCK_ID); GLOBAL_IDLE_CORES = nprocs - 1; GLOBAL_THREAD_POOL = (1 << MASTER_ID); /* pr("locks = ", locks, PR_STRING | PR_NEWL | PR_HEX); pr("next_lock = ", locks, PR_STRING | PR_NEWL | PR_HEX); pr("global_lock = ", locks, PR_STRING | PR_NEWL | PR_HEX); pr("next_lock_lock = ", locks, PR_STRING | PR_NEWL | PR_HEX); */ gomp_hal_init_lock(GLOBAL_LOCK); for(i=0; i<nprocs; i++){ CURR_TEAM(i) = (gomp_team_t *) NULL; } //Create "main" team descriptor. This also intializes master core's curr_team descriptor // gomp_team_start (_app_main, NULL, 1, &root_team); // Equivalent to GOMP_TEAM_START gomp_master_region_start (/*_app_main*/ (void*) 0x3090, NULL, 1, &root_team); // Update pointer to first available SHMEM location so that application-level queries to shmalloc //are returned values non-overlapping with the addresses used in the runtime system // //shmalloc_init(0xa000); //pr("After initenv, shmem_next = ", shmem_next, PR_STRING | PR_NEWL | PR_HEX); alloc_global_point = shmem_next; shmem_next += sizeof(global_point_t); Init_Flag = shmem_next; shmem_next += sizeof(int); //Allocate Space for 5 barriers. (ID: 0, 1, 2, 3, 4) Barrier_Base = shmem_next; shmem_next += 5*Barrier_Size; global_data_base = shmem_next; shmem_next += sizeof(global_data); base = (Header *) shmem_next; freep = NULL; /* for (i=0; i<NUM_FREE_LISTS; i++) { global_data.free_lists[i] = NULL; } global_data.free_lists[NUM_FREE_LISTS] = shmem_next; global_data.free_lists[NUM_FREE_LISTS]->s.next = global_data.free_lists[NUM_FREE_LISTS]; global_data.free_lists[NUM_FREE_LISTS]->s.prev = global_data.free_lists[NUM_FREE_LISTS]; */ pr("Heap usage after Initialization:" , shmem_next - 0x8000000, PR_HEX|PR_STRING|PR_NEWL); }