The C*$* assert do (concurrent) assertion tells KAP
to prefer to ignore assumed dependencies and to execute the DO loop
immediately following this assertion in parallel.
This assertion says nothing about the concurrency threshold for the
loop. This means KAP continues to honor the dependencies it finds.
For example, in the following loop KAP ignores C*$* assert do
(concurrent) because there is a dependence on A
:
C*$* ASSERT DO (CONCURRENT)
DO 100 I = 4, N
A (I) = A (I-4) + B (I)
100 CONTINUE
Strictly speaking, you could parallelize the loop enabling KAP to put the entire loop body inside a critical section. The parallelized loop would run more slowly than the original serial version, however.
The following code example shows how C*$* assert do
(concurrent) tells KAP to ignore an assumed dependence,
the I+M array index, and to make the stride-1 loop
concurrent:
PROGRAM TEST
REAL A(100,100)
C*$* ASSERT DO (CONCURRENT)
DO 11 I = 1,N
DO 12 J = 1,N
A(I,J) = A(I+M,J)
12 CONTINUE
11 CONTINUE
END
Using the assertion and processing with /unroll=1 and
/conc , KAP generates the following code:
PROGRAM TEST
REAL A(100,100)
SAVE M, N
EXTERNAL PKTEST0
INTEGER II5, II4
PARAMETER (II5 = 1, II4 = 3)
C*$* ASSERT DO( CONCURRENT )
CALL mppfrk (PKTEST0,II4,N,A,M)
CALL mppend
END
SUBROUTINE PKTEST0 (MPPID, MPPNPR, N, A, M )
AUTOMATIC II3, II2, II1, J, I
INTEGER II3, II2, II1, J, I, MPPNPR, MPPID, M, N
REAL A(100,100)
INTEGER II5, II4
PARAMETER (II5 = 1, II4 = 3)
II3 = (N - 1) / MPPNPR + II5
II1 = (MPPID * II3) + 1
II2 = MIN0 (N, II1 + II3 - II5)
DO 2 I=II1,II2,II5
DO 2 J=1,N
A(I,J) = A(I+M,J)
2 CONTINUE
END
Another example of when to use C*$* assert do
(concurrent) follows. The DO loop can execute safely in
parallel, given the value of M is greater than the
value of N . Preceding the loop with C*$* assert
do (concurrent) allows parallel execution to happen.
C*$* ASSERT DO (CONCURRENT)
DO I = 1,N
X(I) = X(I+M)
ENDDO
KAP does not generate parallel code if you use the
/noconcurrent command-line qualifier.