~ubuntu-branches/ubuntu/raring/simgrid/raring

« back to all changes in this revision

Viewing changes to teshsuite/smpi/mpich-test/pt2pt/structlb.c

  • Committer: Package Import Robot
  • Author(s): Martin Quinson
  • Date: 2013-01-31 00:24:51 UTC
  • mfrom: (10.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20130131002451-krejhf7w7h24lpsc
Tags: 3.9~rc1-1
* New upstream release: the "Grasgory" release. Major changes:
  - Gras was completely removed from this version.
  - Documentation reorganization to ease browsing it.
  - New default value for the TCP_gamma parameter: 4MiB

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "mpi.h"
 
2
#include <stdio.h>
 
3
 
 
4
int main( int argc, char **argv)
 
5
{
 
6
    int blockcnt[2], size;
 
7
    MPI_Datatype tmptype, newtype, oldtypes[2];
 
8
    MPI_Aint offsets[2], extent, lb, ub;
 
9
 
 
10
    MPI_Init(&argc, &argv);
 
11
 
 
12
    blockcnt[0] = 1;
 
13
    offsets[0] = 1;
 
14
    oldtypes[0] = MPI_BYTE;
 
15
    blockcnt[1] = 1;    /* set upper bound to avoid padding */
 
16
    offsets[1] = 2;
 
17
    oldtypes[1] = MPI_UB;
 
18
    MPI_Type_struct(2, blockcnt, offsets, oldtypes, &tmptype);
 
19
    MPI_Type_commit(&tmptype);
 
20
 
 
21
    MPI_Type_size(tmptype, &size);
 
22
    MPI_Type_lb(tmptype, &lb);
 
23
    MPI_Type_ub(tmptype, &ub);
 
24
    MPI_Type_extent(tmptype, &extent);
 
25
#ifdef DEBUG
 
26
    printf("tmptype: size: %d lb: %ld ub: %ld ex: %ld\n",
 
27
           size, (long)lb, (long)ub, (long)extent);
 
28
#endif
 
29
        
 
30
    blockcnt[0] = 1;
 
31
    offsets[0] = 1;
 
32
    oldtypes[0] = tmptype;
 
33
    MPI_Type_struct(1, blockcnt, offsets, oldtypes, &newtype);
 
34
    MPI_Type_commit(&newtype);
 
35
 
 
36
    MPI_Type_size(newtype, &size);
 
37
    MPI_Type_lb(newtype, &lb);
 
38
    MPI_Type_ub(newtype, &ub);
 
39
    MPI_Type_extent(newtype, &extent);
 
40
#ifdef DEBUG
 
41
    printf("newtype: size: %d lb: %ld ub: %ld ex: %ld\n",
 
42
           size, (long)lb, (long)ub, (long)extent);
 
43
#endif  
 
44
    if (size != 1 || lb != 2 || ub != 3 || extent != 1) {
 
45
        printf("lb = %ld (should be 2), ub = %ld (should be 3) extent = %ld should be 1, size = %d (should be 1)\n",
 
46
               (long)lb, (long)ub, (long)extent, size);
 
47
    } else {
 
48
        printf( " No Errors\n" );
 
49
    }
 
50
    MPI_Type_free(&tmptype);
 
51
    MPI_Type_free(&newtype);
 
52
    MPI_Finalize();
 
53
 
 
54
    return 0;
 
55
}