1 /* Copyright (c) 2014. 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. */
11 XBT_LOG_NEW_DEFAULT_CATEGORY(MM_mpi, "Messages for this SMPI test");
13 int main(int argc, char ** argv)
19 MPI_Init(&argc, &argv);
22 MPI_Comm_rank(MPI_COMM_WORLD,&rank);
24 double *a = malloc(sizeof(double) * M);
25 double *b = malloc(sizeof(double) * N);
28 err = MPI_Bcast(a, M, MPI_DOUBLE, 0, MPI_COMM_WORLD);
29 if (err != MPI_SUCCESS) {
30 perror("Error Bcast A\n"); MPI_Finalize(); exit(-1);
33 // Uncommenting this barrier fixes it!
34 // MPI_Barrier(MPI_COMM_WORLD);
37 err = MPI_Bcast(b, N, MPI_DOUBLE, 0, MPI_COMM_WORLD );
38 if (err != MPI_SUCCESS) {
39 perror("Error Bcast B\n"); MPI_Finalize(); exit(-1);
42 // Commenting out this barrier fixes it!!
43 MPI_Barrier(MPI_COMM_WORLD);
46 printf("Walltime = %g\n",MPI_Wtime());