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) {
19 MPI_Init(&argc, &argv);
20 MPI_Comm_size(MPI_COMM_WORLD, &size);
21 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
23 start_timer = MPI_Wtime();
25 printf("rank %d has value %d\n", rank, value);
26 MPI_Reduce(&value, &sum, 1, MPI_INT, MPI_SUM, root, MPI_COMM_WORLD);
28 printf("On root: sum=%d\n",sum);
29 printf("Elapsed time=%lf s\n", MPI_Wtime()-start_timer);