63 static const char rank_vars[][24]
64 = { {
"MPI_LOCALRANKID" } , {
"PMI_RANK" }, { 0 } };
66 nrank_vars =
sizeof (rank_vars) /
sizeof (rank_vars[0]) - 1,
69 for (
size_t i = 0; i < nrank_vars; ++i) {
70 if ((rank_str = getenv(rank_vars[i])))
76 static const char dt_pfx[] =
"dt_log.",
78 size_t pfx_size =
sizeof (dt_pfx), sfx_size =
sizeof (dt_sfx),
79 rank_str_len = strlen(rank_str);
80 char dt_log_fn[pfx_size + sfx_size - 1 + rank_str_len];
81 memcpy(dt_log_fn, dt_pfx, pfx_size - 1);
82 memcpy(dt_log_fn+pfx_size-1, rank_str, rank_str_len);
83 memcpy(dt_log_fn+pfx_size-1+rank_str_len, dt_sfx, sfx_size);
84 dt_out = fopen(dt_log_fn,
"w");
92 fprintf(
dt_out,
"MPI_Type_dup(%jd);\n", (intmax_t)oldtype);
93 int rc = PMPI_Type_dup(oldtype, newtype);
94 fprintf(
dt_out,
"%jd\n", (intmax_t)(*newtype));
100 MPI_Datatype *newtype)
102 fprintf(
dt_out,
"MPI_Type_contiguous(%d, %jd);\n", count, (intmax_t)oldtype);
103 int rc = PMPI_Type_contiguous(count, oldtype, newtype);
104 fprintf(
dt_out,
"%jd\n", (intmax_t)(*newtype));
110 MPI_Datatype oldtype, MPI_Datatype *newtype)
112 fprintf(
dt_out,
"MPI_Type_vector(%d, %d, %d, %jd);\n",
113 count, blocklength, stride, (intmax_t)oldtype);
114 int rc = PMPI_Type_vector(count, blocklength, stride, oldtype, newtype);
115 fprintf(
dt_out,
"%jd\n", (intmax_t)(*newtype));
121 MPI_Datatype oldtype, MPI_Datatype *newtype)
123 fprintf(
dt_out,
"MPI_Type_hvector(%d, %d, %jd, %jd);\n",
124 count, blocklength, (intmax_t)stride, (intmax_t)oldtype);
125 int rc = PMPI_Type_hvector(count, blocklength, stride, oldtype, newtype);
126 fprintf(
dt_out,
"%jd\n", (intmax_t)(*newtype));
132 MPI_Aint stride, MPI_Datatype oldtype,
133 MPI_Datatype *newtype)
135 fprintf(
dt_out,
"MPI_Type_create_hvector(%d, %d, %jd, %jd);\n",
136 count, blocklength, (intmax_t)stride, (intmax_t)oldtype);
137 int rc = PMPI_Type_create_hvector(count, blocklength, stride, oldtype, newtype);
138 fprintf(
dt_out,
"%jd\n", (intmax_t)(*newtype));
145 XT_MPI2_CONST
int array_of_blocklengths[],
146 XT_MPI2_CONST
int array_of_displacements[],
147 MPI_Datatype oldtype,
148 MPI_Datatype *newtype)
150 fprintf(
dt_out,
"MPI_Type_indexed(%d, (int){\n", count);
151 for (
int i = 0; i < count; ++i)
152 fprintf(
dt_out,
" %d,\n", array_of_blocklengths[i]);
153 fputs(
"}, (int[]){\n",
dt_out);
154 for (
int i = 0; i < count; ++i)
155 fprintf(
dt_out,
" %d,\n", array_of_displacements[i]);
156 fprintf(
dt_out,
"}, %jd);\n", (intmax_t)oldtype);
157 int rc = PMPI_Type_indexed(count, array_of_blocklengths,
158 array_of_displacements, oldtype, newtype);
159 fprintf(
dt_out,
"%jd\n", (intmax_t)(*newtype));
165 int array_of_blocklengths[],
166 MPI_Aint array_of_displacements[],
167 MPI_Datatype oldtype,
168 MPI_Datatype *newtype)
170 fprintf(
dt_out,
"MPI_Type_hindexed(%d, (int[]){\n", count);
171 for (
int i = 0; i < count; ++i)
172 fprintf(
dt_out,
" %d,\n", array_of_blocklengths[i]);
173 fputs(
"}, (MPI_Aint[]){\n",
dt_out);
174 for (
int i = 0; i < count; ++i)
175 fprintf(
dt_out,
" %jd,\n", (intmax_t)array_of_displacements[i]);
176 fprintf(
dt_out,
"}, %jd);\n", (intmax_t)oldtype);
177 int rc = PMPI_Type_hindexed(count, array_of_blocklengths,
178 array_of_displacements, oldtype, newtype);
179 fprintf(
dt_out,
"%jd\n", (intmax_t)(*newtype));
186 XT_MPI2_CONST
int array_of_blocklengths[],
187 XT_MPI2_CONST MPI_Aint array_of_displacements[],
188 MPI_Datatype oldtype, MPI_Datatype *newtype)
190 fprintf(
dt_out,
"MPI_Type_create_hindexed(%d, (int){\n", count);
191 for (
int i = 0; i < count; ++i)
192 fprintf(
dt_out,
" %d,\n", array_of_blocklengths[i]);
193 fputs(
"}, (MPI_Aint[]){\n",
dt_out);
194 for (
int i = 0; i < count; ++i)
195 fprintf(
dt_out,
" %jd,\n", (intmax_t)array_of_displacements[i]);
196 fprintf(
dt_out,
"}, %jd);\n", (intmax_t)oldtype);
197 int rc = PMPI_Type_create_hindexed(count, array_of_blocklengths,
198 array_of_displacements, oldtype,
200 fprintf(
dt_out,
"%jd\n", (intmax_t)(*newtype));
206 XT_MPI2_CONST
int array_of_displacements[],
207 MPI_Datatype oldtype, MPI_Datatype *newtype)
209 fprintf(
dt_out,
"MPI_Type_create_indexed_block(%d, %d, (int){\n", count, blocklength);
210 for (
int i = 0; i < count; ++i)
211 fprintf(
dt_out,
" %d,\n", array_of_displacements[i]);
212 fprintf(
dt_out,
"}, %jd);\n", (intmax_t)oldtype);
213 int rc = PMPI_Type_create_indexed_block(count, blocklength,
214 array_of_displacements,
216 fprintf(
dt_out,
"%jd\n", (intmax_t)(*newtype));
223 int count,
int blocklength, XT_MPI2_CONST MPI_Aint array_of_displacements[],
224 MPI_Datatype oldtype, MPI_Datatype *newtype)
226 fprintf(
dt_out,
"MPI_Type_create_indexed_block(%d, %d, (MPI_Aint){\n", count, blocklength);
227 for (
int i = 0; i < count; ++i)
228 fprintf(
dt_out,
" %jd,\n", (intmax_t)array_of_displacements[i]);
229 fprintf(
dt_out,
"}, %jd);\n", (intmax_t)oldtype);
230 int rc = PMPI_Type_create_hindexed_block(count, blocklength,
231 array_of_displacements,
233 fprintf(
dt_out,
"%jd\n", (intmax_t)(*newtype));
240 MPI_Aint extent, MPI_Datatype *newtype)
242 fprintf(
dt_out,
"MPI_Type_create_resized(%jd, %jd, %jd);\n",
243 (intmax_t)oldtype, (intmax_t)lb, (intmax_t)extent);
244 int rc = PMPI_Type_create_resized(oldtype, lb, extent, newtype);
245 fprintf(
dt_out,
"%jd\n", (intmax_t)(*newtype));
252 MPI_Aint *array_of_displacements, MPI_Datatype *array_of_types,
253 MPI_Datatype *newtype)
255 fprintf(
dt_out,
"MPI_Type_struct(%d, (int){\n", count);
256 for (
int i = 0; i < count; ++i)
257 fprintf(
dt_out,
" %d,\n", array_of_blocklengths[i]);
258 fputs(
"}, (MPI_Aint[]){\n",
dt_out);
259 for (
int i = 0; i < count; ++i)
260 fprintf(
dt_out,
" %jd,\n", (intmax_t)array_of_displacements[i]);
261 fputs(
"}, (MPI_Datatype[]){\n",
dt_out);
262 for (
int i = 0; i < count; ++i)
263 fprintf(
dt_out,
" %jd,\n", (intmax_t)array_of_types[i]);
265 int rc = PMPI_Type_struct(
266 count, array_of_blocklengths, array_of_displacements,
267 array_of_types, newtype);
268 fprintf(
dt_out,
"%jd\n", (intmax_t)(*newtype));
274 XT_MPI2_CONST MPI_Aint array_of_displacements[],
275 XT_MPI2_CONST MPI_Datatype array_of_types[],
276 MPI_Datatype *newtype)
278 fprintf(
dt_out,
"MPI_Type_create_struct(%d, (int){\n", count);
279 for (
int i = 0; i < count; ++i)
280 fprintf(
dt_out,
" %d,\n", array_of_block_lengths[i]);
281 fputs(
"}, (MPI_Aint[]){\n",
dt_out);
282 for (
int i = 0; i < count; ++i)
283 fprintf(
dt_out,
" %jd,\n", (intmax_t)array_of_displacements[i]);
284 fputs(
"}, (MPI_Datatype[]){\n",
dt_out);
285 for (
int i = 0; i < count; ++i)
286 fprintf(
dt_out,
" %jd,\n", (intmax_t)array_of_types[i]);
288 int rc = PMPI_Type_create_struct(
289 count, array_of_block_lengths, array_of_displacements,
290 array_of_types, newtype);
291 fprintf(
dt_out,
"%jd\n", (intmax_t)(*newtype));
297 XT_MPI2_CONST
int gsize_array[], XT_MPI2_CONST
int distrib_array[],
298 XT_MPI2_CONST
int darg_array[], XT_MPI2_CONST
int psize_array[],
299 int order, MPI_Datatype oldtype,
300 MPI_Datatype *newtype)
302 int rc = PMPI_Type_create_darray(
303 size, rank, ndims, gsize_array, distrib_array, darg_array, psize_array,
304 order, oldtype, newtype);
305 fprintf(
dt_out,
"%jd\n", (intmax_t)(*newtype));
311 XT_MPI2_CONST
int size_array[],
312 XT_MPI2_CONST
int subsize_array[],
313 XT_MPI2_CONST
int start_array[],
315 MPI_Datatype oldtype,
316 MPI_Datatype *newtype)
318 int rc = PMPI_Type_create_subarray(ndims, size_array, subsize_array,
319 start_array, order, oldtype, newtype);
320 fprintf(
dt_out,
"%jd\n", (intmax_t)(*newtype));
328 fprintf(
dt_out,
"MPI_Type_free(&%jd);\n", (intmax_t)(*datatype));
329 int rc = PMPI_Type_free(datatype);
336 fprintf(
dt_out,
"MPI_Type_commit(&%jd);\n", (intmax_t)(*datatype));
337 int rc = PMPI_Type_commit(datatype);
int MPI_Type_create_struct(int count, XT_MPI2_CONST int array_of_block_lengths[], XT_MPI2_CONST MPI_Aint array_of_displacements[], XT_MPI2_CONST MPI_Datatype array_of_types[], MPI_Datatype *newtype)
int MPI_Type_struct(int count, int *array_of_blocklengths, MPI_Aint *array_of_displacements, MPI_Datatype *array_of_types, MPI_Datatype *newtype)
int MPI_Type_create_hvector(int count, int blocklength, MPI_Aint stride, MPI_Datatype oldtype, MPI_Datatype *newtype)
int MPI_Type_create_resized(MPI_Datatype oldtype, MPI_Aint lb, MPI_Aint extent, MPI_Datatype *newtype)
int MPI_Type_create_indexed_block(int count, int blocklength, XT_MPI2_CONST int array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype)
int MPI_Type_contiguous(int count, MPI_Datatype oldtype, MPI_Datatype *newtype)
int MPI_Type_free(MPI_Datatype *datatype)
int MPI_Type_create_subarray(int ndims, XT_MPI2_CONST int size_array[], XT_MPI2_CONST int subsize_array[], XT_MPI2_CONST int start_array[], int order, MPI_Datatype oldtype, MPI_Datatype *newtype)
int MPI_Type_create_darray(int size, int rank, int ndims, XT_MPI2_CONST int gsize_array[], XT_MPI2_CONST int distrib_array[], XT_MPI2_CONST int darg_array[], XT_MPI2_CONST int psize_array[], int order, MPI_Datatype oldtype, MPI_Datatype *newtype)
int MPI_Type_indexed(int count, XT_MPI2_CONST int array_of_blocklengths[], XT_MPI2_CONST int array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype)
int MPI_Type_hvector(int count, int blocklength, MPI_Aint stride, MPI_Datatype oldtype, MPI_Datatype *newtype)
static void init_instr(void)
int MPI_Type_create_hindexed(int count, XT_MPI2_CONST int array_of_blocklengths[], XT_MPI2_CONST MPI_Aint array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype)
int MPI_Type_dup(MPI_Datatype oldtype, MPI_Datatype *newtype)
int MPI_Type_vector(int count, int blocklength, int stride, MPI_Datatype oldtype, MPI_Datatype *newtype)
int MPI_Type_hindexed(int count, int array_of_blocklengths[], MPI_Aint array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype)
int MPI_Type_commit(MPI_Datatype *datatype)
#define MPI_Type_create_hindexed_block