3
* This is to test GA_Zero_patch (is a collective operation)
4
* GA_Create -- used to create a global array using handles like 'g_A'
5
* GA_Duplicate --used to duplicate and generate one more global array.., handle 'g_A' to 'g_B'
6
* GA_Zero_patch -- is used to pass zero-value only certain patch of an array
19
main(int argc, char **argv)
21
int rank, nprocs, i, j;
22
int g_A, g_B, local_A[SIZE][SIZE], local_B[SIZE][SIZE];
23
int dims[DIM]={5,5}, alo[DIM]={1,1}, ahi[DIM]={3,2}, blo[DIM]={1,1}, bhi[DIM]={2,3}, ld=5;
26
MPI_Init(&argc, &argv);
28
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
29
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
31
MA_init(C_INT, 1000, 1000);
35
g_A = NGA_Create(C_INT, DIM, dims, "array_A", NULL);
38
g_B = GA_Duplicate(g_A, "array_B");
42
NGA_Zero_patch(g_B, blo, bhi);
45
NGA_Get(g_A, alo, ahi, local_A, &ld);
46
NGA_Get(g_B, blo, bhi, local_B, &ld);
52
for(j=0; j<2; j++) printf("%d ", local_A[i][j]);
59
for(j=0; j<3; j++) printf("%d ", local_B[i][j]);
66
if( local_A[i][j]!=local_B[i][j]) printf("ERROR : \n");
72
// The process is confirmed and verified by printing the array in OP-scr
75
if(content(g_A) != content(g_B))printf("ERROE : \n");
81
printf("Test Completed \n");