David Cronk
2008-08-28 20:46:51 UTC
This should work, but it is failing under SGI MPI and Open MPI. Can
anyone else get this to work or see anything I have made a mistake with?
It is a pretty simple example program. Running on 16 processors it
should create 4 sets of intercommunicators each with one master and 3
slaves.
Any insight is appreciated.
Dave.
#include <stdio.h>
#include <sys/time.h>
#include <string.h>
#include "mpi.h"
int main (int argc, char **argv)
{
int i, myrank, numprocs, color;
MPI_Comm my_comm;
MPI_Comm inter_comm;
MPI_Comm my_inter_comm;
MPI_Init (&argc, &argv);
MPI_Comm_size (MPI_COMM_WORLD, &numprocs);
MPI_Comm_rank (MPI_COMM_WORLD, &myrank);
color = (myrank < 4);
MPI_Comm_split (MPI_COMM_WORLD, color, 1, &my_comm);
if (color)
MPI_Intercomm_create (my_comm, 0, MPI_COMM_WORLD, 4, 12, &inter_comm);
else
MPI_Intercomm_create (my_comm, 0, MPI_COMM_WORLD, 0, 12, &inter_comm);
color = myrank % 4;
MPI_Comm_split (inter_comm, color, 1, &my_inter_comm);
MPI_Finalize ();
}
anyone else get this to work or see anything I have made a mistake with?
It is a pretty simple example program. Running on 16 processors it
should create 4 sets of intercommunicators each with one master and 3
slaves.
Any insight is appreciated.
Dave.
#include <stdio.h>
#include <sys/time.h>
#include <string.h>
#include "mpi.h"
int main (int argc, char **argv)
{
int i, myrank, numprocs, color;
MPI_Comm my_comm;
MPI_Comm inter_comm;
MPI_Comm my_inter_comm;
MPI_Init (&argc, &argv);
MPI_Comm_size (MPI_COMM_WORLD, &numprocs);
MPI_Comm_rank (MPI_COMM_WORLD, &myrank);
color = (myrank < 4);
MPI_Comm_split (MPI_COMM_WORLD, color, 1, &my_comm);
if (color)
MPI_Intercomm_create (my_comm, 0, MPI_COMM_WORLD, 4, 12, &inter_comm);
else
MPI_Intercomm_create (my_comm, 0, MPI_COMM_WORLD, 0, 12, &inter_comm);
color = myrank % 4;
MPI_Comm_split (inter_comm, color, 1, &my_inter_comm);
MPI_Finalize ();
}
--
Dr. David Cronk, Ph.D. phone: (865) 974-3735
Research Director fax: (865) 974-8296
Innovative Computing Lab http://www.cs.utk.edu/~cronk
University of Tennessee, Knoxville
Dr. David Cronk, Ph.D. phone: (865) 974-3735
Research Director fax: (865) 974-8296
Innovative Computing Lab http://www.cs.utk.edu/~cronk
University of Tennessee, Knoxville