next up previous
Next: Directing the compilation Up: Usage of Polaris Previous: KAP specialty directives

Example source file with directives:

Presumably, some prior analysis has determined that in the following the ``i'' loop must be serialized and that the ``j'' loop is concurrent. Supposedly also, the variable ``ib'' in the inner loop is known to only take value between 50 and 60.

------- Sample File ------------------------------------------------------------

	subroutine dircheck( a, ia, b, ib, c )
	integer ia, ib
	real a(100), b(100), c(100)

CSRD$SERIAL
	do i = 1, 40
	    a( i ) = a( i + ia ) + c( i )

CSRD$PARALLEL
	    do j = 1, 40

CSRD$INRANGE ib( 50, 60 )

	        b( j ) = b( j + ib ) + c( i )
  		call ccc( b )
	        enddo
	    enddo
	
	return
	end

------- End of Sample File -----------------------------------------------------

Beginning of resulting .out file for command line: kap -cust=sgi <filename>

------- .out File (partial) ----------------------------------------------------

 KAP/Polaris                      0.1 k220203 940609        DIRCHECK           Source          09-Jun-1994  09:22:50      Page   1

 Footnotes     Actions        DO Loops    Line

                                              1   	subroutine dircheck( a, ia, b, ib, c )
                                              2   	integer ia, ib
                                              3   	real a(100), b(100), c(100)
                                              4    
               DIR                            5   CSRD\$SERIAL
 1             NO             +---------      6   	do i = 1, 40
                              !               7   	    a( i ) = a( i + ia ) + c( i )
                              !               8    
               DIR            !               9   CSRD\$PARALLEL
 2             INF C          !+--------     10   	    do j = 1, 40
                              !*             11    
 3 4           INF            !*             12   CSRD\$INRANGE ib( 50, 60 )
                              !*             13    
               DIR INF        !*             14   	        b( j ) = b( j + ib ) + c( i )
 5             INF            !*             15     		call ccc( b )
                              !*________     16   	        enddo
                              !_________     17   	    enddo
                                             18   	
                                             19   	return
                                             20   	end


 Abbreviations Used
  NO       not optimized           
  DIR      directive               
  INF      informational           
  C        concurrentized          


 Footnote List
   1: not optimized              Loop was asserted serial by directive.
   2: informational              Dependences for B are ignored in this loop.
   3: informational              Assumed relation:  "IB .LE. 60".
   4: informational              Assumed relation:  "IB .GE. 50".
   5: informational              Call is assumed to be concurrent.


 KAP/Polaris                      0.1 k220203 940609        DIRCHECK        Loop Summary       09-Jun-1994  09:22:50      Page   2

 
     Loop Summary
 
              From    To      Loop       Loop       at
      Loop#   line    line    label      index      nest    Status
      1       6       17      Do         I          1       scalar directive
      2       10      16      Do         J          2       concurrentized

------- End of .out File (partial) ---------------------------------------------

Resulting .cmp file for command line: kap -cust=sgi <filename>

------- .cmp File --------------------------------------------------------------

       SUBROUTINE DIRCHECK (A, IA, B, IB, C )
         INTEGER IA, IB
         REAL A(100), B(100), C(100)
 
CSRD$SERIAL 
         DO   I=1,40
           A(I) = A(I+IA) + C(I)
 
CSRD$PARALLEL 
 
C$DOACROSS SHARE(B,IB,I,C),LOCAL(J)
           DO 2 J=1,40
 
             B(J) = B(J+IB) + C(I)
             CALL CCC (B)
    2        CONTINUE
         END DO
	
         RETURN 
       END

------- End of .cmp File -------------------------------------------------------

Resulting .cmp file for command line: kap -cust=pcf <filename>

------- .cmp File --------------------------------------------------------------

       SUBROUTINE DIRCHECK (A, IA, B, IB, C )
         INTEGER IA, IB
         REAL A(100), B(100), C(100)
 
CSRD$SERIAL 
C*KAP* PARALLEL REGION SHARED (B,IB,C,A,IA) LOCAL (I,J)
         DO   I=1,40
C*KAP* ONE PROCESSOR SECTION 
           A(I) = A(I+IA) + C(I)
C*KAP* END ONE PROCESSOR SECTION 
 
CSRD$PARALLEL 
 
C*KAP* PARALLEL DO 
           DO 2 J=1,40
 
             B(J) = B(J+IB) + C(I)
             CALL CCC (B)
    2        CONTINUE
C*KAP* END PARALLEL DO NOWAIT
C*KAP* BARRIER
         END DO
C*KAP* END PARALLEL REGION 
	
         RETURN 
       END
 
------- End of .cmp File -------------------------------------------------------



Jay Hoeflinger
Mon Apr 21 11:52:18 CDT 1997