Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
put the LGPL 2.1 in a specific file. This should make COPYING a bit easier to read
[simgrid.git] / examples / smpi / barrier.c
1 /* Copyright (c) 2009. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include <stdio.h>
8 #include <mpi.h>
9
10
11 int main(int argc, char **argv)
12 {
13   int size, rank;
14   int root = 0;
15   int value;
16   double start_timer;
17
18   MPI_Init(&argc, &argv);
19   MPI_Comm_size(MPI_COMM_WORLD, &size);
20   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
21
22   start_timer = MPI_Wtime();
23
24   MPI_Barrier(MPI_COMM_WORLD);
25
26   MPI_Barrier(MPI_COMM_WORLD);
27   if (0 == rank) {
28     printf("... Barrier ....\n");
29     printf("Elapsed=%lf s\n", MPI_Wtime() - start_timer);
30   }
31
32   MPI_Finalize();
33   return 0;
34 }