2 ! { dg-options "-ffixed-form" }
9 REAL FUNCTION FN2(A
, B
)
16 INCLUDE "omp_lib.h" ! or USE OMP_LIB
21 !$OMP PARALLEL PRIVATE(IAM, NEIGHBOR) SHARED(WORK, ISYNC) NUM_THREADS(4)
22 IAM
= OMP_GET_THREAD_NUM() + 1
25 ! Do computation into my portion of work array
27 ! Announce that I am done with my work.
28 ! The first flush ensures that my work is made visible before
29 ! synch. The second flush ensures that synch is made visible.
30 !$OMP FLUSH(WORK,ISYNC)
34 ! Wait until neighbor is done. The first flush ensures that
35 ! synch is read from memory, rather than from the temporary
36 ! view of memory. The second flush ensures that work is read
37 ! from memory, and is done so after the while loop exits.
39 NEIGHBOR
= OMP_GET_NUM_THREADS()
43 DO WHILE (ISYNC(NEIGHBOR
) .EQ
. 0)
46 !$OMP FLUSH(WORK, ISYNC)
47 RESULT(IAM
) = FN2(WORK(NEIGHBOR
), WORK(IAM
))
55 IF (RESULT(I
) .NE
. I
* 2 + NEIGHBOR
* 2) THEN