[mpich-discuss] Client - server programs on Windows

Thierry Roudier thierry.roudier at kiastek.com
Tue Aug 23 02:40:53 CDT 2011


Hi,

Did someone already try this kind of config?
Thank you very much!

Best regards,

Thierry

On 17/08/2011 9:14 PM, Thierry Roudier wrote:
> Hi,
>
> I try to connect 2 programs together using MPICH2 v1.4 between 2 
> Windows 7 64-bit computers.
> I tested various configurations without success. Below is the last 
> config I tried:
>
> - Windows 1: Server
> From a command prompt I set the following variables, and ran the server:
> set PMI_ROOT_HOST=windows_1
> set PMI_KVS=mpich2
> set PMI_ROOT_LOCAL=1
> set PMI_ROOT_PORT=9222
> set PMI_SIZE=2
> set PMI_RANK=0
> Here is the C code for the server:
> #include <stdio.h>
> #include <mpi.h>
> int main(int nArgc, char ** sArgv)
> {
>     int nMyRank = 0;
>     MPI_Comm mInterComm;
>     int nRet;
>
>     char sPortName[MPI_MAX_PORT_NAME];
>
>     nRet = MPI_Init(&nArgc, &sArgv);
>     printf("Init - nRet: %d\n", nRet);
>     fflush(stdout);
>     nRet = MPI_Comm_rank(MPI_COMM_WORLD, &nMyRank);
>     printf("Comm_rank - nRet: %d - MyRank: %d\n", nRet, nMyRank);
>     fflush(stdout);
>
>     nRet = MPI_Open_port(MPI_INFO_NULL, sPortName);
>     printf("Open_port - nRet: %d - Port name: -%s-\n", nRet, sPortName);
>     fflush(stdout);
>
>     nRet = MPI_Comm_accept(sPortName, MPI_INFO_NULL, 0, 
> MPI_COMM_WORLD, &mInterComm);
>     printf("Comm_accept - nRet: %d\n", nRet);
>     fflush(stdout);
>
>     MPI_Comm_disconnect(&mInterComm);
>     MPI_Finalize();
>
>     return 0;
> }
>
>
> - Windows 2: Client (on a command prompt on the second computer)
> set PMI_ROOT_HOST=windows_1
> set PMI_KVS=mpich2
> set PMI_ROOT_LOCAL=0
> set PMI_ROOT_PORT=9222
> set PMI_SIZE=2
> set PMI_RANK=1
> Here is the C code for the client:
> #include <stdio.h>
> #include <mpi.h>
> int main(int nArgc, char ** sArgv)
> {
>     int nMyRank;
>     MPI_Comm mInterComm;
>     int nRet;
>
>     char sPortName[MPI_MAX_PORT_NAME];
>     char sPortNumber[MPI_MAX_PORT_NAME];
>
>     nRet = MPI_Init(&nArgc, &sArgv);
>     printf("Init - nRet: %d\n", nRet);
>     fflush(stdout);
>     nRet = MPI_Comm_rank(MPI_COMM_WORLD, &nMyRank);
>     printf("Comm_rank - nRet: %d - MyRank: %d\n", nRet, nMyRank);
>     fflush(stdout);
>
>     printf("Enter the port number: ");
>     fflush(stdout);
>     gets(sPortNumber);
>     sprintf(sPortName, "tag=0 description=windows_1 port=%s 
> ifname=192.168.1.101 ", sPortNumber);
>
>     printf("Connecting to: -%s-\n", sPortName);
>     fflush(stdout);
>     nRet = MPI_Comm_connect(sPortName, MPI_INFO_NULL, 0, 
> MPI_COMM_WORLD, &mInterComm);
>     printf("Comm_connect - nRet: %d\n", nRet);
>     fflush(stdout);
>
>     MPI_Comm_disconnect(&mInterComm);
>     MPI_Finalize();
>
>     return 0;
> }
>
> I don't use mpiexec. I directly start the programs on each computer 
> from the command prompts. And the smpd services are stopped.
> Note: I also checked without fixing the variables above, and with a 
> mpiexec command (smpd(s) running). It doesn't work. Same problem as 
> described below.
>
> The issue I encountered is the following: The server initializes, wait 
> in the MPI_Init function until the client starts. Once the client 
> initialized, both programs get their respective rank 0 (server) and 1 
> (client). The server opens the port and displays the info. I enter the 
> port number in the client program. And both waits. The connection is 
> never established. The server waits in MPI_Comm_accept and the client 
> waits in MPI_Comm_connect.
>
> Note: I didn't set a domain name on my machines. I only set a unique 
> workgroup name.
>
> Any help would be really appreciated.
>
> Regards,
>
> Thierry
>


More information about the mpich-discuss mailing list