66
H. Murai et al.
5.5.3 Sync Memory
XcalableMP C
void xmp_sync_memory(int * status)
XcalableMP Fortran
sync memory
Each image waits until all one-sided communication is complete. This function/statement does not imply barrier synchronization, unlike sync all and
sync images, and therefore can be locally executed.
6 Procedure Interface
Procedure calls in XMP are almost the same as those in the base language.
Procedure calls between other languages or to external libraries are also allowed
if the base language supports them.
In the example below, a function/subroutine sub1() calls another function/subroutine sub2() with a distributed array x as an argument.
XcalableMP C
void sub1(){
#pragma xmp nodes p[2]
#pragma xmp template t[10]
#pragma xmp distribute t[block] onto p
5
double x[10];
#pragma xmp align x[i] with t[i]
sub2(x);
}
10 void sub2(double a[10]){
#pragma xmp nodes p[2]
#pragma xmp template t[10]
#pragma xmp distribute t[block] onto p
double a[10];
15 #pragma xmp align a[i] with t[i]
:
}
XcalableMP Fortran
subroutine sub1()
!$xmp nodes p(2)
!$xmp template t(10)
!$xmp distribute t(block) onto p
5
real x(10)
!$xmp align x(i) with t(i)
H. Murai et al.
5.5.3 Sync Memory
XcalableMP C
void xmp_sync_memory(int * status)
XcalableMP Fortran
sync memory
Each image waits until all one-sided communication is complete. This function/statement does not imply barrier synchronization, unlike sync all and
sync images, and therefore can be locally executed.
6 Procedure Interface
Procedure calls in XMP are almost the same as those in the base language.
Procedure calls between other languages or to external libraries are also allowed
if the base language supports them.
In the example below, a function/subroutine sub1() calls another function/subroutine sub2() with a distributed array x as an argument.
XcalableMP C
void sub1(){
#pragma xmp nodes p[2]
#pragma xmp template t[10]
#pragma xmp distribute t[block] onto p
5
double x[10];
#pragma xmp align x[i] with t[i]
sub2(x);
}
10 void sub2(double a[10]){
#pragma xmp nodes p[2]
#pragma xmp template t[10]
#pragma xmp distribute t[block] onto p
double a[10];
15 #pragma xmp align a[i] with t[i]
:
}
XcalableMP Fortran
subroutine sub1()
!$xmp nodes p(2)
!$xmp template t(10)
!$xmp distribute t(block) onto p
5
real x(10)
!$xmp align x(i) with t(i)
