4.2.2 /minconcurrent, /mc, (/minconcurrent=1000)

Executing a loop in parallel incurs overhead that varies with different systems. If a loop has little computational work, the overhead required to set up parallel execution may make the loop execute more slowly than it executes serially. The minconcurrent qualifier sets the level of work in a loop above which KAP should execute the loop in parallel. Setting the /minconcurrent qualifier causes KAP to automatically set the /concurrentize qualifier for you.

The range of values for /minconcurrent is all integers greater than or equal to 0. The higher the minconcurrent value, the more iterations and/or statements the loop body must have to run concurrently.

At compilation time, KAP estimates the amount of work inside a loop on the basis of loop computations and loop iterations. KAP multiplies the loop iteration count by the sum of the noindex operands/results and the nonassignment operators. KAP compares its estimation with the minconcurrent value. If the estimated amount of work is greater than the minconcurrent value, KAP generates parallel code for the loop. Otherwise, the loop execution is serial. This is called a two-version loop.

If the DO loop bounds are known at compilation time, KAP computes the exact iteration count. However, if the DO loop bounds are unknown, KAP generates a block IF around the parallel code. The block IF allows a run-time decision whether or not to execute the loop in parallel.

To disable the generation of two-version loops throughout the program, use the command-line qualifier /minconcurrent=0 . To disable this action in specific DO loops, use the C*$* minconcurrent(0) directive.

The following loop illustrates this qualifier using the minconcurrent default of 1000:

DO 10 I = 1,N
        A(I) = B(I) + C(I)
   10    CONTINUE

Becomes:

      IF (N .GE. 425) THEN
          CALL mppfrk (P$PLP10,0)
       ELSE
          DO 2 I=1,N-3,4
             A(I) = B(I) + C(I)
             A(I+1) = B(I+1) + C(I+1)
             A(I+2) = B(I+2) + C(I+2)
             A(I+3) = B(I+3) + C(I+3)
   2        CONTINUE
      ENDIF

At run time, if the iteration count N is greater than or equal to 425 (1000/4), the concurrent loop executes in parallel; otherwise, it executes serially.


Previous Page | Next Page | Contents | Index |
Command-Line Qualifiers