I was doing the work to integrate OpenMPI into our application, and we did not want to rely on mpirun. And it seems that singleton MPI_INIT could meet our need. So I wrote a client/sever demo to verify it. However, it did not work. Is there anything wrong here or OpenMPI does not support connect/accept work under singleton MPI_INIT?
The way I started client/server: ./server ./client $port_name(The port name is printed in server side) I testes this on two versions(1.8.8 and 2.0.1) On 1.8.8: Trying connect to 2164981760.0;tcp://10.152.111.77,169.254.182.77:55937 +2164981761.0;tcp://10.152.111.77,169.254.182.77:21560:300 -------------------------------------------------------------------------- An attempt was made to send a message to a process whose address is unknown: Sender: [[50549,1],0] From node: busaa024 Recipient: [[50549,1],0] On node: busaa024 The message could not be delivered, and we are aborting. On 2.0.1: timeout after 60s Trying connect to 2540140922.0:2850261964 [busj50bda16.us.oracle.com:31952] OPAL ERROR: Timeout in file base/pmix_base_fns.c at line 193 [busj50bda16:31952] *** An error occurred in MPI_Comm_connect [busj50bda16:31952] *** reported by process [139681870123024,0] [busj50bda16:31952] *** on communicator MPI_COMM_WORLD [busj50bda16:31952] *** MPI_ERR_UNKNOWN: unknown error [busj50bda16:31952] *** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort, [busj50bda16:31952] *** and potentially your MPI job) The server code: #include<mpi.h> #include<stdio.h> #include<stdlib.h> int size, rank, msg; int main(int argc, char *argv[]){ MPI_Comm cliente; MPI_Status status; char portname[MPI_MAX_PORT_NAME]; MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD,&size); MPI_Comm_rank(MPI_COMM_WORLD,&rank); MPI_Open_port(MPI_INFO_NULL, portname); printf("portname: %s\n", portname); MPI_Comm_accept(portname, MPI_INFO_NULL, 0, MPI_COMM_SELF, &cliente); printf("client connected\n"); MPI_Recv(&msg, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, cliente, &status); printf("msg: %d\n", msg); MPI_Comm_free(&cliente); MPI_Close_port(portname); MPI_Finalize(); } The client code: #include<mpi.h> #include<stdio.h> #include<stdlib.h> #include<string.h> int size, rank; int main(int argc, char *argv[]){ MPI_Comm servidor; int msg, tag, dest; char portname[MPI_MAX_PORT_NAME]; MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD,&size); MPI_Comm_rank(MPI_COMM_WORLD,&rank); if (argc >= 2){ printf("Trying connect to %s\n", argv[1]); strcpy(portname, argv[1]); MPI_Comm_connect(portname, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &servidor); msg = 42; tag = 0; dest = 0; MPI_Send(&msg, 1, MPI_INT, dest, tag, servidor); MPI_Comm_disconnect(&servidor); } MPI_Finalize(); } Thanks, Bright Wang
_______________________________________________ users mailing list users@lists.open-mpi.org https://rfd.newmexicoconsortium.org/mailman/listinfo/users