1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef H5_API_TEST_PARALLEL_H
#define H5_API_TEST_PARALLEL_H
#include <mpi.h>
#include "testpar.h"
#include "H5_api_test.h"
/* Define H5VL_VERSION if not already defined */
#ifndef H5VL_VERSION
#define H5VL_VERSION 0
#endif
/* Define macro to wait forever depending on version */
#if H5VL_VERSION >= 2
#define H5_API_TEST_WAIT_FOREVER H5ES_WAIT_FOREVER
#else
#define H5_API_TEST_WAIT_FOREVER UINT64_MAX
#endif
#define PARALLEL_TEST_FILE_NAME "H5_api_test_parallel.h5"
extern char H5_api_test_parallel_filename[];
#undef TESTING
#undef TESTING_2
#undef PASSED
#undef H5_FAILED
#undef H5_WARNING
#undef SKIPPED
#undef PUTS_ERROR
#undef TEST_ERROR
#undef STACK_ERROR
#undef FAIL_STACK_ERROR
#undef FAIL_PUTS_ERROR
#undef TESTING_MULTIPART
#define TESTING(WHAT) \
{ \
if (MAINPROCESS) { \
printf("Testing %-62s", WHAT); \
fflush(stdout); \
} \
n_tests_run_g++; \
}
#define TESTING_2(WHAT) \
{ \
if (MAINPROCESS) { \
printf(" Testing %-60s", WHAT); \
fflush(stdout); \
} \
n_tests_run_g++; \
}
#define PASSED() \
{ \
if (MAINPROCESS) { \
puts(" PASSED"); \
fflush(stdout); \
} \
n_tests_passed_g++; \
}
#define H5_FAILED() \
{ \
if (MAINPROCESS) { \
puts("*FAILED*"); \
fflush(stdout); \
} \
n_tests_failed_g++; \
}
#define H5_WARNING() \
{ \
if (MAINPROCESS) { \
puts("*WARNING*"); \
fflush(stdout); \
} \
}
#define SKIPPED() \
{ \
if (MAINPROCESS) { \
puts(" -SKIP-"); \
fflush(stdout); \
} \
n_tests_skipped_g++; \
}
#define PUTS_ERROR(s) \
{ \
if (MAINPROCESS) { \
puts(s); \
AT(); \
} \
goto error; \
}
#define TEST_ERROR \
{ \
H5_FAILED(); \
if (MAINPROCESS) { \
AT(); \
} \
goto error; \
}
#define STACK_ERROR \
{ \
if (MAINPROCESS) { \
H5Eprint2(H5E_DEFAULT, stdout); \
} \
goto error; \
}
#define FAIL_STACK_ERROR \
{ \
H5_FAILED(); \
if (MAINPROCESS) { \
AT(); \
H5Eprint2(H5E_DEFAULT, stdout); \
} \
goto error; \
}
#define FAIL_PUTS_ERROR(s) \
{ \
H5_FAILED(); \
if (MAINPROCESS) { \
AT(); \
puts(s); \
} \
goto error; \
}
#define TESTING_MULTIPART(WHAT) \
{ \
if (MAINPROCESS) { \
printf("Testing %-62s", WHAT); \
puts(""); \
fflush(stdout); \
} \
}
/*
* Macros to surround an action that will be performed non-collectively. Once the
* operation has completed, a consensus will be formed by all ranks on whether the
* operation failed.
*/
#define BEGIN_INDEPENDENT_OP(op_name) \
{ \
bool ind_op_failed = false; \
\
{
#define END_INDEPENDENT_OP(op_name) \
} \
\
op_##op_name##_end : if (MPI_SUCCESS != MPI_Allreduce(MPI_IN_PLACE, &ind_op_failed, 1, MPI_C_BOOL, \
MPI_LOR, MPI_COMM_WORLD)) \
{ \
if (MAINPROCESS) \
printf( \
" failed to collect consensus about whether non-collective operation was successful\n"); \
goto error; \
} \
\
if (ind_op_failed) { \
if (MAINPROCESS) \
printf(" failure detected during non-collective operation - all other ranks will now fail " \
"too\n"); \
goto error; \
} \
}
#define INDEPENDENT_OP_ERROR(op_name) \
ind_op_failed = true; \
goto op_##op_name##_end;
hid_t create_mpi_fapl(MPI_Comm comm, MPI_Info info, bool coll_md_read);
int generate_random_parallel_dimensions(int space_rank, hsize_t **dims_out);
extern int mpi_size;
extern int mpi_rank;
#endif
|