The DYNAMIC attribute specifies that an object may be dynamically realigned or redistributed.
H804 dynamic-directive is DYNAMIC alignee-or-distributee-list H805 alignee-or-distributee is alignee
A REALIGN directive may not be applied to an alignee that does not have the DYNAMIC attribute. A REDISTRIBUTE directive may not be applied to a distributee that does not have the DYNAMIC attribute.
A DYNAMIC directive may be combined with other directives, with the attributes stated in any order, consistent with the Fortran attribute syntax.
!HPF$ DYNAMIC A,B,C,D,E !HPF$ DYNAMIC:: A,B,C,D,E !HPF$ DYNAMIC, ALIGN WITH SNEEZY:: X,Y,Z !HPF$ ALIGN WITH SNEEZY, DYNAMIC:: X,Y,Z !HPF$ DYNAMIC, DISTRIBUTE(BLOCK, BLOCK) :: X,Y !HPF$ DISTRIBUTE(BLOCK, BLOCK), DYNAMIC :: X,Y
The first two examples mean exactly the same thing. The next two examples mean exactly the same second thing. The last two examples mean exactly the same third thing.
The three directives
!HPF$ TEMPLATE A(64,64),B(64,64),C(64,64),D(64,64) !HPF$ DISTRIBUTE(BLOCK, BLOCK) ONTO P:: A,B,C,D
may be combined into a single directive as follows:
!HPF$ TEMPLATE, DISTRIBUTE(BLOCK, BLOCK) ONTO P, & !HPF$ DIMENSION(64,64),DYNAMIC :: A,B,C,D
An ALLOCATABLE object may also be given the DYNAMIC attribute. If an ALLOCATE statement is immediatelly followed by REDISTRIBUTE and/or REALIGN directives, the meaning in principle is that the array is first created with the statically declared mapping, if any, then immediately remapped. In practice there is an obvious optimization: create the array in the processors to which is about to be remapped, in a single step. HPF implementors are strongly encouraged to implement this optimization and HPF programmers are encouraged to rely upon it. Here is an example:
REAL,ALLOCATABLE(:,:) :: TINKER, EVERS !HPF$ DYNAMIC :: TINKER, EVERS REAL, ALLOCATABLE :: CHANCE(:) !HPF$ DISTRIBUTE(BLOCK),DYNAMIC :: CHANCE ... READ 6,M,N ALLOCATE(TINKER(N*M,N*M)) !HPF$ REDISTRIBUTE TINKER(CYCLIC, BLOCK) ALLOCATE(EVERS(N,N)) !HPF$ REALIGN EVERS(:,:) WITH TINKER(M::M,1::M) ALLOCATE(CHANCE(10000)) !HPF$ REDISTRIBUTE CHANCE(CYCLIC)
While CHANCE is by default always allocated with a BLOCK distribution, it should be possible for a compiler to notice that it will immediately be remapped to a CYCLIC distribution. Similar remarks apply to TINKER and EVERS. (Note that EVERS is mapped in a thinly-spread-out manner onto TINKER; adjacent elements of EVERS are mapped to elements of TINKER separated by a stride M. This thinly-spread-out mapping is put in the lower left corner of TINKER, because EVERS(1,1) is mapped to TINKER(M,1).)
In Section 5.1, a list is given of operations that, if performed in a do loop, cause the iterations of
the loop to interfere with each other, and thereby prevent the loop from being characterized as INDEPENDENT. To that list must be added: