| 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 | {{{ |
| | 45 | typedef 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 | {{{ |
| | 57 | typedef 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 | {{{ |
| | 68 | typedef 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 | {{{ |
| | 76 | typedef 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 | {{{ |
| | 86 | typedef 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`. |
| 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)` |