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, *result_a;
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
/* create the local array and result array */
17
mock_a = Mock_Create(type, ndim, dims, "mock", NULL);
18
result_a = Mock_Create(type, ndim, dims, "mock", NULL);
20
/* create the global array */
21
g_a = create_function[dist_idx](type, ndim, dims);
23
/* create meaningful data for local array */
24
mock_data(mock_a, g_a);
26
/* init global array with same data as local array */
27
mock_to_global(mock_a, g_a);
29
/* call the local routine */
30
Mock_Abs_value(mock_a);
32
/* call the global routine */
35
/* get the results from the global array */
36
global_to_mock(g_a, result_a);
38
/* compare the results */
39
result = neq_mock(mock_a, result_a, &error_index);
41
error_proc = GA_Nodeid();
43
/* make sure all procs get same result so they can die gracefully */
44
GA_Igop(&result, 1, "+");
45
/* if error occured, find the highest failing node ID */
46
GA_Igop(&error_proc, 1, "max");
47
/* clear the error index for all but the highest failing node ID */
48
if (error_proc != GA_Nodeid()) {
51
/* make sure all procs get the error index on the highest failing node ID */
52
GA_Igop(&error_index, 1, "+");
54
if (error_proc == GA_Nodeid()) {
55
printf("ERROR: local result failed to compare to global result\n");
56
printf("\terror_proc=%d\n", error_proc);
57
printf("\terror_index=%d\n", error_index);
58
printf("***LOCAL RESULT***\n");
60
printf("***GLOBAL RESULT***\n");
62
printf("\tprinting array distribution\n");
66
GA_Print_distribution(g_a);
72
Mock_Destroy(result_a);
78
int main(int argc, char **argv)
82
int shape_idx=0, type_idx=0, dist_idx=0;
85
for (shape_idx=0; shape_idx < NUM_SHAPES; ++shape_idx) {
86
for (type_idx=0; type_idx < NUM_TYPES; ++type_idx) {
87
for (dist_idx=0; dist_idx < NUM_DISTS; ++dist_idx) {
88
if (0 == GA_Nodeid()) {
89
printf("%s\t%s\t%s\n",
90
SHAPE_NAMES[shape_idx],
96
return_code = test(shape_idx, type_idx, dist_idx);
97
if (0 != return_code) {
101
if (0 != return_code) {
105
if (0 != return_code) {