[Mpi-forum] Question about MPI_Info set on communicators

Jeff Hammond jeff.science at gmail.com
Mon Feb 15 17:13:51 CST 2016

The only logical result is for newcomm to have "use_shared_memory"="no",
because that is state associated with comm, and what is duplicated is the
state of comm.  That the user originally provided "use_shared_memory"="yes"
is irrelevant to MPI_Comm_dup, because the implementation is not going to
track such things, only the actual state that results from the failed
attempt to set this key to "yes" during MPI_Comm_set_info, at which point,
the communicator only knows "use_shared_memory"="no".

The way for the user to have any hope of achieving a "yes" result is to
call "MPI_Comm_dup_with_info(comm, myinfo, &newcom);", which will attempt
to set "use_shared_memory"="yes" without regards to the prior failed


On Mon, Feb 15, 2016 at 3:04 PM, Jeff Squyres (jsquyres) <jsquyres at cisco.com
> wrote:

> 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/

Jeff Hammond
jeff.science at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpi-forum.org/pipermail/mpi-forum/attachments/20160215/bec7376c/attachment-0001.html>

More information about the mpi-forum mailing list