Commit da6285b
committed
Enable OpenMP cancellation so in-loop errors exit early
Error paths inside parallel loops emit `!$omp cancel do`, but per the
OpenMP spec cancel constructs are no-ops unless the cancel-var ICV is
true, which requires OMP_CANCELLATION=true in the environment when the
OpenMP runtime first initializes. Nothing set it, so an error raised
inside a parallel loop recorded its message correctly (first-wins
critical section) but every remaining iteration still ran -- wasted
work, and statements after a failed in-loop check kept executing in
that iteration's thread.
Set OMP_CANCELLATION=true in .onLoad when unset (a pre-set value is
respected). Caveats documented in ?declare: no effect if another
package already initialized the OpenMP runtime, so early exit is
best-effort -- error messages are always correct either way.1 parent 590f063 commit da6285b
4 files changed
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
21 | 30 | | |
22 | 31 | | |
23 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
36 | 45 | | |
37 | 46 | | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
0 commit comments