<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Thank you guys for all the reply. Thanks Pavan for hinting at the
auto cleanup option. This does what I wanted it to do. Just adding
to the discussion, I agree with your comments on the portable
program's assumption part. The standard states that one program's
error may affect the other only if they somehow belong in an intra
or inter communicator. And in my case, the parent spawns the child
and disconnects the communicator. The child also as soon as init,
gets the parent and disconnects from the parent. The sample code is
given below.<br>
<br>
Parent:<br>
<br>
<font face="Courier New, Courier, monospace">int main (int argc,
char *argv[])<br>
{<br>
MPI_Init(&argc, &argv);<br>
MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);<br>
MPI_Comm child_comm;<br>
MPI_Comm_spawn("./child", MPI_ARGV_NULL, 1, MPI_INFO_NULL, 0,
MPI_COMM_SELF, &child_comm, MPI_ERRCODES_IGNORE);<br>
MPI_Errhandler_set(child_comm, MPI_ERRORS_RETURN);<br>
printf("spawned a child\n");<br>
MPI_Comm_disconnect(&child_comm);<br>
printf("Disconnected from the child\n");<br>
sleep(5000);<br>
MPI_Finalize();<br>
return 0;<br>
}</font><br>
<br>
Child:<br>
<br>
<font face="Courier New, Courier, monospace">int main (int argc,
char *argv[])<br>
{<br>
MPI_Init(&argc, &argv);<br>
MPI_Comm parent, parent1;<br>
MPI_Comm_get_parent(&parent);<br>
MPI_Comm_disconnect(&parent);<br>
if(parent == MPI_COMM_NULL)<br>
printf("Child: Disconnected from the parent, Exiting\n\n");<br>
<br>
MPI_Comm_get_parent(&parent1); <br>
<br>
if(parent1 != MPI_COMM_NULL)<br>
printf("Child: yes, i got my parent again\n");<br>
<br>
exit(1);<br>
<br>
MPI_Finalize();<br>
return 0;<br>
}</font><br>
<br>
If you see here, the child's first message will be displayed while
the second printf will not be displayed! Which shows that it cant
get the parent anymore. And when a exit() happens abruptly, it
shouldn't affect the parent rite (since they now dont have a common
communicator, and without any auto clean option) ?<br>
Please correct me if I am wrong.<br>
<br>
Thanks,<br>
Suraj<br>
<br>
On 12/15/2010 05:47 PM, Pavan Balaji wrote:
<blockquote cite="mid:4D08F108.6020600@mcs.anl.gov" type="cite">
<br>
On 12/15/2010 10:42 AM, Lisandro Dalcin wrote:
<br>
<blockquote type="cite">On 15 December 2010 13:34, Pavan
Balaji<a class="moz-txt-link-rfc2396E" href="mailto:balaji@mcs.anl.gov"><balaji@mcs.anl.gov></a> wrote:
<br>
<blockquote type="cite">
<br>
The standard leaves it pretty open, saying that an error in
one application
<br>
*may* affect the other. What exactly is done depends on the
MPI
<br>
implementation.
<br>
<br>
</blockquote>
<br>
Of course, but I understand that a portable program should
assume that
<br>
errors in one app *do* affect the other... and then be very
careful
<br>
with usages of exit(), abort() and friends.
<br>
</blockquote>
<br>
Agreed. At least till we get to MPI-3 :-).
<br>
<br>
-- Pavan
<br>
<br>
</blockquote>
</body>
</html>