Technical data
Analyzing Data Dependencies for Multiprocessing
79
However, to simplify separate compilation, a different form of nesting is
allowed. A routine that uses C$DOACROSS can be called from within a
multiprocessed region. This can be useful if a single routine is called from
several different places: sometimes from within a multiprocessed region,
sometimes not. Nesting does not increase the parallelism. When the first
C$DOACROSS loop is encountered, that loop is run in parallel. If while in
the parallel loop a call is made to a routine that itself has a C$DOACROSS,
this subsequent loop is executed serially.
Parallel Blocks
The Silicon Graphics Fortran compiler supports parallel execution of DO
loops only. However, another kind of parallelism frequently occurs: different
blocks of code independent of one another can be executed simultaneously.
As a simple example,
CALL MAKE1(A, B, C, D)
CALL MAKE2(E, F, G, H)
If you know that these two routines do not interfere with each other, you can
call them simultaneously. The following example shows how to use DO
loops to execute parallel blocks of code.
C$DOACROSS LOCAL(I), MP_SCHEDTYPE=SIMPLE
DO I = 1, 2
IF (I .EQ. 1) THEN
CALL MAKE1(A, B, C, D)
ELSEIF (I .EQ. 2) THEN
CALL MAKE2(E, F, G, H)
END IF
END DO
Analyzing Data Dependencies for Multiprocessing
The essential condition required to parallelize a loop correctly is that each
iteration of the loop must be independent of all other iterations. If a loop
meets this condition, then the order in which the iterations of the loop
execute is not important. They can be executed backward or even at the same
time, and the answer is still the same. This property is captured by the notion
of data independence. For a loop to be data-independent, no iterations of the










