Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ignore generated tesh files
[simgrid.git] / teshsuite / smpi / isp / umpire / hello.c
1 /* -*- C -*- 
2
3    @PROLOGUE@
4
5    ----- 
6
7    Jeffrey Vetter vetter@llnl.gov
8    Center for Applied Scientific Computing, LLNL
9    31 Oct 2000
10
11    hello.c -- simple hello world app
12
13  */
14
15 #ifndef lint
16 static char *rcsid = "$Header: /usr/gapps/asde/cvs-vault/umpire/tests/hello.c,v 1.2 2000/12/04 19:09:46 bronis Exp $";
17 #endif
18
19 #include "mpi.h"
20
21 main (int argc, char **argv)
22 {
23   int nprocs = -1;
24   int rank = -1;
25   int recvbuf = 0;
26
27   MPI_Init (&argc, &argv);
28   MPI_Comm_size (MPI_COMM_WORLD, &nprocs);
29   MPI_Comm_rank (MPI_COMM_WORLD, &rank);
30   printf ("MPI comm size is %d with rank %d executing\n", nprocs, rank);
31   MPI_Barrier (MPI_COMM_WORLD);
32   MPI_Reduce (&rank, &recvbuf, 1, MPI_INT, MPI_MAX, 0, MPI_COMM_WORLD);
33   if (rank == 0)
34     {
35       printf ("Reduce max is %d\n", recvbuf);
36     }
37   MPI_Barrier (MPI_COMM_WORLD);
38   MPI_Finalize ();
39   printf ("(%d) Finished normally\n", rank);
40 }
41
42
43 /* eof */