32
H. Murai et al.
#pragma xmp loop on t[i]
10
for(int i=0;i<10;i++)
a[i] = i;
return 0;
}
XcalableMP Fortran
program main
!$xmp nodes p(2)
!$xmp template t(10)
!$xmp distribute t(block) onto p
5
integer a(10)
!$xmp align a(i) with t(i)
!$xmp loop on t(i)
do i=1, 10
10
a(i) = i
enddo
end program main
Then, is it possible to parallelize the loops in the example below where the loop
bounds are shrunk from the above?
XcalableMP C
#pragma xmp loop on t[i]
for(int i=1;i<9;i++)
a[i] = i;
XcalableMP Fortran
!$xmp loop on t(i)
do i=2, 9
a(i) = i
enddo
In this case, conditions 1 and 2 are satisfied and therefore it is possible to
parallelize them. In XMP/C, p[0] processes the indices from one to four and p[1]
from five to eight. In XMP/Fortran, p(1) processes the indices from two to five and
p(2) from six to nine (Fig. 23).
Next, is it possible to parallelize the below loops in which the index of the
distributed array is different?
XcalableMP C
#pragma xmp loop on t[i]
for(int i=1;i<9;i++)
a[i+1] = i;
H. Murai et al.
#pragma xmp loop on t[i]
10
for(int i=0;i<10;i++)
a[i] = i;
return 0;
}
XcalableMP Fortran
program main
!$xmp nodes p(2)
!$xmp template t(10)
!$xmp distribute t(block) onto p
5
integer a(10)
!$xmp align a(i) with t(i)
!$xmp loop on t(i)
do i=1, 10
10
a(i) = i
enddo
end program main
Then, is it possible to parallelize the loops in the example below where the loop
bounds are shrunk from the above?
XcalableMP C
#pragma xmp loop on t[i]
for(int i=1;i<9;i++)
a[i] = i;
XcalableMP Fortran
!$xmp loop on t(i)
do i=2, 9
a(i) = i
enddo
In this case, conditions 1 and 2 are satisfied and therefore it is possible to
parallelize them. In XMP/C, p[0] processes the indices from one to four and p[1]
from five to eight. In XMP/Fortran, p(1) processes the indices from two to five and
p(2) from six to nine (Fig. 23).
Next, is it possible to parallelize the below loops in which the index of the
distributed array is different?
XcalableMP C
#pragma xmp loop on t[i]
for(int i=1;i<9;i++)
a[i+1] = i;
