1

When I run the following code with mpirun -n 2 ./out it works with no problem but with mpirun -n 3 ./out MPI_Win_allocate() does not return. I checked this out by printing to the screen before and after MPI_Win_allocate(). Also, if I comment out MPI_Bcast() the code works. What is the problem?

EDIT: Changed boost functions to standard ones to simplify the problem.

#include <mpi.h>

int main()
{
    MPI_Init(NULL, NULL);

    int nmesh;
    MPI_Bcast(&nmesh, 1, MPI_INT, 0, MPI_COMM_WORLD);         

    MPI_Win win;
    int* narrival;
    MPI_Win_allocate(1*sizeof(int), sizeof(int), MPI_INFO_NULL, MPI_COMM_WORLD, &narrival, &win);
    MPI_Win_free(&win);

    MPI_Finalize();

    return 0;
}
Shibli
  • 5,879
  • 13
  • 62
  • 126
  • I'm not familiar with the boost interface to MPI, but to me it looks like you haven't initialised the communicator world. Should you not have world=MPI_COMM_WORLD before the broadcast call? – David Henty Feb 08 '17 at 11:16
  • Adding `MPI_Barrier()` right after `MPI_Bcast()` solved the freezing of `MPI_Win_allocate()` but I do not know why. – Shibli Feb 08 '17 at 11:20
  • I have no problem running the code using OpenMPI on an Ubuntu laptop - what system are you using? – David Henty Feb 08 '17 at 12:21
  • OpenMPI 2.0.1, Ubuntu, Intel i3 processor. – Shibli Feb 08 '17 at 13:11

0 Answers0