next up previous contents index
Next: A. Appendix: Fortran 90 Up: ADAPTOR HPF Language Reference Previous: M. Advanced Mapping Features   Contents   Index

Subsections

N. ADAPTOR Specific Directives

The following ADAPTOR specific directives have already been explained before:


N..1 Shared Arrays

ADAPTOR supports shared arrays that will be mapped to the global address space of a parallel machine.

Attention: This feature is only available if the MIMD system supports something like shared data structures or a global address space. Currently the most known feature are the System V shared segments.

      real A(6,8), B(4,6), X, Y
!hpf$ distribute A(block,*)
!hpf$ distribute B(*,block)
!hpf$ shared B
      ...

The array B is now shared among all the processors.

The following rules apply for the SHARED directive:

The advantage of a shared array is that the compiler is no longer responsible for emulating the global addresses. It is no longer necessary to compute the owner of one element and to compute a local address on the individual processors.


N..2 The SELECT Directive

The mapping directives of HPF specify the distribution of the arrays, but they do not say anything about the vectorization of operations in the corresponding dimensions.

select_directive :  !adp$ select <ident> ( <select_spec_dim_list> )
select_directive :  !adp$ select ( <select_spec_dim_list> ) :: <ident_list>

select_spec_dim  : '*'
select_spec_dim  : selector_list

selector_list    : selector { | selector }*

selector         : VECTOR
selector         : CONCUR
selector         : SPMD
selector         : ALL

selector         : NOVECTOR
selector         : NOCONCUR
selector         : NOSPMD
selector         : SKIP

The following example shows the use of the SELECT directive for the vectorization.

      real, dimension (M,N) :: A, B
!adp$ select A(novector,*) ! do not vectorize operations over rows of A
!adp$ select B(*,vector)   ! vectorize over columns of B

In the same way, as operations for the corresponding dimensions will be parallelized if they are distributed, operations for the corresponding dimensions will be vectorized or not. No specification * implies that the compiler can make its own decision.

N..3 The DOSELECT Directive

In certain cases, it is useful to specify directly before a loop whether it should be selected for vectorization, multiprocessor execution or distributed memory parallelization.

     doselect_directive : !adp$ do select (selector_list)

The DOSELECT directive can apper before a DO loop, a FORALL statement or directly before an array assignment.

selector_list      : selector { | selector }*

selector           : VECTOR
selector           : CONCUR
selector           : SPMD
selector           : ALL

selector           : NOVECTOR
selector           : NOCONCUR
selector           : NOSPMD
selector           : SKIP

The directive becomes only effective when the corresponding loop is independent. It overrides the selector attributes inherited by the owner of the INDEPENDENT loop.


N..4 The TRACE Directive

The requirement for tracing is described by the user directive !ADP$ TRACE. This directive has a Fortran attribute semantics, and follows Fortran 90 rules of scoping. By default, arrays are not traced.

An array must be flagged dirty when it is changed. The syntactic constructs that can modify an array are limited, and can be analyzed at compile-time: assignments with this array as a left-hand-side, redistributions, allocations and deallocations. Thus, the trace attribute is compatible with the DYNAMIC and ALLOCATABLE attributes, but not with the POINTER or TARGET attribute, because the compiler will not be able to record modification of such arrays.

       integer, dimension (N) :: P
!adp$  trace :: P

Communication schedules can be reused if indirection array has not changed. In the following example, the communication schedule will be reused for the integer array P as it is traced and not modified between the different calls of the subroutine TIMING.

      subroutine INDIRECT
      real, dimension (N)     ::  A, B
      integer, diemension (N) :: P, Q
!hpf$ distribute (block) :: A
!hpf$ align with A :: B, P, Q
!adp$ trace P
      call init(P)
      call init(Q)
      do J = 1, M ! serial loop
         call timing (A, B, P)
      end do
      do J = 1, M ! serial loop
         call timing (A, B, Q)
      end do
      end subroutine indirect

      subroutine timing(A, B, L)
      ...
!adp$ trace L
      forall (I=1:N) A(I) = B(L(I))
      end subroutine timing


next up previous contents index
Next: A. Appendix: Fortran 90 Up: ADAPTOR HPF Language Reference Previous: M. Advanced Mapping Features   Contents   Index
Thomas Brandes 2004-03-18