
Chapter 7. Interprocess communication 79
• The directive SHARED has been changed to DISTRIBUTE.
• The distribution specification : for a degenerate distribution has
been changed to *.
• The distribution specification :BLOCK has been changed to BLOCK.
• The intrinsic function called IN_DOSHARED is called (in HPF_CRAFT)
IN_INDEPENDENT.
The PGHPF 2.3 compiler conforms with HPF standard version 1.1. Fort-
ran 90 internal procedures and recursion are not supported and pointers
are supported with certain restrictions.
The following is a simple example of an HPF code:
PROGRAM dot
IMPLICIT NONE
INTEGER :: n
REAL, DIMENSION(:), ALLOCATABLE :: a, b
REAL :: d
!HPF$ DISTRIBUTE A(BLOCK)
!HPF$ ALIGN B(:) WITH A(:)
WRITE (*,*) ’Input the number of points:’
READ (*,*) n
ALLOCATE (a(n), b(n))
a = 1.0
b = 2.0
d = SUM(a*b)
WRITE (*,*) d
END PROGRAM dot
The code is standard Fortran 90 code except for the two directive lines
starting with !HPF$. The line
!HPF$ DISTRIBUTE A(BLOCK)
instructs the compiler that the array a should be so distributed along
the processors that each processor gets a contiguous block of the array.
The directive
!HPF$ ALIGN B(:) WITH A(:)
says that the array b should also be distributed and the corresponding
elements of b and a should reside in the same processor.
For the line d = SUM(a*b) the compiler generates code that computes
the local partial sum in each processor and then gathers the partial sums
into a global sum.
The PGHPF compiler must be initialized with the command
Kommentare zu diesen Handbüchern