5.3 Subroutine parallel_write

When the subroutine parallel_write is called, it receives as parameters the scalar logical unit number and the section of the array actual argument on a particular peer. Each peer process only receives the part of the array actual argument, if any, that is mapped to that peer. The following HPF_LOCAL routine writes its part of the array actual argument to its local file.

EXTRINSIC(HPF_LOCAL) &
SUBROUTINE parallel_write(unit_number, A, ok)
  INTEGER, INTENT(IN)                          :: unit_number
  INTEGER, DIMENSION(:), INTENT(IN)            :: A
    !HPF$ DISTRIBUTE *(BLOCK) :: A
  LOGICAL, INTENT(OUT) :: ok
  WRITE(unit_number, ERR=100, IOSTAT=jj) A
  ok = .true.
  RETURN
  100 ok = .false.
END SUBROUTINE parallel_write

5.3.1 Passing Data through the Interface

Notice that in the previous routine, the dummy array argument A is declared to be assumed shape (dimensioned with a colon, "DIMENSION(:)", with a descriptive mapping (with an asterisk before the distribution formatting, " * (BLOCK)"). A descriptive mapping is an assertion that the actual array is already mapped as specified at the time it is passed to the subroutine.

In this example, this means that the actual argument DATA in the calling routine main must already be distributed block at the time it is passed to the subroutine parallel_write . This can be verified by comparing the descriptive DISTRIBUTE directive in the subroutine with the DISTRIBUTE statement for data in main .

In addition, the descriptive mapping of a dummy argument (such as A in the previous example) in a called routine must be visible to the the calling routine in an explicit interface. An explicit interface consists of one of the following:

In the test program in Section 5.5, program main contains a USE statement referring to the parallel_temporary_files module, which contains the interface block for parallel_write .