[mpich-discuss] Running one MPI program from another
Rod Cook
rod at cookies.demon.co.uk
Wed Apr 22 10:11:56 CDT 2009
Jayesh,
I can get my example code to work using MPI_Comm_spawn but it doesn't work for my actual application. The problem with using MPI_Comm_spawn is that I don't know how to tell that the spawned program has finished -- this is why I used CreateProcess because it is possible to wait for the program to terminate. The spawned program could be a non MPI executable or a standalone MPI executable which can't communicate with the program calling MPI_Comm_spawn.
Cheers,
Rod
----- Original Message -----
From: Jayesh Krishna
To: 'Rod Cook'
Cc: mpich-discuss at mcs.anl.gov
Sent: Wednesday, April 22, 2009 3:40 PM
Subject: RE: [mpich-discuss] Running one MPI program from another
Hi,
Did you try MPI_Comm_spawn() ?
Regards,
Jayesh
------------------------------------------------------------------------------
From: mpich-discuss-bounces at mcs.anl.gov [mailto:mpich-discuss-bounces at mcs.anl.gov] On Behalf Of Rod Cook
Sent: Wednesday, April 22, 2009 7:50 AM
To: mpich-discuss at mcs.anl.gov
Subject: [mpich-discuss] Running one MPI program from another
Hi,
I am trying to run an MPI program (prog) from another MPI program (test) using CreateProcess under Windows XP. I am using MPICH2 v1.08.
Source for test
#include "stdafx.h"
#include <afx.h>
#include "mpi.h"
int run_program( char * program )
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
if( !CreateProcess( NULL, program, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ) )
{
return -1;
}
WaitForSingleObject( pi.hProcess, INFINITE );
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
return 0;
}
int main(int argc, char* argv[])
{
MPI_Init(NULL,NULL);
run_program("prog");
MPI_Finalize();
return 0;
}
Source for prog
#include "stdafx.h"
#include "mpi.h"
int main(int argc, char* argv[])
{
MPI_Init( NULL, NULL );
MPI_Finalize();
return 0;
}
I get the following error when I run test:
>mpiexec -n 1 test
MPIDU_Sock_post_connect failed.
[0] PMI_ConnectToHost failed: unable to post a connect to Yellowtail yellowtail
:2057, error: Unknown error class, error stack:
MPIDU_Sock_post_connect(1228): unable to connect to Yellowtail yellowtail
on port 2057, exhausted all endpoints (errno -1)
MPIDU_Sock_post_connect(1275): unable to connect to on port 2057,
No connection could be made because the target machine actively refused it. (er
rno 10061)
MPIDU_Sock_post_connect(1275): unable to connect to yellowtail on port 2057, No
connection could be made because the target machine actively refused it. (errno
10061)
MPIDU_Sock_post_connect(1275): unable to connect to Yellowtail on port 2057, No
connection could be made because the target machine actively refused it. (errno
10061)
uPMI_ConnectToHost returning PMI_FAIL
[0] PMI_Init failed.
Fatal error in MPI_Init: Other MPI error, error stack:
MPIR_Init_thread(294): Initialization failed
MPID_Init(83)........: channel initialization failed
MPID_Init(334).......: PMI_Init returned -1
>
In my actual application prog is either a standalone MPI program which I can't change or a non MPI program (in which case test works) .
I'd be gratefull for any help.
Thanks
Rod Cook
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20090422/9721efad/attachment.htm>
More information about the mpich-discuss
mailing list