5 main( int argc, char **argv)
8 MPI_Aint offsets[2], lb, ub, extent;
9 MPI_Datatype tmp_type, newtype;
11 MPI_Init(&argc, &argv);
13 MPI_Comm_rank( MPI_COMM_WORLD, &rank );
17 MPI_Type_hindexed(1, blockcnt, offsets, MPI_BYTE, &tmp_type);
20 MPI_Type_hindexed(1, blockcnt, offsets, tmp_type, &newtype);
21 MPI_Type_commit(&newtype);
23 MPI_Type_lb(newtype, &lb);
24 MPI_Type_extent(newtype, &extent);
25 MPI_Type_ub(newtype, &ub);
27 /* Check that the results are correct */
29 printf("lb=%ld, ub=%ld, extent=%ld\n", lb, ub, extent);
30 printf("Should be lb=4, ub=5, extent=1\n");
32 if (lb != 4 || ub != 5 || extent != 1) {
33 printf ("lb = %ld (should be 4), ub = %ld (should be 5) extent = %ld should be 1\n", lb, ub, extent) ;
36 printf( " No Errors\n" );
39 MPI_Type_free(&tmp_type);
40 MPI_Type_free(&newtype);