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.
10 int main( int argc, char **argv)
12 int blockcnt[2], rank;
13 MPI_Aint offsets[2], lb, ub, extent;
14 MPI_Datatype tmp_type, newtype;
16 MPI_Init(&argc, &argv);
18 /* Set some values in locations that should not be accessed */
22 MPI_Comm_rank( MPI_COMM_WORLD, &rank );
26 MPI_Type_hindexed(1, blockcnt, offsets, MPI_BYTE, &tmp_type);
29 MPI_Type_hindexed(1, blockcnt, offsets, tmp_type, &newtype);
30 MPI_Type_commit(&newtype);
32 MPI_Type_lb(newtype, &lb);
33 MPI_Type_extent(newtype, &extent);
34 MPI_Type_ub(newtype, &ub);
36 /* Check that the results are correct */
38 printf("lb=%ld, ub=%ld, extent=%ld\n", lb, ub, extent);
39 printf("Should be lb=4, ub=5, extent=1\n");
41 if (lb != 4 || ub != 5 || extent != 1) {
42 printf ("lb = %d (should be 4), ub = %d (should be 5) extent = %d should be 1\n", (int)lb, (int)ub, (int)extent) ;
45 printf( " No Errors\n" );
48 MPI_Type_free(&tmp_type);
49 MPI_Type_free(&newtype);