1 /* Copyright (c) 2007, 2009, 2010. The SimGrid Team.
2 * All rights reserved. */
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. */
10 int main(int argc, char **argv)
20 MPI_Init(&argc, &argv);
21 MPI_Comm_size(MPI_COMM_WORLD, &size);
22 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
24 start_timer = MPI_Wtime();
26 printf("rank %d has value %d\n", rank, value);
27 MPI_Reduce(&value, &sum, 1, MPI_INT, MPI_SUM, root, MPI_COMM_WORLD);
29 printf("On root: sum=%d\n", sum);
30 printf("Elapsed time=%lf s\n", MPI_Wtime() - start_timer);