<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:'times new roman', 'new york', times, serif;font-size:12pt"><div>I will do that, but in the meantime, could you run your own test code below directly, not using mpiexec, and see the result. For me, it's returning MPI_THREAD_SINGLE - is that how it's supposed to be, i.e. the thread-safe support can only be enabled if the application is run via mpiexec?&nbsp;</div><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><br><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Jayesh Krishna &lt;jayesh@mcs.anl.gov&gt;<br><b><span style="font-weight: bold;">To:</span></b> Lubomir Radev &lt;lubomirr@yahoo.com&gt;<br><b><span style="font-weight: bold;">Cc:</span></b> mpich-discuss@mcs.anl.gov<br><b><span
 style="font-weight: bold;">Sent:</span></b> Tuesday, September 22, 2009 8:21:44 AM<br><b><span style="font-weight: bold;">Subject:</span></b> RE: [mpich-discuss] MPI_THREAD_MULTIPLE<br></font><br>


 
<style type="text/css">DIV {
MARGIN:0px;}
</style>

 

<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span class="501422015-22092009">Hi,</span></font></div>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span class="501422015-22092009">&nbsp;Can you send us a test program 
?</span></font></div>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span class="501422015-22092009"></span></font>&nbsp;</div>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span class="501422015-22092009">Regards,</span></font></div>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span class="501422015-22092009">Jayesh</span></font></div><br>
<div dir="ltr" lang="en-us" class="OutlookMessageHeader" align="left">
<hr tabindex="-1">
<font size="2" face="Tahoma"><b>From:</b> Lubomir Radev [mailto:lubomirr@yahoo.com] 
<br><b>Sent:</b> Tuesday, September 22, 2009 2:27 AM<br><b>To:</b> Jayesh 
Krishna; mpich-discuss@mcs.anl.gov<br><b>Subject:</b> Re: [mpich-discuss] 
MPI_THREAD_MULTIPLE<br></font><br></div>
<div></div>
<div style="FONT-FAMILY:'times new roman', 'new york', times, serif;FONT-SIZE:12pt;">
<div>This works for me too, returning MPI_THREAD_MULTIPLE, but only when started 
via mpiexec.</div>
<div><br></div>
<div>However, I need to launch my worker processes programmatically by using 
MPI_Comm_spawn_multiple(). That's necessitated by the nature of my app - it's 
actually a library that clients will be linking against. So the client process 
has to spawn workers and communicate with them, which works just fine from one 
thread and fails with two. And if I use MPI_Init_thread() from the client/master 
process (which isn't started by mpiexec), it always returns 
MPI_THREAD_SINGLE.</div>
<div><br></div>
<div>Should I try to pack all of my MPI communications in one thread or can you 
suggest a solution other than mpiexec for multiple threads? Perhaps I could 
somehow perform the same thread support initialization that mpiexec apparently 
does internally?</div>
<div style="FONT-FAMILY:times new roman, new york, times, serif;FONT-SIZE:12pt;"><br></div>
<div style="FONT-FAMILY:times new roman, new york, times, serif;FONT-SIZE:12pt;">Thanks 
very much.</div>
<div style="FONT-FAMILY:times new roman, new york, times, serif;FONT-SIZE:12pt;"><br>
<div style="FONT-FAMILY:times new roman, new york, times, serif;FONT-SIZE:12pt;"><font size="2" face="Tahoma">
<hr size="1">
<b><span style="FONT-WEIGHT:bold;">From:</span></b> Jayesh Krishna 
&lt;jayesh@mcs.anl.gov&gt;<br><b><span style="FONT-WEIGHT:bold;">To:</span></b> 
mpich-discuss@mcs.anl.gov<br><b><span style="FONT-WEIGHT:bold;">Cc:</span></b> 
Lubomir Radev &lt;lubomirr@yahoo.com&gt;<br><b><span style="FONT-WEIGHT:bold;">Sent:</span></b> Monday, September 21, 2009 9:04:17 
AM<br><b><span style="FONT-WEIGHT:bold;">Subject:</span></b> RE: [mpich-discuss] 
MPI_THREAD_MULTIPLE<br></font><br>
<style type="text/css">DIV {
MARGIN:0px;}
</style>

<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span class="408565815-21092009">Hi,</span></font></div>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span class="408565815-21092009">&nbsp;Are you launching your MPI job using the 
"-channel" option of mpiexec (mpiexec -n 2 -channel nemesis 
thread_multiple_test.exe)?</span></font><font color="#0000ff" size="2" face="Arial"><span class="408565815-21092009">&nbsp;A simple MPI program (see 
below)&nbsp;that queries for the thread level support returns 
MPI_THREAD_MULTIPLE for me.</span></font></div>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span class="408565815-21092009"></span></font>&nbsp;</div>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span class="408565815-21092009">=========== Thread multiple test 
===================</span></font></div>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span class="408565815-21092009"><font color="#0000ff" size="2"><font color="#0000ff" size="2"></font></font>
<p><font color="#0000ff" size="2"><font color="#0000ff" size="2">#include</font></font><font color="#000000" size="2"> </font><font color="#a31515" size="2"><font color="#a31515" size="2">&lt;iostream&gt;</font></font></p><font color="#a31515" size="2"><font color="#a31515" size="2"></font></font><font color="#0000ff" size="2"><font color="#0000ff" size="2"></font></font>
<p><font color="#0000ff" size="2"><font color="#0000ff" size="2">#include</font></font><font color="#000000" size="2"> </font><font color="#a31515" size="2"><font color="#a31515" size="2">"mpi.h"</font></font></p><font color="#a31515" size="2"><font color="#a31515" size="2"></font></font><font color="#0000ff" size="2"><font color="#0000ff" size="2"></font></font>
<p><font color="#0000ff" size="2"><font color="#0000ff" size="2">int</font></font><font color="#000000" size="2"> main(</font><font color="#0000ff" size="2"><font color="#0000ff" size="2">int</font></font><font color="#000000" size="2"> argc, </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">char</font></font><font size="2"><font color="#000000"> *argv[])</font></font></p><font size="2">
<p>{</p></font>
<p><font color="#0000ff" size="2"><font color="#0000ff" size="2">int</font></font><font size="2"> provided;</font></p><font size="2">
<p>provided = MPI::Init_thread(MPI_THREAD_MULTIPLE);</p></font>
<p><font color="#0000ff" size="2"><font color="#0000ff" size="2">if</font></font><font size="2">(provided == MPI_THREAD_MULTIPLE){</font></p><font size="2"></font>
<p><font size="2">std::cout &lt;&lt; </font><font color="#a31515" size="2"><font color="#a31515" size="2">"Thread multiple supported"</font></font><font size="2"> 
&lt;&lt; std::endl;</font></p><font size="2">
<p>}</p></font>
<p><font color="#0000ff" size="2"><font color="#0000ff" size="2">else</font></font><font size="2">{</font></p><font size="2"></font>
<p><font size="2">std::cout &lt;&lt; </font><font color="#a31515" size="2"><font color="#a31515" size="2">"Thread multiple NOT supported"</font></font><font size="2"> 
&lt;&lt; std::endl;</font></p><font size="2">
<p>}</p>
<p>MPI::Finalize();</p>
<p>}</p>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span class="408565815-21092009">=========== Thread multiple test 
===================</span></font></div>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span class="408565815-21092009"></span></font>&nbsp;</div>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span class="408565815-21092009">Regards,</span></font></div>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span class="408565815-21092009">Jayesh</span></font></div></font></span></font></div><br>
<div dir="ltr" lang="en-us" class="OutlookMessageHeader" align="left">
<hr tabindex="-1">
<font size="2" face="Tahoma"><b>From:</b> mpich-discuss-bounces@mcs.anl.gov 
[mailto:mpich-discuss-bounces@mcs.anl.gov] <b>On Behalf Of </b>Lubomir 
Radev<br><b>Sent:</b> Sunday, September 20, 2009 7:23 PM<br><b>To:</b> 
mpich-discuss@mcs.anl.gov<br><b>Subject:</b> Re: [mpich-discuss] 
MPI_THREAD_MULTIPLE<br></font><br></div>
<div></div>
<div style="FONT-FAMILY:'times new roman', 'new york', times, serif;FONT-SIZE:12pt;">
<div>Yes. I was using 1.0.8p1 originally, but after your suggestion got 1.1.1p1 
and the problem persists.</div>
<div><br></div>
<div>I could reduce my code to a test case exhibiting the issue, but I need to 
understand why MPI_Init_thread() won't provide me with MPI_THREAD_MULTIPLE 
support and always returns MPI_THREAD_SINGLE regardless of the channel 
configuration. I need to get that working first so my multi-threaded code can 
assume it operates in a correctly initialized environment and can legitimately 
call into MPICH2 simultaneously from more than one thread.</div>
<div><br></div>
<div>I'm using Boost.MPI wrapper (and Boost.Thread), but that shouldn't 
matter.</div>
<div><br></div>
<div>Thanks</div>
<div><br></div>
<div style="FONT-FAMILY:times new roman, new york, times, serif;FONT-SIZE:12pt;">
<div style="FONT-FAMILY:times new roman, new york, times, serif;FONT-SIZE:12pt;"><font size="2" face="Tahoma">
<hr size="1">
<b><span style="FONT-WEIGHT:bold;">From:</span></b> Jayesh Krishna 
&lt;jayesh@mcs.anl.gov&gt;<br><b><span style="FONT-WEIGHT:bold;">To:</span></b> 
mpich-discuss@mcs.anl.gov<br><b><span style="FONT-WEIGHT:bold;">Sent:</span></b> 
Friday, September 18, 2009 8:42:38 AM<br><b><span style="FONT-WEIGHT:bold;">Subject:</span></b> Re: [mpich-discuss] 
MPI_THREAD_MULTIPLE<br></font><br>
<p><font size="2">Hi,<br><span><span><span>&nbsp;Are you trying the latest stable 
release, 1.1.1p1, of MPICH2 (<a target="_blank" href="http://www.mcs.anl.gov/research/projects/mpich2/downloads/index.php?s=downloads">http://www.mcs.anl.gov/research/projects/mpich2/downloads/index.php?s=downloads</a>) 
?</span></span></span><br>&nbsp;Can you send us a test program 
?<br><br>Regards,<br>Jayesh<br><br>-----Original Message-----<br>From: 
mpich-discuss-bounces@mcs.anl.gov [<a rel="nofollow" ymailto="mailto:mpich-discuss-bounces@mcs.anl.gov" target="_blank" href="mailto:mpich-discuss-bounces@mcs.anl.gov">mailto:mpich-discuss-bounces@mcs.anl.gov</a>] 
On Behalf Of Lubomir Radev<br>Sent: Thursday, September 17, 2009 10:08 PM<br>To: 
mpich-discuss@mcs.anl.gov<br>Subject: [mpich-discuss] 
MPI_THREAD_MULTIPLE<br><br>Hey guys,<br><br>I need to call into the thread-safe 
version of MPICH2 so I tried to initialize with MPI_Init_thread() and 
MPI_THREAD_MULTIPLE, but no matter how I configured the channels on my nodes - 
tried both mt and nemesis - that function returns MPI_THREAD_SINGLE as provided 
thread support.<br><br>I'm using 1.0.8p1 on Windows if that matters. Installed 
from the provided MSI binary. Perhaps I need to build from sources, configuring 
it with thread support?<br><br>Thanks<br></font></p></div></div>
<div></div></div></div></div>
<div style=""></div></div>
</div></div><div style="position:fixed"></div></div></body></html>