Race Conditions
In this example, we choose the assignments to occur in the order A, B, C.
ICOUNT forces this order.
FLUSH so each thread sees updates to ICOUNT.
ICOUNT = 0
C$OMP PARALLEL SECTIONS
A = B + C
ICOUNT = 1
C$OMP FLUSH ICOUNT
C$OMP SECTION
1000 CONTINUE
IF(ICOUNT .LT. 1) GO TO 1000
B = A + C
ICOUNT = 2
C$OMP FLUSH ICOUNT
C$OMP SECTION
2000 CONTINUE
IF(ICOUNT .LT. 2) GO TO 2000
C = B + A
C$OMP END PARALLEL SECTIONS
Previous slide
Next slide
Back to first slide
View graphic version