| | 294 | |
| | 295 | |
| | 296 | = Transformation Details = |
| | 297 | |
| | 298 | == Support Types == |
| | 299 | |
| | 300 | * `$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: |
| | 301 | {{{ |
| | 302 | typedef struct OMP_gteam { |
| | 303 | $scope scope; |
| | 304 | int nthreads; |
| | 305 | _Bool init[]; |
| | 306 | $omp_work_record work[][]; |
| | 307 | $gbarrier gbarrier; |
| | 308 | } * $omp_gteam; |
| | 309 | }}} |
| | 310 | |
| | 311 | * `$omp_team`: local object belonging to a single thread and referencing the global team object. A handle type. It also includes a local barrier. Definition: |
| | 312 | {{{ |
| | 313 | typedef struct OMP_team { |
| | 314 | $omp_gteam gteam; |
| | 315 | $scope scope; |
| | 316 | int tid; |
| | 317 | $barrier barrier; |
| | 318 | } * $omp_team; |
| | 319 | }}} |
| | 320 | |
| | 321 | * `$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). |
| | 322 | {{{ |
| | 323 | typedef struct OMP_work_record { |
| | 324 | int kind; // loop, barrier, sections, or single |
| | 325 | int location; // location in model of construct |
| | 326 | _Bool arrived; // has this thread arrived yet? |
| | 327 | $domain loop_dom;// full loop domain; null if not loop |
| | 328 | $domain subdomain; // tasks this thread must do |
| | 329 | } $omp_work_record; |
| | 330 | }}} |
| | 331 | |
| | 332 | == Support Functions == |
| | 333 | |
| | 334 | === Team creation and destruction === |
| | 335 | |
| | 336 | * `$omp_gteam $omp_gteam_create($scope scope, int nthreads)` |
| | 337 | * creates new global team object, allocating object in heap in the specified scope. Number of threads that will be in the team is `nthreads`. |
| | 338 | |
| | 339 | * `void $omp_gteam_destroy($omp_gteam gteam)` |
| | 340 | * destroys the global team object. All shared objects associated to the team must have been destroyed before calling this function. |
| | 341 | |
| | 342 | * `$omp_team $omp_team_create($scope scope, $omp_gteam gteam, int tid)` |
| | 343 | * creates new local team object for a specific thread. |
| | 344 | |
| | 345 | * `void $omp_team_destroy($omp_team team)` |
| | 346 | * destroys the local team object |
| | 347 | |
| | 348 | === Other === |
| | 349 | |
| | 350 | * `void $omp_apply_assoc(void * x, $operation op, void * y)` |
| | 351 | * translation of `x = x op y` |
| | 352 | |
| | 353 | * `void $omp_flush_all($omp_team)` |
| | 354 | * performs an OpenMP flush operation on all shared objects. This is the default in OpenMP if no argument is specified for a flush construct. |