[MPICH2-dev] Publish/Lookup

Robert Latham robl at mcs.anl.gov
Tue May 16 14:30:17 CDT 2006


On Tue, May 16, 2006 at 04:07:22PM -0300, Denis Lima wrote:
> Hello guys,
> 
> I'm not been able to use the Publish_name/LookUp_name functions in
> MPICH2.  Do you have any sample c code that works?


The 'server' has to do something like this:

        MPI_Comm newcomm;
        char port_name[MPI_MAX_PORT_NAME];

        MPI_Open_port(MPI_INFO_NULL, port_name);
        MPI_Publish_name("port_name", MPI_INFO_NULL, port_name);
        MPI_Comm_accept(port_name, MPI_INFO_NULL, 0, comm, &newcomm);


And the 'client':

        MPI_Comm newcomm;
        char port_name[MPI_MAX_PORT_NAME];

        MPI_Lookup_name("port_name", MPI_INFO_NULL, port_name);
        MPI_Comm_connect(port_name, MPI_INFO_NULL, 0, comm, &newcomm);


Naturally, use whatever you like instead of "port_name".  Also, i've
omitted checking return values. You'll need an MPD ring up and running
for this to work.  Can you elaborate on what is not working for you?

==rob

-- 
Rob Latham
Mathematics and Computer Science Division    A215 0178 EA2D B059 8CDF
Argonne National Labs, IL USA                B29D F333 664A 4280 315B




More information about the mpich2-dev mailing list