1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
4 * (C) 2003 by Argonne National Laboratory.
5 * See COPYRIGHT in top-level directory.
11 * This test checks to see if we can create a simple datatype
12 * made from many contiguous copies of a single struct. The
13 * struct is built with monotone decreasing displacements to
14 * avoid any struct->contig optimizations.
17 int main( int argc, char **argv )
19 int blocklens[8], psize, i, rank;
21 MPI_Datatype oldtypes[8];
22 MPI_Datatype ntype1, ntype2;
24 MPI_Init( &argc, &argv );
25 MPI_Comm_rank( MPI_COMM_WORLD, &rank );
29 displs[i] = (7-i) * sizeof(long);
30 oldtypes[i] = MPI_LONG;
32 MPI_Type_struct( 8, blocklens, displs, oldtypes, &ntype1 );
33 MPI_Type_contiguous( 65536, ntype1, &ntype2 );
34 MPI_Type_commit( &ntype2 );
36 MPI_Pack_size( 2, ntype2, MPI_COMM_WORLD, &psize );
38 MPI_Type_free( &ntype2 );
39 MPI_Type_free( &ntype1 );
41 /* The only failure mode has been SEGV or aborts within the datatype
44 printf( " No Errors\n" );