The C*$* assert do (serial)
assertion forces the loop
immediately following this assertion to be serial. Additionally, it
restricts optimization by forcing all enclosing loops to be serial.
Inner loops and other loops inside the same enclosing loop nest, but
not enclosing the serial loop, may be optimized. The following code
example shows how C*$* assert do (serial)
works:
DO 100 I=1,N DO 100 J = 1, N C*$* ASSERT DO (SERIAL) DO 200 K = 1, N X(I,J,K) = X(I,J,K) * Y(I,J) 200 CONTINUE DO 300 K = 1, N X(I,J,K) = X(I,J,K) + Z(I,K) 300 CONTINUE 100 CONTINUE
The assertion forces the DO 100 I
loop, the DO
100 J
loop, and the DO 200 K
loop to be serial.
The DO 300 K
loop can still be parallelized. In this
case, KAP does NOT distribute the I
or J
loops to try to get a larger optimizable loop.
The following loop code shows an example of when to use C*$*
assert do (serial)
. X
and Y
must
not process in parallel because they are equivalenced and they
overlap in memory. Using C*$* assert do (serial)
stops
parallel execution of the loop.
C*$* ASSERT DO (SERIAL) DO I = 1,N X(I) = Y(I) ENDDO
See also the C*$* assert do prefer (concurrent)
assertion, Section 6.3.5, and C*$* assert
do prefer (serial)
, Section 6.3.6.