Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #181 from bcamus/master
[simgrid.git] / teshsuite / smpi / isp / umpire / type-no-free-exhaustive.c
1 /* -*- Mode: C; -*- */
2 /* Creator: Bronis R. de Supinski (bronis@llnl.gov)  */
3
4 /* type-no-free-exhaustive.c -- use all type constructors without freeing */
5
6 #ifndef lint
7 static char *rcsid =
8   "$Header: /usr/gapps/asde/cvs-vault/umpire/tests/type-no-free-exhaustive.c,v 1.1 2002/05/29 16:09:51 bronis Exp $";
9 #endif
10
11 #include <stdio.h>
12 #include <string.h>
13 #include "mpi.h"
14
15
16 #define TYPE_CONSTRUCTOR_COUNT 6
17
18 int
19 main (int argc, char **argv)
20 {
21   int nprocs = -1;
22   int rank = -1;
23   MPI_Comm comm = MPI_COMM_WORLD;
24   char processor_name[128];
25   int namelen = 128;
26   int i;
27   int blocklens[2], displs[2];
28   MPI_Datatype newtype[TYPE_CONSTRUCTOR_COUNT];
29   MPI_Datatype newtype2[TYPE_CONSTRUCTOR_COUNT];
30
31   /* init */
32   MPI_Init (&argc, &argv);
33   MPI_Comm_size (comm, &nprocs);
34   MPI_Comm_rank (comm, &rank);
35   MPI_Get_processor_name (processor_name, &namelen);
36   printf ("(%d) is alive on %s\n", rank, processor_name);
37   fflush (stdout);
38
39   newtype2[0] = MPI_DOUBLE;
40   newtype2[1] = MPI_CHAR;
41   blocklens[0] = blocklens[1] = 1;
42   displs[0] = 0;
43   displs[1] = 8;
44
45   MPI_Barrier (comm);
46
47   /* create the types */
48   MPI_Type_struct (2, blocklens, displs, newtype2, &newtype[0]);
49   MPI_Type_vector (2, 3, 4, newtype[0], &newtype[1]);
50   MPI_Type_hvector (3, 2, 192, newtype[1], &newtype[2]);
51   displs[1] = 2;
52   MPI_Type_indexed (2, blocklens, displs, newtype[2], &newtype[3]);
53   displs[1] = 512;
54   MPI_Type_hindexed (2, blocklens, displs, newtype[3], &newtype[4]);
55   displs[1] = 8;
56   MPI_Type_contiguous (10, newtype[4], &newtype[5]);
57
58   MPI_Barrier (comm);
59
60   printf ("(%d) Finished normally\n", rank);
61   MPI_Finalize ();
62 }
63
64 /* EOF */