Re: [mpich-discuss] How to make a non-MPI process to become a MPI process of MPI_COMM_WORLD?
Thanks, Lu. My simple code is as following. //server #include "mpi.h" int main(int argc, char *argv[]) { MPI_Comm client; MPI_Status status; char port_name[MPI_MAX_PORT_NAME]; int size, again; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &size); MPI_Open_port(MPI_INFO_NULL, port_name); printf("server port_name is %s\n\n", port_name); MPI_Comm_accept(port_name, MPI_INFO_NULL, 0, MPI_COMM_WORLD,&client); MPI_Comm_size(MPI_COMM_WORLD, &size); printf("At server, comm_size=%d @ MPI_COMM_WORLD=%x, Client_World=%x\n",size,MPI_COMM_WORLD, client); MPI_Comm_size(client, &size); printf("At server, client_size=%d @ MPI_COMM_WORLD=%x, Client_World=%x\n",size,MPI_COMM_WORLD, client); MPI_Comm_disconnect(&client); MPI_Finalize(); return 0; } //client #include "mpi.h" int main( int argc, char **argv ) { MPI_Comm server; char port_name[MPI_MAX_PORT_NAME]; int size; MPI_Init( &argc, &argv ); strcpy( port_name, argv[1] ); printf("server port name:%s\n",port_name); MPI_Comm_connect( port_name, MPI_INFO_NULL, 0, MPI_COMM_WORLD,&server ); MPI_Comm_size(MPI_COMM_WORLD, &size); printf("At client, comm_size=%d @ MPI_COMM_WORLD=%x, Server_World=%x\n",size,MPI_COMM_WORLD,server); MPI_Comm_size(server, &size); printf("At client, server_size=%d @ MPI_COMM_WORLD=%x, Server_World=%x\n",size,MPI_COMM_WORLD,server); MPI_Comm_disconnect( &server ); MPI_Finalize(); return 0; } The run command is as following. mpiexec -n 1 ./server mpiexec -n 1 ./client BUT, the SIZE is 1, NOT 2. My question is as before: How does the size of MPI_COMM_WORLD change to 2 ? At 2015-01-23 00:30:43, "Huiwei Lu" <[email protected]> wrote: You may take a look at MPI_Comm_accept and MPI_Comm_connect, which will connect a new client process to a server process. See Chap. 10 of MPI 3.0 standard (www.mpi-forum.org/docs/mpi-3.0/mpi30-report.pdf) for a detail example. -- Huiwei Lu Postdoc Appointee Mathematics and Computer Science Division Argonne National Laboratory http://www.mcs.anl.gov/~huiweilu/ On Thu, Jan 22, 2015 at 9:41 AM, haozi <[email protected]> wrote: Hi, guys. This web page (http://wiki.mpich.org/mpich/index.php/PMI_v2_Design_Thoughts) says: Singleton init. This is the process by which a program that was not started with mpiexec can become an MPI process and make use of all MPI features, including MPI_Comm_spawn, needs to be designed and documented, with particular attention to the disposition of standard I/O. Not all process managers will want to or even be able to create a new mpiexec process, so this needs to be negotiated. Similarly, the dispostion of stdio needs to be negotiated between the singleton process and the process manager. To address these issues, a new singleton init protocol has been implemented and tested with the gforker process manager. I am very interested in this function. Can this function solve the following question: At beginning, the MPI job uses the mpiexec commond to start three MPI processes. That is to say, there are three MPI processes in MPI_COMM_WORLD. At some time, the job find itself to need another MPI process to cooperate the three MPI processes. So the question is: Could PMI help an non-MPI process to become a MPI process of the current MPI_COMM_WORLD? That is to say, Could the non-MPI process use the PMI function to become a member process of the current MPI job which would have FOUR MPI processes in MPI_COMM_WORLD? Is there some method to solve question? Is anybody have some example? Thandks!!! _______________________________________________ discuss mailing list [email protected] To manage subscription options or unsubscribe: https://lists.mpich.org/mailman/listinfo/discuss _______________________________________________ discuss mailing list [email protected] To manage subscription options or unsubscribe: https://lists.mpich.org/mailman/listinfo/discuss
participants (1)
-
haozi