| | 251 | === Translating `reduction` clause === |
| | 252 | |
| | 253 | {{{ |
| | 254 | #pragma omp for reduction(+:x,y) |
| | 255 | for (i=a; i<b; i++) { |
| | 256 | S |
| | 257 | } |
| | 258 | }}} |
| | 259 | |
| | 260 | => |
| | 261 | |
| | 262 | {{{ |
| | 263 | { |
| | 264 | CIVL_omp_loop_info info = $omp_ws_arrive_loop(_ws, 23); |
| | 265 | double _x=0.0, _y=0.0; |
| | 266 | |
| | 267 | int numIters = info.numIters; |
| | 268 | for (int _count=0; _count<numIters; j++) { |
| | 269 | int i = info.iters[_count][0]; |
| | 270 | |
| | 271 | translate(S) but replace x with _x and y with _y; |
| | 272 | } |
| | 273 | x += _x; |
| | 274 | y += _y; |
| | 275 | // note: do something with POR so it knows the operations above from |
| | 276 | // different threads commute |
| | 277 | barrier_and_flush(); |
| | 278 | } |
| | 279 | }}} |
| | 280 | |
| | 281 | |