Any takers for this one?<br><br><div class="gmail_quote">On Wed, Nov 2, 2011 at 9:50 AM, Jonathan Bishop <span dir="ltr"><<a href="mailto:jbishop.rwc@gmail.com">jbishop.rwc@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><font face="'courier new', monospace"><b>Hi,</b></font></div><div><font face="'courier new', monospace"><b><br></b></font></div><div><font face="'courier new', monospace"><b>Here is a short program which shows an MPI crash when multiple MPI_Comm_spawn calls are made. Previously, it was found that it is necessary to call MPI_Comm_disconnect from both the worker and master processes to make sure that the spawned processes actually die. Unfortunately, this second issue may be related to that fix --- if I remove the disconnects the crash disappears.</b></font></div>
<div><font face="'courier new', monospace"><b><br></b></font></div><div><font face="'courier new', monospace"><b>Here is the crash message...</b></font></div>
<div><font face="'courier new', monospace"><b><br></b></font></div><div><font face="'courier new', monospace"><b><div>Fatal error in MPI_Init: Other MPI error, error stack:</div>
<div>MPIR_Init_thread(392).................: </div><div>MPID_Init(139)........................: channel initialization failed</div><div>MPIDI_CH3_Init(38)....................: </div><div>MPID_nem_init(196)....................: </div>
<div>MPIDI_CH3I_Seg_commit(366)............: </div><div>MPIU_SHMW_Hnd_deserialize(324)........: </div><div>MPIU_SHMW_Seg_open(863)...............: </div><div>MPIU_SHMW_Seg_create_attach_templ(637): open failed - No such file or directory</div>
<div><br></div><div><repeated a number of times></div><div><br></div><div>Thanks,</div><div><br></div><div>Jon</div></b></font></div><div><font face="'courier new', monospace"><br></font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">#include <iostream></font></div><div><font face="'courier new', monospace">#include "mpi.h"</font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">using namespace std;</font></div><div><font face="'courier new', monospace"><br>
</font></div><div><font face="'courier new', monospace">const int BUFSIZE = 1000;</font></div><div><font face="'courier new', monospace">const int NWORKER = 10;</font></div>
<div><font face="'courier new', monospace">const int NPASS = 10;</font></div><div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">int main(int argc, char **argv)</font></div>
<div><font face="'courier new', monospace">{</font></div><div><font face="'courier new', monospace"> MPI_Init(&argc, &argv);</font></div><div><font face="'courier new', monospace"> MPI_Comm parent;</font></div>
<div><font face="'courier new', monospace"> MPI_Comm_get_parent(&parent);</font></div><div><font face="'courier new', monospace"><br></font></div><div>
<font face="'courier new', monospace"> // Master</font></div><div><font face="'courier new', monospace"> if (parent == MPI_COMM_NULL) {</font></div><div>
<font face="'courier new', monospace"> for (int i = 0; i < NPASS; i++) {</font></div><div><font face="'courier new', monospace"> cout << "pass " << i << " =============" << endl;</font></div>
<div><font face="'courier new', monospace"> MPI_Comm intercom = MPI_COMM_NULL;</font></div><div><font face="'courier new', monospace"> cout << "spawn " << NWORKER << endl;</font></div>
<div><font face="'courier new', monospace"> MPI_Comm_spawn(argv[0], MPI_ARGV_NULL, NWORKER, MPI_INFO_NULL, 0, MPI_COMM_SELF, &intercom, MPI_ERRCODES_IGNORE);</font></div><div><font face="'courier new', monospace"> for (int worker = 0; worker < NWORKER; worker++) {</font></div>
<div><font face="'courier new', monospace"><span style="white-space:pre-wrap">        </span>cout << "stop " << worker << endl;</font></div><div><font face="'courier new', monospace"><span style="white-space:pre-wrap">        </span>char buf[BUFSIZE];</font></div>
<div><font face="'courier new', monospace"><span style="white-space:pre-wrap">        </span>MPI_Send(buf, 0, MPI_CHAR, worker, 0, intercom);</font></div><div><font face="'courier new', monospace"> }</font></div>
<div><font face="'courier new', monospace"> cout << "disconnnect" << endl;</font></div><div><font face="'courier new', monospace"> MPI_Comm_disconnect(&intercom);</font></div>
<div><font face="'courier new', monospace"> intercom = MPI_COMM_NULL;</font></div><div><font face="'courier new', monospace"> }</font></div><div><font face="'courier new', monospace"> }</font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"> // Worker</font></div><div><font face="'courier new', monospace"> if (parent != MPI_COMM_NULL) {</font></div>
<div><font face="'courier new', monospace"> char buf[BUFSIZE];</font></div><div><font face="'courier new', monospace"> MPI_Status status;</font></div>
<div><font face="'courier new', monospace"> MPI_Recv(buf, BUFSIZE, MPI_CHAR, 0, MPI_ANY_TAG, parent, &status);</font></div><div><font face="'courier new', monospace"> MPI_Comm_disconnect(&parent);</font></div>
<div><font face="'courier new', monospace"> }</font></div><div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"> MPI_Finalize();</font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"> return 0;</font></div><div><font face="'courier new', monospace">}</font></div>
<div><br></div>
</blockquote></div><br>