We have integrated the different tools into an interactive program called CIPOL. CIPOL provides a lisp-like textual interface to the tools, and pretty-prints their results.Program MatInit !HPF$ PROCESSORS P(8,8) do i=1,n !HPF$ TEMPLATE T(n,m) do j=1,m !HPF$ DISTRIBUTE T(CYCLIC,CYCLIC) ONTO P A(i,j)=B(i) (S1) real A(n,m), B(n) end do !HPF$ ALIGN A(i,j) WITH T(i,*) end do !HPF$ ALIGN B(i) WITH T(i,1) end
The generic sets for our example are:The first set means that the ith row of array A is duplicated on each element of the ith row of template T. The second set shows that array B is aligned with the first column of template T.
FA-1(j1,j2,n,m)= ì
í
î
1£ j1£ n Ù i1=j1 1£ i2£ m , FB(i1,i2,n,m)= ì
í
î
1£ i1£ n Ù j'1=i1 j'2=1 .
|
. |
ì í î |
|
. (8) |
For our program example MatInit, the template is distributed on the processor grid using two CYCLIC patterns, hence the distribution is defined by:The integer problem to solve is lexmin(C(n,m),S(i1,i2,j1,j2)) with
rT æ
è
j1 j2 ö
ø= æ
è
j1 j2 ö
ø, kT = æ
è
1 1 ö
ø. One may note that, in this example, there is no variable representing the remainder in the division by kT (as R in (8)) since the block sizes are equal to 1. The result of PIP is that there exists a solution not equal to ^ in the polyhedron defined by:
C(n,m)= {
1£ j1£ n Ù 1£ j2£ m Ù i1=j1 Ù 1£ i2£ m ,
S(i1,i2,j1,j2)= ì
ï
í
ï
î
j'1=i1 Ù j'2=1 Ù 1£ p1£ 8 Ù 1£ p2£ 8 j1-1=8q1+p1-1 Ù j2-1=8q2+p2-1 j'1-1=8q'1+p1-1 Ù j'2-1=8q'2+p2-1 q1³ 0 Ù q2³ 0 Ù q'1³ 0 Ù q'2³ 0 . The new parameter q is used to express that j2-1 must be a multiple of 8.
C (n,m)= {
1£ j1£ n Ù 1£ j2£ m Ù i1=j1 Ù 1£ i2£ m Ù j2-1=8q Ù q³ 0 .
For the example MatInit the final result (in the context n³ 1 and m³ 1) isFor a detailled description of how the pre-evaluation can be done in an automatic way take a look at the report available at the URLThe brackets on the previous expression denote a periodic number: if we denote by v the vector (0,7/8,3/4,5/8,1/2, 3/8,1/4,1/8), the value of the periodic number is vm%8.
Count(C(n,m))- Count(
C (n,m)) = n.m æ
ç
ç
ç
ç
ç
è
7m
8 - é
ê
ê
ë0,
7
8 ,
3
4 ,
5
8 ,
1
2 ,
3
8 ,
1
4 ,
1
8 ù
ú
ú
û
m ö
÷
÷
÷
÷
÷
ø
When the parameter m is a multiple of 8 we have the expected result of 7n.m2/8 atomic communications at the template level.