Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] Open specific port TCP/IP in MPI
From: Nulik Nol (nuliknol_at_[hidden])
Date: 2009-06-26 08:02:07


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