3
* This is to test GA_Create (is a collective operation)
4
* GA_Create -- used to create a global array using handles like 'g_A'
5
* Here used GA_Inquire to verify that g_A hanle returns the right values of created_array
16
one_dimension(int rank, int nprocs)
19
int ndim=1, dims=GSIZE;
20
int dims2, ndim2, type, value=5;
22
g_V = NGA_Create(C_INT, ndim, &dims, "array_V", NULL);
28
// NGA_Inquire(g_V, &type, &ndim2, dims2);
29
//printf(" %d -- %d,,\n", type, ndim2);
31
//for(i=0; i<DIM; i++)
32
//printf("%d: %d[ %d] ...* \n", rank, i, dims2[i]);
36
two_dimension(int rank, int nprocs)
39
int ndim=2, dims[2]={GSIZE,GSIZE};
40
int dims2[ndim], ndim2, type, value=5, i;
42
g_A = NGA_Create(C_INT, ndim, dims, "array_A", NULL);
48
NGA_Inquire(g_A, &type, &ndim2, dims2);
49
printf(" %d -- %d,,\n", type, ndim2);
52
printf("%d: %d[ %d] ...* \n", rank, i, dims2[i]);
56
three_dimension(int rank, int nprocs)
59
int ndim=3, dims[3]={GSIZE,GSIZE,GSIZE};
60
int dims2[ndim], ndim2, type, value=5, i;
62
g_A = NGA_Create(C_INT, ndim, dims, "array_A", NULL);
68
NGA_Inquire(g_A, &type, &ndim2, dims2);
69
printf(" %d -- %d,,\n", type, ndim2);
72
printf("%d: %d[ %d] ...* \n", rank, i, dims2[i]);
76
fourth_dimension(int rank, int nprocs)
79
int ndim=4, dims[4]={GSIZE,GSIZE,GSIZE,GSIZE};
80
int dims2[ndim], ndim2, type, value=5, i;
82
g_A = NGA_Create(C_INT, ndim, dims, "array_A", NULL);
88
NGA_Inquire(g_A, &type, &ndim2, dims2);
89
printf(" %d -- %d,,\n", type, ndim2);
92
printf("%d: %d[ %d] ...* \n", rank, i, dims2[i]);
97
main(int argc, char **argv)
101
MPI_Init(&argc, &argv);
103
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
104
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
106
MA_init(C_INT, 1000, 1000);
110
if(rank==1) printf(" ONE DIMENSION\n");
111
one_dimension(rank, nprocs);
113
if(rank==1) printf(" TWO DIMENSION\n");
114
two_dimension(rank, nprocs);
116
if(rank==1) printf(" THREE DIMENSION\n");
117
three_dimension(rank, nprocs);
119
// fourth_dimension(rank, nprocs);
122
printf("Test Completed \n");