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.