[mpich-discuss] Issues with MPI_Comm_create

Rajeev Thakur thakur at mcs.anl.gov
Fri Mar 7 14:01:28 CST 2008


MPI_Comm_create returns MPI_COMM_NULL to processes not in the group, in this
case rank 0. So you need an if (myrank != 0) around the MPI_Comm_size.

Rajeev


> -----Original Message-----
> From: owner-mpich-discuss at mcs.anl.gov 
> [mailto:owner-mpich-discuss at mcs.anl.gov] On Behalf Of Arthur Wu
> Sent: Friday, March 07, 2008 12:48 PM
> To: mpich-discuss at mcs.anl.gov
> Cc: Arthur Wu
> Subject: [mpich-discuss] Issues with MPI_Comm_create
> 
> 
> Hi There,
> 
> I am trying to create a new communicator using the
> following textbook code. However, the created
> communicator is always MPI_COMM_NULL, as shown in the
> runtime error message. Since I could not find any
> example code in MPICH2 regarding communicator
> creation, my questions is this: does MPICH2 currently
> support creation of new communicators?
> 
> Thanks a lot.
> 
> Arthur Wu
> 
> >  
> > // create the worker communicator
> >     MPI_Group world_group, work_group;
> >     MPI_Comm  work_comm;
> >     int       excl_ranks[2];
> >     int nn=0;
> >  
> >     excl_ranks[0] = 1;
> >     excl_ranks[1] = 2;
> >     MPI_Comm_group(MPI_COMM_WORLD, &world_group);
> >     MPI_Group_incl(world_group, 2, excl_ranks,
> > &work_group);
> >     MPI_Comm_create(MPI_COMM_WORLD, work_group,
> > &work_comm);
> >     MPI_Comm_size(work_comm, &nn);
> >  
> >     fprintf(stderr,  "Sub comm size = %i\n", nn );
> >  
> 
> Runtime errors:
> 
> > 
> > C:\public\bin>mpiexec -n 3 -machinefile Config.txt
> > c:\public\bin\MpiApp.exe c:\t
> > emp\mpi\7 input.txt output.txt log.txt
> > Process   1 of 3 on
> > B00123F4418EA.corp.bankofamerica.com (pid 2168)
> > Process   0 of 3 on
> > B00123F4418EA.corp.bankofamerica.com (pid 4440)
> > Process   2 of 3 on
> > B000BCD9949B9.corp.bankofamerica.com (pid 208)
> >  
> > job aborted:
> > rank: node: exit code[: error message]
> > 0: B00123F4418EA: 1: Fatal error in MPI_Comm_size:
> > Invalid communicator,
> > error s
> > tack:
> > MPI_Comm_size(112): MPI_Comm_size(MPI_COMM_NULL,
> > size=000FED08) failed
> > MPI_Comm_size(70).: Null communicator
> > 1: B00123F4418EA: 1
> > 2: b000bcd9949b9: 1
> >  
> >  
> 
> 
>       
> ______________________________________________________________
> ______________________
> Looking for last minute shopping deals?  
> Find them fast with Yahoo! Search.  
> http://tools.search.yahoo.com/newsearch/category.php?category=shopping
> 
> 




More information about the mpich-discuss mailing list