| 2 | | [https://vsl.cis.udel.edu/trac/civl/wiki/Next-GenOpenMPTransformation#TheSequentiallyConsistentSubsetofOpenMP 1. The Sequentially Consistent Subset of OpenMP]\\ |
| 3 | | [https://vsl.cis.udel.edu/trac/civl/wiki/Next-GenOpenMPTransformation#OpenMPConstructs 2. Supported OpenMP Features]\\ |
| 4 | | [https://vsl.cis.udel.edu/trac/civl/wiki/Next-GenOpenMPTransformation#OpenMPSimplifier 3. OpenMP Simplification]\\ |
| 5 | | [https://vsl.cis.udel.edu/trac/civl/wiki/Next-GenOpenMPTransformation#TransformationDetails 4. OpenMP Transofrmation] |
| | 2 | [https://vsl.cis.udel.edu/trac/civl/wiki/Next-GenOpenMPTransformation#a1.TheSequentiallyConsistentSubsetofOpenMP 1. The Sequentially Consistent Subset of OpenMP]\\ |
| | 3 | [https://vsl.cis.udel.edu/trac/civl/wiki/Next-GenOpenMPTransformation#a2.SupportedOpenMPFeatures 2. Supported OpenMP Features]\\ |
| | 4 | [https://vsl.cis.udel.edu/trac/civl/wiki/Next-GenOpenMPTransformation#a3.OpenMPSimplification 3. OpenMP Simplification]\\ |
| | 5 | [https://vsl.cis.udel.edu/trac/civl/wiki/Next-GenOpenMPTransformation#a4.OpenMPTransformations 4. OpenMP Transofrmation] |
| 424 | | $parfor (int _tid : {0..nthreads-1}) { |
| 425 | | $omp_team team = $omp_team_create($here, gteam, _tid); |
| 426 | | int _y; // private variable |
| 427 | | |
| 428 | | $write_set_push(); |
| 429 | | $read_set_push(); |
| 430 | | ... |
| 431 | | x = 5.2; |
| 432 | | _y = 3; |
| 433 | | ... |
| 434 | | // check for dataraces (collective operation) |
| 435 | | $omp_barrier_and_flush(team, $read_set_pop(), $write_set_pop()); |
| | 426 | $parfor (int tid : ($domain){0..nthreads-1}) { |
| | 427 | $local_start(); |
| | 428 | $omp_team team = $omp_team_create($here, gteam, tid); |
| | 429 | $read_set_push(); $write_set_push(); |
| | 430 | |
| | 431 | int i; // private |
| | 432 | int j = fstpvt_j; // first private init. |
| | 433 | |
| | 434 | transfromed(BLOCK) |
| | 435 | |
| | 436 | $omp_barrier_and_flush(team); //check data race |
| | 437 | |
| | 438 | $read_set_pop(); $write_set_pop(); |
| 444 | | For all private variables `y` not declared within the parallel construct, create a new variable of the same type, `_y`. The new variable is declared within the thread scope. If `y` is also firstprivate, then `_y` is initialized with the value of `y`, e.g. `int _y=y;`. Otherwise, `_y` is uninitialized, so has an undefined value. |
| | 449 | For all '''private''' variables `i` and `j` (out of `$parfor`) not declared within |
| | 450 | the parallel construct, create new variables of the same type, `i` and `j` (in the `$parfer`). |
| | 451 | The new variable is declared within the thread scope. |
| | 452 | `j` (out of `$parfor`) is also '''firstprivate''', then `j` (in the `$parfor`) is |
| | 453 | initialized with the value of `fstpvt_j`. |
| | 454 | Otherwise, `i` (in the `$parfor`) is uninitialized, so has an undefined value. |
| 453 | | for (i=0; i<n; i++) |
| 454 | | S |
| 455 | | }}} |
| 456 | | |
| 457 | | => |
| 458 | | |
| 459 | | {{{ |
| 460 | | { |
| 461 | | $domain loop_domain = {0..n-1}; |
| 462 | | $domain(1) my_iters = ($domain(1))$omp_arrive_loop(team, FOR_LOC++, loop_domain, STRATEGY); |
| 463 | | |
| 464 | | $for (int i : my_iters) { |
| 465 | | translate(S); |
| | 463 | for (i=1; i<n; i=i+1) { |
| | 464 | BLOCK |
| | 465 | } |
| | 466 | }}} |
| | 467 | |
| | 468 | => |
| | 469 | |
| | 470 | {{{ |
| | 471 | { // worksharing-loop construct (begin) |
| | 472 | // [lb .. ub # step] (lb <= ub) |
| | 473 | $domain loop_domain = {1 .. n-1 # 1}; |
| | 474 | $domain(1) loop_dist = ($domain(1))$omp_arrive_loop( |
| | 475 | team, loop_id++, loop_domain, STRATEGY); |
| | 476 | |
| | 477 | $for (int i : loop_dist) { |
| | 478 | transfromed(BLOCK) |
| 479 | | S |
| 480 | | } |
| 481 | | }}} |
| 482 | | |
| 483 | | => |
| 484 | | |
| 485 | | {{{ |
| 486 | | { |
| 487 | | $domain loop_domain = {0..n-1, 0..m-1, 0..l-1}; |
| 488 | | $domain(3) my_iters = ($domain(3))$omp_arrive_loop(team, FOR_LOC++, loop_domain, STRATEGY); |
| | 491 | BLOCK |
| | 492 | } |
| | 493 | }}} |
| | 494 | |
| | 495 | => |
| | 496 | |
| | 497 | {{{ |
| | 498 | { // worksharing-loop construct (begin) |
| | 499 | $domain loop_domain = {0..n-1 #1, 0..m-1 #1, 0..l-1 #1}; |
| | 500 | $domain(3) loop_dist = ($domain(3))$omp_arrive_loop( |
| | 501 | team, loop_id++, loop_domain, STRATEGY); |