1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
3 * (C) 2001 by Argonne National Laboratory.
4 * See COPYRIGHT in top-level directory.
12 /* Make sure datatype creation is independent of data size */
18 /* Don't make the number of loops too high; we create so many
19 * datatypes before trying to free them */
22 int main(int argc, char *argv[])
24 MPI_Datatype column[LOOPS], xpose[LOOPS];
25 double t[NUM_SIZES], ttmp, tmean;
27 int i, j, errs = 0, nrows, ncols;
29 MPI_Init(&argc, &argv);
33 for (i = 0; i < NUM_SIZES + SKIP; i++) {
38 for (j = 0; j < LOOPS; j++) {
39 MPI_Type_vector(nrows, 1, ncols, MPI_INT, &column[j]);
40 MPI_Type_hvector(ncols, 1, sizeof(int), column[j], &xpose[j]);
41 MPI_Type_commit(&xpose[j]);
45 t[i - SKIP] = MPI_Wtime() - ttmp;
49 for (j = 0; j < LOOPS; j++) {
50 MPI_Type_free(&xpose[j]);
51 MPI_Type_free(&column[j]);
59 /* Now, analyze the times to see that they are nearly independent
61 for (i = 0; i < NUM_SIZES; i++) {
62 /* The difference between the value and the mean is more than
63 * a "FRACTION" of mean. */
64 if (fabs(t[i] - tmean) > (FRACTION * tmean))
69 fprintf(stderr, "too much difference in performance: ");
70 for (i = 0; i < NUM_SIZES; i++)
71 fprintf(stderr, "%.3f ", t[i] * 1e6);
72 fprintf(stderr, "\n");
75 printf(" No Errors\n");