Changes between Version 49 and Version 50 of OpenMPTransformation


Ignore:
Timestamp:
08/12/14 17:09:51 (12 years ago)
Author:
zmanchun
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OpenMPTransformation

    v49 v50  
    4141== Support Types ==
    4242
    43 * `$omp_gteam`: global team object, represents a team of threads executing in a parallel region.  A handle type.  This is where all the state needed to correctly execute a parallel region will be stored.   This includes all the shared object data, and a worksharking queue for every thread.
    44 * `$omp_team`: local object belonging to a single thread and referencing the global team object.  A handle type.
    45 * `$omp_gshared`: global shared object, used to represent the state of a shared variable.  A handle type.
    46 * `$omp_shared`: local view of the shared object, belonging to a single thread, with reference to the global object.  A handle type
    47 * `$omp_ref`: a reference to a shared object or some part of a shared object
     43* `$omp_gteam`: global team object, represents a team of threads executing in a parallel region.  A handle type.  This is where all the state needed to correctly execute a parallel region will be stored.   This includes a global barrier and a worksharing queue (incomplete array-of-$omp_work_record) for every thread. Definition:
     44{{{
     45typedef struct OMP_gteam {
     46  $scope scope;
     47  int nthreads;
     48  _Bool init[];
     49  $omp_work_record work[][];
     50  $omp_gshared shared[];
     51  $gbarrier gbarrier;
     52} * $omp_gteam;
     53}}}
     54
     55* `$omp_team`: local object belonging to a single thread and referencing the global team object.  A handle type. It also includes the local views of all shared data and a local barrier. Definition:
     56{{{
     57typedef struct OMP_team {
     58  $omp_gteam gteam;
     59  $scope scope;
     60  int tid;
     61  $omp_shared shared[];
     62  $barrier barrier;
     63} * $omp_team;
     64}}}
     65
     66* `$omp_gshared`: global shared object, containing a reference to a shared variable. A handle type. Definition:
     67{{{
     68typedef struct OMP_gshared {
     69  _Bool init[];
     70  void * original;
     71} * $omp_gshared;
     72}}}
     73
     74* `$omp_shared`: local view of a shared object, belonging to a single thread, with reference to the global object, and a local copy and a status of the shared object. The type of the  status variable is obtained from the type of the original variable by replacing all leaf nodes in the type tree with "int". A handle type.
     75{{{
     76typedef struct OMP_shared {
     77  $omp_gshared gshared;
     78  int tid;
     79  void * local;
     80  void * status;
     81} * $omp_shared;
     82}}}
     83
     84* `$omp_work_record`: the worksharing information that a thread needs for executing a worksharing region. It contains the kind of the worksharing region, the location of the region, the status of the region and the subdomain (iterations/sections/task assigned to the thread).
     85{{{
     86typedef struct OMP_work_record {
     87  int kind; // loop, barrier, sections, or single
     88  int location; // location in model of construct
     89  _Bool arrived; // has this thread arrived yet?
     90  $domain subdomain; // tasks this thread must do
     91} $omp_work_record;
     92}}}
     93
     94* `$omp_var_status`: an enumeration type for the status of a shared component. Available enumerators are: `EMPTY`, `FULL`, `MODIFIED`.
    4895
    4996== Support Functions ==
     
    5299
    53100* `$omp_gteam $omp_gteam_create($scope scope, int nthreads)`
    54  * creates new global team object, allocating object in heap in specified scope.  Number of threads that will be in the team is `nthreads`.
     101 * creates new global team object, allocating object in heap in the specified scope.  Number of threads that will be in the team is `nthreads`.
     102
    55103* `void $omp_gteam_destroy($omp_gteam gteam)`
    56104 * destroys the global team object.  All shared objects associated to the team must have been destroyed before calling this function.
     105
    57106* `$omp_team $omp_team_create($scope scope, $omp_gteam gteam, int tid)`
    58107 * creates new local team object for a specific thread.
     108
    59109* `void $omp_team_destroy($omp_team team)`
    60110 * destroys the local team object
     
    63113
    64114* `$omp_gshared $omp_gshared_create($omp_gteam, void *original)`
    65  * creates new global shared object, associated to the given global team.  A pointer to the shared variable that this object corresponds to is given.  The new object is initialized by copying the values from the original variable.
     115 * creates new global shared object, associated to the given global team. A pointer to the shared variable that this object corresponds to is given.
     116
    66117* `void $omp_gshared_destroy($omp_gshared gshared)`
    67118 * destroys the global shared object, copying the context to the original variable
     119
    68120* `$omp_shared $omp_shared_create($omp_team team, $omp_gshared gshared)`
    69  * creates a local shared object, returning handle to it
     121 * creates a local shared object, returning handle to it.  creates a local shared object, returning handle to it. The local copy of the shared object is initialized by copying the values from the original variable referenced to by the gshared object. The created shared object is appended to the shared queue of the $omp_team object.
     122
    70123* `void $omp_shared_destroy($omp_shared shared)`
    71124 * destroys the local shared object
    72 * `$omp_ref $omp_identity_ref($omp_shared shared)`
    73  * creates a reference to the specified shared object
    74 * `$omp_ref $omp_array_element_ref($omp_ref ref, int index)`
    75  * creates a reference to an element of a shared array object.  Argument `ref` is a reference to shared object of array type.
    76 * `$omp_ref $omp_member_ref($omp_ref ref, int fieldIndex)`
    77  * creates a reference to a member of a structure or union shared object.  Argument `ref` is a reference to the shared object of structure or union type.
    78 * `void $omp_read(void *result, $omp_ref ref)`
    79  * called by a thread to read a shared object pointed to by `ref`.  The result of the read is stored in the memory unit pointed to by `result`.
    80 * `void $omp_write($omp_ref ref, void *value)`
    81  * called by a thread to write to the shared object pointed to by `ref`.  The value to be written is taken from the memory unit pointed to by `value`.
    82 * `void $omp_apply_assoc($omp_ref ref, $operator op, void *value)`
    83  * Reads the reference, applies the associative operator specified by `op` to the read value and the value pointed to by `value`, and writes the result back to `ref`.  This happens in one atomic step.  Example: you can use this to add some value to a shared variable, using `CIVL_SUM` for `op`.
    84 * `void $omp_flush($omp_shared shared)`
     125
     126* `void $omp_read($omp_shared shared, void *result, void *ref)`
     127 * called by a thread to read a shared object. ref is a pointer into the local copy of the shared variable. The result of the read is stored in the memory unit pointed to by result. assumes ref is a pointer to a scalar.
     128
     129* `void $omp_write($omp_shared shared, void *ref, void *value)`
     130 * called by a thread to write to the shared object. ref is a pointer into the local copy of the shared variable. The value to be written is taken from the memory unit pointed to by value. assumes ref is a pointer to a scalar.
     131
     132* `void $omp_apply_assoc($omp_shared shared, void *local, $operation op, void *value)`
     133 * applies the associative operator specified by op to the local value and the corresponding shared value,  and writes the result back to the shared object. This happens in one atomic step. Example: you can use this to add some value to a shared variable, using CIVL_SUM for op. assumes local is a pointer to a scalar.
     134
     135* `void $omp_flush($omp_shared shared, void *ref)`
    85136 * performs an OpenMP flush operation on the shared object
     137
    86138* `void $omp_flush_all($omp_team)`
    87139 * performs an OpenMP flush operation on all shared objects.  This is the default in OpenMP if no argument is specified for a flush construct.
     
    444496* `omp_get_num_threads()` => `_nthreads`
    445497* `omp_get_thread_num()` => `_tid`
    446