next up previous contents index
Next: N. ADAPTOR Specific Directives Up: ADAPTOR HPF Language Reference Previous: L. HPF Intrinsic and   Contents   Index

Subsections

M. Advanced Mapping Features


M..1 Dynamic Remapping

ALIGN and DISTRIBUTE directives are declarative directives and must be placed in the declaration part of a unit. They define a static data mapping: once declared it cannot be changed at execution time.

HPF allows also for dynamic mapping of arrays. The executable directives REALIGN and REDISTRIBUTE allow dynamic redistributions. These directives have the same syntax as the declarative directives, respectively, and they must be placed in the execution part.

In addition, data objects that should be remapped dynamically must be declared as dynamic using the DYNAMIC directive.

      real, dimension (N,N) ::  A
!hpf$ dynamic :: A
!hpf$ distribute (block,*) :: A
      ...
!hpf$ redistribute (*,block) :: A
      ...

If an object is remapped, it does not imply (at least in ADAPTOR, but may be also in other HPF compilers) that aligned arrays will be implicitly remapped. Therefore is it obligatory to remap these aligned arrays also explicitly before the next access.

      real, dimension (N,N) ::  A, B
!hpf$ dynamic :: A, B
!hpf$ distribute (block,*) :: A
!hpf$ align B(i,j) with A(i,j)
      ...
!hpf$ redistribute (*,block) :: A   ! does not imply remapping of B
!hpf$ realign B(i,j) with A(i,j)
      ...

M..2 Mapping of Pointer Arrays

Pointer arrays can have the same mapping directives as allocatable arrays.

      real, dimension (:,:), pointer :: U, V
!hpf$ distribute (block,block) :: U
!hpf$ align (I,J) with U(I,J)  :: V

It is allowed to use an underspecified mapping for a pointer array.

      real, dimension (:,:), pointer :: U, V
!hpf$ range ((block(),block()) :: U, V

M..3 Mapping of Derived Type Components

      type GRID
         real, dimension (N,N) :: U, V
!hpf$    distribute (block,block) :: U
!hpf$    align (I,J) with U(I,J)  :: V
      end type

      type (GRID) :: LEVEL1
      type (GRID) :: LEVEL2(5)

Structure components can never be used in the DISTRIBUTE or in the ALIGN directive.

!hpf$ distribute (block,block) :: LEVEL1%U
!hpf$ align (I,J) with T(I,J)  :: LEVEL1%U
!hpf$ align (I,J) with LEVEL1%U(I,J)  :: T

Derived type components can also be dynamic (relation to POINTER attribute).

      type GRID
         real, dimension (:,:), pointer :: U, V
!hpf$    dynamic :: U, V
      end type

      type (GRID) :: LEVEL1
      type (GRID) :: LEVEL2(5)

It is allowed to use dynamic structure components in the REDISTRIBUTE and REALIGN statement:

!hpf$ redistribute (block,block) :: LEVEL1%U

!hpf$ realign (I,J) with F(I,J) :: LEVEL1%V
!hpf$ realign (I,J) with LEVEL1%U(I,J) :: F
!hpf$ realign (I,J) with LEVEL1%U(I,J) :: LEVEL1%V

Unfortunately, it is not possible to use the following syntax (otherwise the grammar would be no more LALR(1)):

!hpf$ redistribute LEVEL1%U(block,block)   ! not accepted by ADAPTOR
!hpf$ realign LEVEL1%U(I,J) with F(I,J)    ! not accepted by ADAPTOR

For an array of derived type with mapped components, all components can be remapped in one step:

!hpf$ redistribute (block,block) :: LEVEL2%U
!hpf$ redistribute (block,block) :: LEVEL2(1:5)%U
!hpf$ realign (I,J) with F(I,J) :: LEVEL2%V
!hpf$ realign (I,J) with F(I,J) :: LEVEL2(1:5)%V


next up previous contents index
Next: N. ADAPTOR Specific Directives Up: ADAPTOR HPF Language Reference Previous: L. HPF Intrinsic and   Contents   Index
Thomas Brandes 2004-03-18