[Mpi-forum] Question about MPI_Info set on communicators

Jeff Squyres (jsquyres) jsquyres at cisco.com
Mon Feb 15 17:04:44 CST 2016

On February 15, 2016 at 5:58:48 PM, Jeff Hammond (jeff.science at gmail.com) wrote:
> Well, this program will not compile, since MPI_Comm_dup_with_info takes
> three arguments. Furthermore, the info is NOT duplicated and instead the
> second argument is the info the user provides for the new communicator.

Yeah, that was a typo -- it should be MPI_Comm_dup (i.e., use the info that was set on the communicator).  Here's the correct version:

MPI_Info_set(myinfo, "use_shared_memory", "yes");
MPI_Comm_set_info(comm, myinfo);
MPI_Comm_get_info(comm, myinfo_returned);
// Assume here that there was not enough shared memory available to use shared-memory for
// communication on this comm, so MPI_Info_get() tells us that use_shared_memory is "no".

// ...time passes, and now assume there is more shared-memory available
MPI_Comm_dup(comm, &newcom);
MPI_comm_get_info(newcom, myinfo_returned);

Jeff Squyres
jsquyres at cisco.com  
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/

More information about the mpi-forum mailing list