Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove few tests which may never finish, and change one that used too much stack...
[simgrid.git] / teshsuite / smpi / mpich-test / pt2pt / typelb.c
1 #include "mpi.h"
2 #include <stdio.h>
3
4 int
5 main( int argc, char **argv)
6 {
7     int blockcnt[2], rank;
8     MPI_Aint offsets[2], lb, ub, extent;
9     MPI_Datatype tmp_type, newtype;
10
11     MPI_Init(&argc, &argv);
12
13     MPI_Comm_rank( MPI_COMM_WORLD, &rank );
14     if (rank == 0) {
15         blockcnt[0] = 1;
16         offsets[0] = 3;
17         MPI_Type_hindexed(1, blockcnt, offsets, MPI_BYTE, &tmp_type);
18         blockcnt[0] = 1;
19         offsets[0] = 1;
20         MPI_Type_hindexed(1, blockcnt, offsets, tmp_type, &newtype);
21         MPI_Type_commit(&newtype);
22         
23         MPI_Type_lb(newtype, &lb);
24         MPI_Type_extent(newtype, &extent);
25         MPI_Type_ub(newtype, &ub);
26         
27         /* Check that the results are correct */
28 #ifdef DEBUG
29         printf("lb=%ld, ub=%ld, extent=%ld\n", lb, ub, extent);
30         printf("Should be lb=4, ub=5, extent=1\n");
31 #endif
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) ;
34         }
35         else {
36             printf( " No Errors\n" );
37         }
38
39         MPI_Type_free(&tmp_type);
40         MPI_Type_free(&newtype);
41
42     }
43     MPI_Finalize();
44     return 0;
45 }