Livelock
Solution:
- Fix the race with a barrier before the single. This may fix the MATCH operation and fix the livelock error.
- Decide on a maximum number of iterations, and use a loop with that number rather than an infinite loop.
C$OMP PARALLEL PRIVATE (ID)
ID = OMP_GET_THREAD_NUM()
N = OMP_GET_NUM_THREADS()
PHASES[ID] = UPDATE(U, ID)
IF (RES*RES .LT. TOL) GO TO 2000
IF (ICOUNT .GT. MAX) GO TO 2000