... The only options is to have an empty if statement, when your abort condition becomes to true so that the loop does not do anything and executes as fast as possible to its natual end. ... Until we have added user cancellation to the OpenMP specification (we are making progress here), there is no other option. ...
Thank you, Michael. A solution based on'If-Else' will work.
I suppose you make bailOut a shared variable (does it need to be set in a critical?), so each thread should receive the flag as it reaches that point. If your OpenMP doesn't complain about this, the compiler should avoid any optimizations based on i not being touched by your loop body. However, OpenMP implementations are notoriously poor at flagging violations which will produce unexpected results.
Modifying the loop counter is also prohibited by teh OpenMP specification. It works in most implementations, but it makes the program non-conforming and might break the code with different compiler releases.