| | 6 | |
| | 7 | = General Ideas of Omp Transformation = |
| | 8 | |
| | 9 | 1. At a right mover (e.g. lock, enter_critical), we do yield and push. |
| | 10 | 2. At a left mover (e.g., unlock, exit_critical), we do check and then clean (pop). |
| | 11 | (Note that it only clean whats in between a pair of right mover and left mover.) |
| | 12 | 3. A barrier is transformed as: barrier() ; check(); clean_all(); barrier(); |
| | 13 | |
| | 14 | E.g., |
| | 15 | {{{ |
| | 16 | #pragma omp parallel shared(s) |
| | 17 | { |
| | 18 | A; |
| | 19 | #pragma omp critical(c) |
| | 20 | { |
| | 21 | B; |
| | 22 | } |
| | 23 | C; |
| | 24 | } |
| | 25 | }}} |
| | 26 | ==> |
| | 27 | {{{ |
| | 28 | $depends_on(/*nothing*/)$atomic{ |
| | 29 | $track{ // SetStack: S0 |
| | 30 | A; |
| | 31 | $yield; |
| | 32 | $track{ // SetStack: S0, S1 |
| | 33 | E; |
| | 34 | { |
| | 35 | B; |
| | 36 | } |
| | 37 | X; |
| | 38 | $check; // All var. in sets in SetStack |
| | 39 | } // clean S1 -- var. in B |
| | 40 | C; |
| | 41 | $check; |
| | 42 | } |
| | 43 | } |
| | 44 | }}} |
| | 45 | |
| | 46 | |