3
* This is to test GA_Elem_multiply_patch (is a collective operation)
4
* GA_Create -- used to create a global array using handles like 'g_A'
5
* GA_Elem_multiply -- used to multiply two array and store it in one
6
* Here _elem_multiply patch -- help to does the same function of_elem_multiply ...to an specified patch in array
17
main(int argc, char **argv)
19
int rank, nprocs, i, j;
20
int g_A, g_B, g_C, local_C[DIM][DIM];
21
int dims[DIM]={5,5}, dims2[DIM], ndim, type;
22
int val_A=5, val_B=3, ld=DIM;
23
int lo[DIM]={2,2}, hi[DIM]={4,4}, blo[DIM]={0,0}, bhi[DIM]={2,2}, clo[DIM]={1,1}, chi[DIM]={3,3};
25
MPI_Init(&argc, &argv);
27
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
28
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
30
MA_init(C_INT, 1000, 1000);
34
g_A = NGA_Create(C_INT, DIM, dims, "array_A", NULL);
35
g_B = NGA_Create(C_INT, DIM, dims, "array_B", NULL);
36
g_C = NGA_Create(C_INT, DIM, dims, "array_C", NULL);
41
GA_Elem_multiply_patch(g_A, lo, hi, g_B, blo, bhi, g_C, clo, chi);
46
NGA_Get(g_C, clo, chi, local_C, &ld);
52
for(j=0; j<DIM; j++)printf("%d ", local_C[i][j]);
59
if(local_C[i][j]!=val_A*val_B) printf("GA Error : \n");
66
printf("Test Completed \n");