5

I wish to multi-cast to a group of no more than 4 machines, does MPI_bcast still save a lot of time over multiple uni-casts (bearing in mind that my group size is small)?

I have written the following function to create a new communicator given the number of machines and ranks of those machines.

void createCommunicator(MPI_Comm *NGBRS_WORLD, int num_ngbrs, int *ngbrs_ranks)
{
        MPI_Group NGBRS_GROUP, MPI_COMM_GROUP;

        int ret = MPI_Comm_group(MPI_COMM_WORLD, &MPI_COMM_GROUP);
        printf("RETURNED %d\n", ret);

        ret = MPI_Group_incl(MPI_COMM_GROUP, num_ngbrs, ngbrs_ranks, &NGBRS_GROUP);
        printf("RETURNED %d\n", ret);

        ret = MPI_Comm_create(MPI_COMM_WORLD, NGBRS_GROUP, NGBRS_WORLD);
        printf("RETURNED : %d\n", ret);
}

When I call this function, the output is:

RETURNED 0
RETURNED 0

and the program just hangs at MPI_Comm_create

Any ideas for what might be wrong or how I might debug the problem? Note that I have dynamically allocated ngbrs_ranks to be of size num_ngbrs.

rene
  • 41,474
  • 78
  • 114
  • 152
NewToAndroid
  • 581
  • 7
  • 25
  • 1
    To know for sure, we'd need to confirm that the values of `ngbrs_ranks` is the same on all ranks. Also, remember that everyone in `MPI_COMM_WORLD` needs to call `createCommunicator`, even if they won't be in `NGBRS_WORLD`. – Wesley Bland Mar 08 '14 at 17:30
  • @WesleyBland This is exactly what I discovered. Everyone needs to call createCommunicator. Is there a way to create a new communicator without involving everyone? Ideally, is there a way for one process to create the new communicator? – NewToAndroid Mar 08 '14 at 19:47
  • 1
    There's not a way to have one process create a communicator, but if you use a version of an MPI library that supports MPI-3, you can use `MPI_COMM_CREATE_GROUP`. – Wesley Bland Mar 08 '14 at 19:51
  • `MPI_COMM_CREATE_GROUP` is still collective but only over the processes in the new group and not over all processes in the old communicator's group. – Hristo Iliev Mar 09 '14 at 10:44
  • Would be very interested if you have found a resolution to this. – bob.sacamento Dec 29 '16 at 22:55

0 Answers0