<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">One problem is that the spawned child is not calling MPI_INTERCOMM_MERGE. The child needs to call the merge function in the 'else' part of your 'if (parentcomm == MPI_COMM_NULL)'.<br>
<br>
-Nick<br>
<div style="font-family: Times New Roman; color: rgb(0, 0, 0); font-size: 16px;">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF597404"><font color="#000000" face="Tahoma" size="2"><b>From:</b> mpich-discuss-bounces@mcs.anl.gov [mpich-discuss-bounces@mcs.anl.gov] on behalf of Umit [umitcanyilmaz@gmail.com]<br>
<b>Sent:</b> Thursday, February 16, 2012 7:06 AM<br>
<b>To:</b> mpich-discuss@mcs.anl.gov<br>
<b>Subject:</b> [mpich-discuss] Howto use MPI_Comm_merge together with MPI_Comm_spawn<br>
</font><br>
</div>
<div></div>
<div>Hello All, <br>
<br>
Can anyone tell me what is wrong with this simple code:<br>
<br>
#define NUM_SPAWNS 4<br>
double timer;<br>
int i; <br>
char str[100]; <br>
int main( int argc, char *argv[] )<br>
{<br>
MPI_Comm parentcomm, intercomm;<br>
MPI_Comm comm, scomm;<br>
MPI_Init( &argc, &argv );<br>
MPI_Comm_get_parent( &parentcomm );<br>
int np = NUM_SPAWNS; <br>
int size; <br>
MPI_Comm_size( MPI_COMM_WORLD , &size );<br>
if (parentcomm == MPI_COMM_NULL)<br>
{<br>
scomm = MPI_COMM_WORLD; <br>
int errcodes[np];<br>
MPI_Comm_spawn( "/home/test/Desktop/merge/./a.out", MPI_ARGV_NULL, np, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &intercomm, errcodes );<br>
MPI_Intercomm_merge( intercomm, 1, &comm );<br>
}<br>
else<br>
{<br>
printf("I'm the spawned.\n");<br>
}<br>
MPI_Finalize();<br>
return 0;<br>
}<br>
<br>
I called MPI_Intercomm_merge outside of if statement but I got the same error. <br>
Spawn is successfull. I have especially tested it. If I try to merge, i got the following error:<br>
<br>
test@ubuntu:~/Desktop/merge$ mpirun -np 1 ./a.out<br>
I'm the spawned.<br>
I'm the spawned.<br>
I'm the spawned.<br>
I'm the spawned.<br>
Fatal error in MPI_Intercomm_merge: Other MPI error, error stack:<br>
MPI_Intercomm_merge(288)..........: MPI_Intercomm_merge(comm=0x84000000, high=1, newintracomm=0xbf97ff40) failed<br>
MPI_Intercomm_merge(263)..........: <br>
MPIR_Get_contextid(639)...........: <br>
MPI_Allreduce(773)................: MPI_Allreduce(sbuf=MPI_IN_PLACE, rbuf=0xbf97fd18, count=64, MPI_INT, MPI_BAND, comm=0x84000002) failed<br>
MPIR_Allreduce(289)...............: <br>
MPIC_Sendrecv(161)................: <br>
MPIC_Wait(513)....................: <br>
MPIDI_CH3I_Progress(150)..........: <br>
MPID_nem_mpich2_blocking_recv(948): <br>
MPID_nem_tcp_connpoll(1720).......: <br>
state_commrdy_handler(1556).......: <br>
MPID_nem_tcp_recv_handler(1446)...: socket closed<br>
rank 0 in job 21 ubuntu_38267 caused collective abort of all ranks<br>
exit status of rank 0: killed by signal 9 <br>
<br>
<br>
Thanks In Advance, <br>
<br>
<br>
</div>
</div>
</div>
</body>
</html>