$subject_val = "Re: [OMPI users] Open specific port TCP/IP in MPI"; include("../../include/msg-header.inc"); ?>
Subject: Re: [OMPI users] Open specific port TCP/IP in MPI
From: Ralph Castain (rhc_at_[hidden])
Date: 2009-06-26 09:57:21
How are you trying to use this port? Are you expecting that to be the
port used for MPI communications?
We create the port string based on the actual TCP/IP contact info for
this process on our out-of-band comm channel. This has nothing to do
with whatever port might be used for MPI communication. So passing a
port number in is meaningless and is ignored since the process isn't
listening on that port.
By the time you make this call, all of the ports for the process have
already been defined and opened.
What you need to do is use the static port params to set the port when
you first execute. Then MPI_Open_port will wind up using it.
The proper syntax for doing this depends on whether you are trying to
set it for MPI comm or for OOB comm or both. Do an:
ompi_info --param btl tcp
to see how to set it for MPI comm, and
ompi_info --param oob tcp
to see how to set it for OOB comm. Make sure you specify a number of
ports >= #procs/node as each proc will open its own port! Also, note
that you cannot specify which rank opens what port - they'll each just
try the ports in the specified range until they get one.
Ralph
On Jun 26, 2009, at 6:02 AM, Nulik Nol wrote:
> Hi,
> i would like to know if it is possible to make a client/server with
> MPI where the application A (client) would connect to application B
> (server) using a specific TCP/IP port ? I have tried this code but it
> opens a port using some mysterious protocol (which looks like TIPC
> btw), what is going on?
>
> [root_at_niko code]# cat popserv.c
> #include <stdio.h>
> #include <mpi.h>
>
> #define _PORT_NAME_ "5555\0"
>
> int main(int argc,char *argv[]){
> int rank,numtasks;
> char myport[MPI_MAX_PORT_NAME]=_PORT_NAME_;
>
> MPI_Init(&argc,&argv);
> MPI_Comm_rank(MPI_COMM_WORLD, &rank);
> MPI_Comm_size(MPI_COMM_WORLD, &numtasks);
>
> MPI_Comm intercomm;
> /* ... */
> printf("port name before the call: %s\n", myport);
> MPI_Open_port(MPI_INFO_NULL, myport);
> printf("port name after the call: %s\n", myport);
> MPI_Publish_name("orion", MPI_INFO_NULL, myport);
> MPI_Comm_accept(myport, MPI_INFO_NULL, 0, MPI_COMM_SELF,
> &intercomm);
> /* do something with intercomm */
>
> MPI_Finalize();
> }
> [root_at_niko code]# mpicc -I/usr/include/openmpi/1.2.4-gcc/
> -L/usr/lib64/openmpi/1.2.4-gcc -lmpi -o popserv popserv.c
> [root_at_niko code]# mpirun -np 1 ./popserv
> port name before the call: 5555
> port name after the call: 0.1.0:2000
> ^Cmpirun: killing job...
>
> mpirun noticed that job rank 0 with PID 18899 on node niko exited on
> signal 15 (Terminated).
> [root_at_niko code]#
>
> Is there any examples of a client/server TCP/IP application for Open
> MPI ?
>
> Thanks in advance
>
> --
> ==================================
> The power of zero is infinite
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users