Thank a lot. It worked. <br><br><div class="gmail_quote">On 16 February 2012 16:38, Nick Radcliffe <span dir="ltr"><<a href="mailto:nradclif@cray.com">nradclif@cray.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">The parent and child's call to MPI_Intercomm_merge have to be distinct. The child should use 'parentcomm' as its intercommunicator argument, and the child should use 'intercomm'
as its intercommunicator argument. Also, the flag used should be different, e.g., the parent could use 0 and the child 1, or vice versa. This flag determines how the ranks of each half of the intercommunicator map into ranks for the intracommunicator.<br>
<br>
<br>
<div style="font-size:16px;font-family:Times New Roman">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma"><div class="im"><b>From:</b> <a href="mailto:mpich-discuss-bounces@mcs.anl.gov" target="_blank">mpich-discuss-bounces@mcs.anl.gov</a> [<a href="mailto:mpich-discuss-bounces@mcs.anl.gov" target="_blank">mpich-discuss-bounces@mcs.anl.gov</a>] on behalf of Umit [<a href="mailto:umitcanyilmaz@gmail.com" target="_blank">umitcanyilmaz@gmail.com</a>]<br>
</div><b>Sent:</b> Thursday, February 16, 2012 9:19 AM<br>
<b>To:</b> <a href="mailto:mpich-discuss@mcs.anl.gov" target="_blank">mpich-discuss@mcs.anl.gov</a><br>
<b>Subject:</b> Re: [mpich-discuss] Howto use MPI_Comm_merge together with MPI_Comm_spawn<br>
</font><br>
</div><div><div class="h5">
<div></div>
<div><b>Hello Nick, </b><br>
<br>
<b>Thank you for your e-mail. </b><br>
<br>
<b>If I call MPI_Intercomm_merge with all processes like this:<br>
</b><br>
#define NUM_SPAWNS 4<br>
double timer;<br>
int i; <br>
char str[100]; <br>
<br>
int main( int argc, char *argv[] )<br>
{<br>
MPI_Comm parentcomm, intercomm;<br>
MPI_Comm comm;<br>
MPI_Init( &argc, &argv );<br>
MPI_Comm_get_parent( &parentcomm );<br>
int np = NUM_SPAWNS; <br>
<br>
if (parentcomm == MPI_COMM_NULL)<br>
{<br>
int errcodes[np];<br>
MPI_Comm_spawn( "/home/umit/Desktop/merge/./a.out", MPI_ARGV_NULL, np, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &intercomm, errcodes );<br>
}<br>
else<br>
{<br>
printf("I'm the spawned.\n");<br>
}<br>
<b>MPI_Intercomm_merge( intercomm, 1, &comm );</b><br>
MPI_Finalize();<br>
return 0;<br>
}<br>
<br>
<b><br>
I am getting this time follgende error:</b><br>
<br style>
<span style>umit@ubuntu:~/Desktop/merge$ mpirun -np 1 ./a.out</span><br style>
<span style>I'm the spawned.</span><br style="color:rgb(255,255,255)">
<b><font style="color:rgb(255,0,0)" size="2">Fatal error in MPI_Intercomm_merge: Invalid communicator, error stack:</font></b><br>
MPI_Intercomm_merge(288): MPI_Intercomm_merge(comm=0x331ff4, high=1, newintracomm=0xbf9d0720) failed<br>
MPI_Intercomm_merge(93).: Invalid communicator<br>
I'm the spawned.<br>
Fatal error in MPI_Intercomm_merge: Invalid communicator, error stack:<br>
MPI_Intercomm_merge(288): MPI_Intercomm_merge(comm=0xc71ff4, high=1, newintracomm=0xbffec690) failed<br>
MPI_Intercomm_merge(93).: Invalid communicator<br>
rank 3 in job 56 ubuntu_38267 caused collective abort of all ranks<br>
exit status of rank 3: killed by signal 9 <br>
rank 0 in job 56 ubuntu_38267 caused collective abort of all ranks<br>
exit status of rank 0: killed by signal 9 <br>
<br>
Best Regards, <br>
<br>
<br>
<br>
<br>
<div class="gmail_quote">On 16 February 2012 15:56, Nick Radcliffe <span dir="ltr">
<<a href="mailto:nradclif@cray.com" target="_blank">nradclif@cray.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">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-size:16px;font-family:Times New Roman">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma"><b>From:</b> <a href="mailto:mpich-discuss-bounces@mcs.anl.gov" target="_blank">
mpich-discuss-bounces@mcs.anl.gov</a> [<a href="mailto:mpich-discuss-bounces@mcs.anl.gov" target="_blank">mpich-discuss-bounces@mcs.anl.gov</a>] on behalf of Umit [<a href="mailto:umitcanyilmaz@gmail.com" target="_blank">umitcanyilmaz@gmail.com</a>]<br>
<b>Sent:</b> Thursday, February 16, 2012 7:06 AM<br>
<b>To:</b> <a href="mailto:mpich-discuss@mcs.anl.gov" target="_blank">mpich-discuss@mcs.anl.gov</a><br>
<b>Subject:</b> [mpich-discuss] Howto use MPI_Comm_merge together with MPI_Comm_spawn<br>
</font><br>
</div>
<div>
<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>
</div>
</div>
</div>
<br>
_______________________________________________<br>
mpich-discuss mailing list <a href="mailto:mpich-discuss@mcs.anl.gov" target="_blank">
mpich-discuss@mcs.anl.gov</a><br>
To manage subscription options or unsubscribe:<br>
<a href="https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss" target="_blank">https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div></div></div>
</div>
</div>
<br>_______________________________________________<br>
mpich-discuss mailing list <a href="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</a><br>
To manage subscription options or unsubscribe:<br>
<a href="https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss" target="_blank">https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss</a><br>
<br></blockquote></div><br>