[mpich-discuss] disable-auto-cleanup send/receive example
    Pavan Balaji 
    balaji at mcs.anl.gov
       
    Thu Nov  3 14:38:41 CDT 2011
    
    
  
On 11/03/2011 01:58 PM, Rob Stewart wrote:
> In the "what to do", I want to remove the failed rank, "ranki", from the
> communication group, and so next time "send()" is called, the failed
> rank will not be hit by a round robin send in the future.
Here's approximately what I'd do.
init(){
	MPI_Comm_dup(MPI_COMM_WORLD, &comm);
	MPI_Comm_group(comm, &group);
}
send(){
	err = MPI_Send(xs, x, MPI_INT, ranki, 0, comm);
	if (err != MPI_SUCCESS) {
		/* Exclude the failed rank */
		MPI_Group_excl(group, 1, &ranki, &newgroup);
		/* create new communicator excluding the failed rank */
		MPI_Comm_create_group(comm, newgroup, 1, &newcomm);
		group = newgroup;
		comm = newcomm;
	}
	send(); // try again
}
Obviously, you need to check for return codes for all functions, which I 
didn't do above.
  -- Pavan
-- 
Pavan Balaji
http://www.mcs.anl.gov/~balaji
    
    
More information about the mpich-discuss
mailing list