[mpich-discuss] Client - server programs on Windows
Thierry Roudier
thierry.roudier at kiastek.com
Tue Aug 23 15:13:36 CDT 2011
Hi Darius & Jayesh,
I tried both: the environment variable and the code for the client
below. No success.
Thanks for your help. I am thinking to find another way by using
intra-communicators instead of inter-communicators.
Thanks again. I appreciate your help.
Thierry
On 23/08/2011 9:11 PM, Jayesh Krishna wrote:
> Hi,
> Can you try specifying the sock channel (add another environment variable "MPICH2_CHANNEL=sock" to the process environment) and see if it makes a difference ?
>
> Regards,
> Jayesh
>
> ----- Original Message -----
> From: "Darius Buntinas"<buntinas at mcs.anl.gov>
> To: mpich-discuss at mcs.anl.gov
> Sent: Tuesday, August 23, 2011 2:01:05 PM
> Subject: Re: [mpich-discuss] Client - server programs on Windows
>
> I just tried it on Linux and it worked for me (after I modified the program to accept the port name form the command line). Double check that the port name used on the client is exactly the same as on the server.
>
> Here's the client.c program I used if you want to try it out. Note that because the port name contains $ you may need to quote or otherwise escape the string when you pass it on the command line (at least in Linux you do).
>
> Sorry I can't be of more help with Windows.
>
> -d
>
> #include<stdio.h>
> #include<mpi.h>
> int main(int nArgc, char ** sArgv)
> {
> int nMyRank;
> MPI_Comm mInterComm;
> int nRet;
>
> char *sPortName;
>
> if (nArgc != 2)
> return -1;
>
> 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);
>
> sPortName = sArgv[1];
>
> 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;
> }
>
>
> On Aug 23, 2011, at 1:38 PM, Thierry Roudier wrote:
>
>> I tried this solution. But it doesn't work. I got the same behavior as described in my test below: Programs are respectively blocked in the Accept and Connect functions.
>> Thierry
>>
>> On 23/08/2011 7:35 PM, Darius Buntinas wrote:
>>> Have you tried starting each one with a separate mpiexec? Unless there are some constraints on doing this on Windows, it should work if you give the port name correctly to the client.
>>>
>>> -d
>>>
>>>
>>> On Aug 23, 2011, at 11:06 AM, Thierry Roudier wrote:
>>>
>>>> Actually it's one of my constraints: I cannot run the programs in the same command line.
>>>>
>>>> Thierry
>>>>
>>>> On 23/08/2011 5:52 PM, Darius Buntinas wrote:
>>>>> If you want to run two different binaries in the same application you can separate them by a colon (:). E.g.,
>>>>>
>>>>> mpiexec -n 4 prog1 : -n 2 prog2
>>>>>
>>>>> This will start 4 processes with the prog1 executable and 2 processes with the prog2 executable.
>>>>>
>>>>> Is this what you're trying to do?
>>>>>
>>>>> -d
>>>>>
>>>>>
>>>>> On Aug 23, 2011, at 10:31 AM, Thierry Roudier wrote:
>>>>>
>>>>>> Thanks Darius for your answer. Unfortunately, by running mpiexec I didn't find a way to set a unique KVS and domain name. Then the programs run in 2 different scopes. And it seems that is the reason why they cannot communicate together.
>>>>>> Regards,
>>>>>>
>>>>>> Thierry
>>>>>>
>>>>>> On 23/08/2011 4:50 PM, Darius Buntinas wrote:
>>>>>>> A pmi server is needed to exchange connection information (ip address and port) between the processes. Mpiexec provides this. Sorry, there's really no way I can see to do this statically.
>>>>>>>
>>>>>>> -d
>>>>>>>
>>>>>>> On Aug 23, 2011, at 2:40 AM, Thierry Roudier wrote:
>>>>>>>
>>>>>>>> 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
>>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> mpich-discuss mailing list
>>>>>>>> mpich-discuss at mcs.anl.gov
>>>>>>>> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>>>>>>> _______________________________________________
>>>>>>> mpich-discuss mailing list
>>>>>>> mpich-discuss at mcs.anl.gov
>>>>>>> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>>>>>> _______________________________________________
>>>>>> mpich-discuss mailing list
>>>>>> mpich-discuss at mcs.anl.gov
>>>>>> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>>>>> _______________________________________________
>>>>> mpich-discuss mailing list
>>>>> mpich-discuss at mcs.anl.gov
>>>>> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>>>> _______________________________________________
>>>> mpich-discuss mailing list
>>>> mpich-discuss at mcs.anl.gov
>>>> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>>> _______________________________________________
>>> mpich-discuss mailing list
>>> mpich-discuss at mcs.anl.gov
>>> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>> _______________________________________________
>> mpich-discuss mailing list
>> mpich-discuss at mcs.anl.gov
>> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
> _______________________________________________
> mpich-discuss mailing list
> mpich-discuss at mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
More information about the mpich-discuss
mailing list