5
static int test(int shape_idx, int type_idx, int dist_idx)
7
int type = TYPES[type_idx];
8
int *dims = SHAPES[shape_idx];
9
int ndim = SHAPES_NDIM[shape_idx];
10
mock_ga_t *mock_a, *mock_b, *mock_c, *mock_r;
13
int lo[GA_MAX_DIM], hi[GA_MAX_DIM], ld[GA_MAX_DIM], shape[GA_MAX_DIM];
14
int result=0, error_index=-1, error_proc=-1;
16
mock_a = Mock_Create(type, ndim, dims, "mock", NULL);
17
mock_b = Mock_Create(type, ndim, dims, "mock", NULL);
18
mock_c = Mock_Create(type, ndim, dims, "mock", NULL);
19
mock_r = Mock_Create(type, ndim, dims, "mock", NULL);
21
g_a = create_function[dist_idx](type, ndim, dims);
22
g_b = create_function[dist_idx](type, ndim, dims);
23
g_c = create_function[dist_idx](type, ndim, dims);
25
/* create meaningful data for local array */
26
mock_data(mock_a, g_a);
27
mock_data(mock_b, g_b);
29
/* init global array with same data as local array */
30
mock_to_global(mock_a, g_a);
31
mock_to_global(mock_b, g_b);
33
/* call the local routine */
34
Mock_Elem_multiply(mock_a, mock_b, mock_c);
36
/* call the global routine */
37
GA_Elem_multiply(g_a, g_b, g_c);
39
/* get the results from the global array */
40
global_to_mock(g_c, mock_r);
42
/* compare the results */
43
result = neq_mock(mock_c, mock_r, &error_index);
45
error_proc = GA_Nodeid();
47
/* make sure all procs get same result so they can die gracefully */
48
GA_Igop(&result, 1, "+");
49
/* if error occured, find the highest failing node ID */
50
GA_Igop(&error_proc, 1, "max");
51
/* clear the error index for all but the highest failing node ID */
52
if (error_proc != GA_Nodeid()) {
55
/* make sure all procs get the error index on the highest failing node ID */
56
GA_Igop(&error_index, 1, "+");
58
if (error_proc == GA_Nodeid()) {
59
printf("ERROR: local result failed to compare to global result\n");
60
printf("\terror_proc=%d\n", error_proc);
61
printf("\terror_index=%d\n", error_index);
62
printf("***LOCAL RESULT***\n");
64
printf("***GLOBAL RESULT***\n");
66
printf("\tprinting array distribution\n");
70
GA_Print_distribution(g_a);
83
int main(int argc, char **argv)
87
int shape_idx=0, type_idx=0, dist_idx=0;
90
for (shape_idx=0; shape_idx < NUM_SHAPES; ++shape_idx) {
91
for (type_idx=0; type_idx < NUM_TYPES; ++type_idx) {
92
for (dist_idx=0; dist_idx < NUM_DISTS; ++dist_idx) {
93
if (0 == GA_Nodeid()) {
94
printf("%s\t%s\t%s\n",
95
SHAPE_NAMES[shape_idx],
101
return_code = test(shape_idx, type_idx, dist_idx);
102
if (0 != return_code) {
106
if (0 != return_code) {
110
if (0 != return_code) {