![]() |
![]() |
OpenMP Runtime
|
Implements GOMP_parallel_[start|end]. More...
#include <string.h>
#include <stdlib.h>
#include <inttypes.h>
#include "omp.h"
#include "tomp_parallel.h"
#include "tomp_log.h"
Functions | |
void | tomp_eoStartLoopX (tomp_event_t eventHdl) |
Function executed by the worker cores when they pull an event from the workshare queue. | |
tomp_Team * | tomp_initialize_team (unsigned int threadNum) |
Create and initialize a team. | |
void | tomp_start_team (tomp_Team *team, void(*fn)(void *), unsigned char *data) |
Start the team by pushing events to the StartLoop queue. | |
void | GOMP_parallel_start (void(*fn)(void *), unsigned char *data, unsigned int num_threads) |
GOMP_parallel_start is used for the for loop parallelism. | |
void | GOMP_parallel_end (void) |
Wait for implicit/explicit tasks to complete and terminate the team. | |
int | omp_get_num_threads (void) |
int | omp_get_thread_num (void) |
int | omp_get_num_procs (void) |
int | omp_in_parallel (void) |
int | omp_get_level (void) |
int | omp_get_ancestor_thread_num (int level) |
int | omp_get_team_size (int level) |
int | omp_get_active_level (void) |
void | tomp_completePendingTasks () |
Complete all explicit tasks generated upto the implicit/explicit barrier. | |
tomp_TeamState * | tomp_alloc_TeamState () |
Variables | |
tomp_Thread | tomp_thread |
void * | __TI_tls_currentTP |
Local TLS pointer (one per core) | |
tomp_event_t | tomp_eventHdlTbl [TOMP_DEVICE_NUM_CORES-1] |
tomp_Task * | tomp_taskPtrTbl [TOMP_DEVICE_NUM_CORES-1] |
tomp_Task * | tomp_initialTaskForMaster |
Initial Task for master. | |
tomp_Task * | tomp_implicitTaskForMaster |
Implicit Task for master. |
Implements GOMP_parallel_[start|end].
void GOMP_parallel_start | ( | void(*)(void *) | fn, |
unsigned char * | data, | ||
unsigned int | num_threads | ||
) |
GOMP_parallel_start is used for the for loop parallelism.
The same function is executed on various chunks of data (SPMD) Therefore, we are creating a single EO, a single PARALLEL queue, and an event group. For each thread in the team, we are sending an event that belongs to the event group.
fn | pointer to the function to execute |
data | pointer to the data to process |
num_threads | (number of threads in the OpenMP team) |
void tomp_completePendingTasks | ( | ) |
Complete all explicit tasks generated upto the implicit/explicit barrier.
From OMP Spec 3.0, p67, line 23 All threads of the team executing the binding parallel region must execute the barrier region and complete execution of all explicit tasks generated in the binding parallel region up to this point before any are allowed to continue execution beyond the barrier.
tomp_Team* tomp_initialize_team | ( | unsigned int | threadNum | ) |
Create and initialize a team.
threadNum | number of threads in the team |
void tomp_start_team | ( | tomp_Team * | team, |
void(*)(void *) | fn, | ||
unsigned char * | data | ||
) |
Start the team by pushing events to the StartLoop queue.
team | pointer to a team |
fn | function corresponding to the implicit task (outlined fn) |
data | data associated with the function |
void* __TI_tls_currentTP |
Local TLS pointer (one per core)
Implicit Task for master.
The current_task field in tomp_Thread for the master points to this task when the thread is in a parallel region.
Initial Task for master.
This task is the initial implicit task associated with the initial thread. OpenMP Spec 3.0, p12, lines 1-4. There is a distinction between the initial implicit task and the implicit tasks created for a parallel region and this distinction is important for ownership of locks.