Thanks to Dorian, my problem now solved..................................<br><br><br><div class="gmail_quote">On Wed, Aug 12, 2009 at 10:30 PM,  <span dir="ltr">&lt;<a href="mailto:mpich-discuss-request@mcs.anl.gov">mpich-discuss-request@mcs.anl.gov</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Send mpich-discuss mailing list submissions to<br>
        <a href="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<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>
or, via email, send a message with subject or body &#39;help&#39; to<br>
        <a href="mailto:mpich-discuss-request@mcs.anl.gov">mpich-discuss-request@mcs.anl.gov</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:mpich-discuss-owner@mcs.anl.gov">mpich-discuss-owner@mcs.anl.gov</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than &quot;Re: Contents of mpich-discuss digest...&quot;<br>
<br>
<br>
Today&#39;s Topics:<br>
<br>
   1.  broadcast and reduce mechanism (Gra zeus)<br>
   2. Re:  mpich-discuss Digest, Vol 11, Issue 8<br>
      (Vineet Pratap (Vampaier))<br>
   3. Re:  mpich-discuss Digest, Vol 11, Issue 8 (Dorian Krause)<br>
   4. Re:  broadcast and reduce mechanism (Dave Goodell)<br>
   5. Re:  broadcast and reduce mechanism (Rajeev Thakur)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Tue, 11 Aug 2009 19:34:09 -0700 (PDT)<br>
From: Gra zeus &lt;<a href="mailto:gra_zeus@yahoo.com">gra_zeus@yahoo.com</a>&gt;<br>
Subject: [mpich-discuss] broadcast and reduce mechanism<br>
To: <a href="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</a><br>
Message-ID: &lt;<a href="mailto:346772.58251.qm@web34502.mail.mud.yahoo.com">346772.58251.qm@web34502.mail.mud.yahoo.com</a>&gt;<br>
Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br>
<br>
Hello,<br>
Can any one comfirm or link me to documents that explain communication?mechanism of MPI_Bcast and MPI_Reduce?<br>
I searched in google and It said Bcast,Reduce can use tree algorithm or sequential communication.However, I can&#39;t find any specification that indicate communication?mechanism of MPI_Bcast and MPI_Reduce in MPICH2.<br>

thx,gra<br>
<br>
<br>
<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: &lt;<a href="http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20090811/e5c36179/attachment-0001.htm" target="_blank">http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20090811/e5c36179/attachment-0001.htm</a>&gt;<br>

<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Wed, 12 Aug 2009 15:23:05 +0530<br>
From: &quot;Vineet Pratap (Vampaier)&quot; &lt;<a href="mailto:pratap.vineet@gmail.com">pratap.vineet@gmail.com</a>&gt;<br>
Subject: Re: [mpich-discuss] mpich-discuss Digest, Vol 11, Issue 8<br>
To: <a href="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</a><br>
Message-ID:<br>
        &lt;<a href="mailto:b99924940908120253i55a28d51s4f950667fa2da9b3@mail.gmail.com">b99924940908120253i55a28d51s4f950667fa2da9b3@mail.gmail.com</a>&gt;<br>
Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br>
<br>
Plz Correct this code................<br>
<br>
#include&lt;iostream&gt;<br>
#include&lt;vector&gt;<br>
#include &quot;mpi.h&quot;<br>
<br>
using namespace std;<br>
<br>
int main(int argc, char *argv[])<br>
{<br>
        MPI::Status status;<br>
        MPI::Init();<br>
        int myrank = MPI::COMM_WORLD.Get_rank();<br>
        int numprocs = MPI::COMM_WORLD.Get_size();<br>
        vector&lt;int&gt;  ourvector(2);<br>
        if(myrank == 0){<br>
<br>
        ourvector[0] = 98;<br>
<br>
//      cout &lt;&lt; &quot;The max number the vector can hold is : &quot; &lt;&lt;<br>
ourvector.max_size();<br>
<br>
<br>
//      cout &lt;&lt; &quot;\nourvector has : &quot; &lt;&lt; ourvector.capacity() &lt;&lt; &quot; elements<br>
in it&quot;;<br>
<br>
        ourvector.push_back(99);<br>
<br>
<br>
//      cout &lt;&lt; &quot;\nNow ourvector has : &quot; &lt;&lt; ourvector.size() &lt;&lt; &quot; elements<br>
in it&quot;;<br>
<br>
//      cout &lt;&lt; &quot;\nThe Value of the first vector element is : &quot; &lt;&lt;<br>
ourvector[0];<br>
<br>
<br>
//      cout &lt;&lt; &quot;\nThe Value of our second vector element is : &quot; &lt;&lt;<br>
<a href="http://ourvector.at" target="_blank">ourvector.at</a>(1) &lt;&lt; endl;<br>
<br>
         MPI::COMM_WORLD.Send(&amp;ourvector[0],2,MPI::INT, 1, 1);<br>
        // MPI::COMM_WORLD.Send(&amp;ourvector[1],1,MPI::INT, 1, 1);<br>
        }<br>
        else{<br>
        ourvector.reserve(2);<br>
       MPI::COMM_WORLD.Recv(&amp;ourvector[0],2, MPI::INT,0,1);<br>
        // MPI::COMM_WORLD.Recv(&amp;ourvector[1],1, MPI::INT,0,1);<br>
<br>
        //ourvector.pop_back();<br>
<br>
<br>
        cout &lt;&lt; &quot;ourvector now has : &quot; &lt;&lt; ourvector.capacity() &lt;&lt; &quot;<br>
elements&quot; &lt;&lt;  endl;<br>
      cout &lt;&lt; &quot;\nNow ourvector has 1st : &quot; &lt;&lt; ourvector[0];<br>
        cout &lt;&lt; &quot;\nNow ourvector has 2nd : &quot; &lt;&lt; ourvector[1]&lt;&lt; endl;<br>
//      cout &lt;&lt; &quot;Our fisrt element in ourvector is : &quot; &lt;&lt; ourvector.front()<br>
&lt;&lt; endl;<br>
<br>
<br>
        ourvector.resize(9);<br>
<br>
        <a href="http://ourvector.at" target="_blank">ourvector.at</a>(8)  = 99;<br>
<br>
//      cout &lt;&lt; &quot;Our last element in ourvect is : &quot; &lt;&lt; ourvector.back() &lt;&lt;<br>
endl;<br>
<br>
//      cout &lt;&lt; &quot;ourvector now holds : &quot; &lt;&lt; ourvector.size() &lt;&lt; &quot; elements&quot;<br>
&lt;&lt; endl;<br>
        }<br>
      MPI::Finalize();<br>
        return 0;<br>
} &lt;<a href="http://trac.guake-terminal.org/files/" target="_blank">http://trac.guake-terminal.org/files/</a>&gt;<br>
<br>
<br>
Now MY output is<br>
$ mpirun -np 2 ./vec.out<br>
ourvector now has : 2 elements<br>
<br>
Now ourvector has 1st : 98<br>
Now ourvector has 2nd :0<br>
<br>
I want output like &lt;<a href="http://trac.guake-terminal.org/files/" target="_blank">http://trac.guake-terminal.org/files/</a>&gt;<br>
$ mpirun -np 2 ./vec.out<br>
ourvector now has : 2 elements<br>
<br>
Now ourvector has 1st : 98<br>
Now ourvector has 2nd :99<br>
<br>
&lt;<a href="http://trac.guake-terminal.org/files/" target="_blank">http://trac.guake-terminal.org/files/</a>&gt;<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: &lt;<a href="http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20090812/5cbe1cb6/attachment-0001.htm" target="_blank">http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20090812/5cbe1cb6/attachment-0001.htm</a>&gt;<br>

<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Wed, 12 Aug 2009 15:44:45 +0200<br>
From: Dorian Krause &lt;<a href="mailto:ddkrause@uni-bonn.de">ddkrause@uni-bonn.de</a>&gt;<br>
Subject: Re: [mpich-discuss] mpich-discuss Digest, Vol 11, Issue 8<br>
To: <a href="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</a><br>
Message-ID: &lt;<a href="mailto:4A82C74D.1030502@uni-bonn.de">4A82C74D.1030502@uni-bonn.de</a>&gt;<br>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
<br>
if you create outvector like<br>
<br>
vector&lt;int&gt; ourvector(2);<br>
<br>
and than push_back &quot;99&quot; the vector will look like<br>
<br>
{ 98, (whatever), 99}<br>
<br>
Try to do call the constructor<br>
<br>
vector&lt;int&gt; ourvector(1);<br>
<br>
Then you should (If I understand the stl correctly) end up with<br>
<br>
{ 98, 99 }<br>
<br>
as you intend.<br>
<br>
Hope this helps ...<br>
<br>
Regards,<br>
Dorian<br>
<br>
<br>
Vineet Pratap (Vampaier) wrote:<br>
&gt; Plz Correct this code................<br>
&gt;<br>
&gt; #include&lt;iostream&gt;<br>
&gt; #include&lt;vector&gt;<br>
&gt; #include &quot;mpi.h&quot;<br>
&gt;<br>
&gt; using namespace std;<br>
&gt;<br>
&gt; int main(int argc, char *argv[])<br>
&gt; {<br>
&gt;         MPI::Status status;<br>
&gt;         MPI::Init();<br>
&gt;         int myrank = MPI::COMM_WORLD.Get_rank();<br>
&gt;         int numprocs = MPI::COMM_WORLD.Get_size();<br>
&gt;         vector&lt;int&gt;  ourvector(2);<br>
&gt;         if(myrank == 0){<br>
&gt;<br>
&gt;         ourvector[0] = 98;<br>
&gt;<br>
&gt; //      cout &lt;&lt; &quot;The max number the vector can hold is : &quot; &lt;&lt;<br>
&gt; ourvector.max_size();<br>
&gt;<br>
&gt;<br>
&gt; //      cout &lt;&lt; &quot;\nourvector has : &quot; &lt;&lt; ourvector.capacity() &lt;&lt; &quot;<br>
&gt; elements in it&quot;;<br>
&gt;<br>
&gt;         ourvector.push_back(99);<br>
&gt;<br>
&gt;<br>
&gt; //      cout &lt;&lt; &quot;\nNow ourvector has : &quot; &lt;&lt; ourvector.size() &lt;&lt; &quot;<br>
&gt; elements in it&quot;;<br>
&gt;<br>
&gt; //      cout &lt;&lt; &quot;\nThe Value of the first vector element is : &quot; &lt;&lt;<br>
&gt; ourvector[0];<br>
&gt;<br>
&gt;<br>
&gt; //      cout &lt;&lt; &quot;\nThe Value of our second vector element is : &quot; &lt;&lt;<br>
&gt; <a href="http://ourvector.at" target="_blank">ourvector.at</a>(1) &lt;&lt; endl;<br>
&gt;<br>
&gt;          MPI::COMM_WORLD.Send(&amp;ourvector[0],2,MPI::INT, 1, 1);<br>
&gt;         // MPI::COMM_WORLD.Send(&amp;ourvector[1],1,MPI::INT, 1, 1);<br>
&gt;         }<br>
&gt;         else{<br>
&gt;         ourvector.reserve(2);<br>
&gt;        MPI::COMM_WORLD.Recv(&amp;ourvector[0],2, MPI::INT,0,1);<br>
&gt;         // MPI::COMM_WORLD.Recv(&amp;ourvector[1],1, MPI::INT,0,1);<br>
&gt;<br>
&gt;         //ourvector.pop_back();<br>
&gt;<br>
&gt;<br>
&gt;         cout &lt;&lt; &quot;ourvector now has : &quot; &lt;&lt; ourvector.capacity() &lt;&lt; &quot;<br>
&gt; elements&quot; &lt;&lt;  endl;<br>
&gt;       cout &lt;&lt; &quot;\nNow ourvector has 1st : &quot; &lt;&lt; ourvector[0];<br>
&gt;         cout &lt;&lt; &quot;\nNow ourvector has 2nd : &quot; &lt;&lt; ourvector[1]&lt;&lt; endl;<br>
&gt; //      cout &lt;&lt; &quot;Our fisrt element in ourvector is : &quot; &lt;&lt;<br>
&gt; ourvector.front() &lt;&lt; endl;<br>
&gt;<br>
&gt;<br>
&gt;         ourvector.resize(9);<br>
&gt;<br>
&gt;         <a href="http://ourvector.at" target="_blank">ourvector.at</a>(8)  = 99;<br>
&gt;<br>
&gt; //      cout &lt;&lt; &quot;Our last element in ourvect is : &quot; &lt;&lt;<br>
&gt; ourvector.back() &lt;&lt; endl;<br>
&gt;<br>
&gt; //      cout &lt;&lt; &quot;ourvector now holds : &quot; &lt;&lt; ourvector.size() &lt;&lt; &quot;<br>
&gt; elements&quot; &lt;&lt; endl;<br>
&gt;         }<br>
&gt;       MPI::Finalize();<br>
&gt;         return 0;<br>
&gt; } &lt;<a href="http://trac.guake-terminal.org/files/" target="_blank">http://trac.guake-terminal.org/files/</a>&gt;<br>
&gt;<br>
&gt;<br>
&gt; Now MY output is<br>
&gt; $ mpirun -np 2 ./vec.out<br>
&gt; ourvector now has : 2 elements<br>
&gt;<br>
&gt; Now ourvector has 1st : 98<br>
&gt; Now ourvector has 2nd :0<br>
&gt;<br>
&gt; I want output like &lt;<a href="http://trac.guake-terminal.org/files/" target="_blank">http://trac.guake-terminal.org/files/</a>&gt;<br>
&gt; $ mpirun -np 2 ./vec.out<br>
&gt; ourvector now has : 2 elements<br>
&gt;<br>
&gt; Now ourvector has 1st : 98<br>
&gt; Now ourvector has 2nd :99<br>
&gt;<br>
&gt; &lt;<a href="http://trac.guake-terminal.org/files/" target="_blank">http://trac.guake-terminal.org/files/</a>&gt;<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Wed, 12 Aug 2009 09:00:52 -0500<br>
From: Dave Goodell &lt;<a href="mailto:goodell@mcs.anl.gov">goodell@mcs.anl.gov</a>&gt;<br>
Subject: Re: [mpich-discuss] broadcast and reduce mechanism<br>
To: <a href="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</a><br>
Message-ID: &lt;<a href="mailto:79C6E563-D421-4EED-85D8-9A9D29278C06@mcs.anl.gov">79C6E563-D421-4EED-85D8-9A9D29278C06@mcs.anl.gov</a>&gt;<br>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes<br>
<br>
You can find some information in this paper: <a href="http://www.mcs.anl.gov/%7Ethakur/papers/mpi-coll.pdf" target="_blank">http://www.mcs.anl.gov/~thakur/papers/mpi-coll.pdf</a><br>
<br>
However since that was written there have been a few changes, some<br>
major and some minor.  One difference is that we now perform those<br>
collective operations hierarchically on SMP systems (intranode,<br>
internode, then intranode again).  Also, additional algorithms might<br>
have been selected and the cutoff points are almost certainly<br>
different.  So the best way to figure out what&#39;s going on in there is<br>
to read the code.<br>
<br>
As far as I know we don&#39;t use sequential communication to implement<br>
any of our collective operations.<br>
<br>
-Dave<br>
<br>
On Aug 11, 2009, at 9:34 PM, Gra zeus wrote:<br>
<br>
&gt; Hello,<br>
&gt;<br>
&gt; Can any one comfirm or link me to documents that explain<br>
&gt; communication mechanism of MPI_Bcast and MPI_Reduce?<br>
&gt;<br>
&gt; I searched in google and It said Bcast,Reduce can use tree algorithm<br>
&gt; or sequential communication.<br>
&gt; However, I can&#39;t find any specification that indicate communication<br>
&gt; mechanism of MPI_Bcast and MPI_Reduce in MPICH2.<br>
&gt;<br>
&gt; thx,<br>
&gt; gra<br>
&gt;<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 5<br>
Date: Wed, 12 Aug 2009 10:59:57 -0500<br>
From: &quot;Rajeev Thakur&quot; &lt;<a href="mailto:thakur@mcs.anl.gov">thakur@mcs.anl.gov</a>&gt;<br>
Subject: Re: [mpich-discuss] broadcast and reduce mechanism<br>
To: &lt;<a href="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</a>&gt;<br>
Message-ID: &lt;<a href="mailto:E1B19E5F762B4CDEA8B54F9141E58351@mcs.anl.gov">E1B19E5F762B4CDEA8B54F9141E58351@mcs.anl.gov</a>&gt;<br>
Content-Type: text/plain;       charset=&quot;us-ascii&quot;<br>
<br>
The code is in the src/mpi/coll directory. See bcast.c and reduce.c.<br>
<br>
Rajeev<br>
<br>
&gt; -----Original Message-----<br>
&gt; From: <a href="mailto:mpich-discuss-bounces@mcs.anl.gov">mpich-discuss-bounces@mcs.anl.gov</a><br>
&gt; [mailto:<a href="mailto:mpich-discuss-bounces@mcs.anl.gov">mpich-discuss-bounces@mcs.anl.gov</a>] On Behalf Of Dave Goodell<br>
&gt; Sent: Wednesday, August 12, 2009 9:01 AM<br>
&gt; To: <a href="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</a><br>
&gt; Subject: Re: [mpich-discuss] broadcast and reduce mechanism<br>
&gt;<br>
&gt; You can find some information in this paper:<br>
&gt; <a href="http://www.mcs.anl.gov/%7Ethakur/papers/mpi-coll.pdf" target="_blank">http://www.mcs.anl.gov/~thakur/papers/mpi-coll.pdf</a><br>
&gt;<br>
&gt; However since that was written there have been a few changes, some<br>
&gt; major and some minor.  One difference is that we now perform those<br>
&gt; collective operations hierarchically on SMP systems (intranode,<br>
&gt; internode, then intranode again).  Also, additional algorithms might<br>
&gt; have been selected and the cutoff points are almost certainly<br>
&gt; different.  So the best way to figure out what&#39;s going on in<br>
&gt; there is<br>
&gt; to read the code.<br>
&gt;<br>
&gt; As far as I know we don&#39;t use sequential communication to implement<br>
&gt; any of our collective operations.<br>
&gt;<br>
&gt; -Dave<br>
&gt;<br>
&gt; On Aug 11, 2009, at 9:34 PM, Gra zeus wrote:<br>
&gt;<br>
&gt; &gt; Hello,<br>
&gt; &gt;<br>
&gt; &gt; Can any one comfirm or link me to documents that explain<br>
&gt; &gt; communication mechanism of MPI_Bcast and MPI_Reduce?<br>
&gt; &gt;<br>
&gt; &gt; I searched in google and It said Bcast,Reduce can use tree<br>
&gt; algorithm<br>
&gt; &gt; or sequential communication.<br>
&gt; &gt; However, I can&#39;t find any specification that indicate<br>
&gt; communication<br>
&gt; &gt; mechanism of MPI_Bcast and MPI_Reduce in MPICH2.<br>
&gt; &gt;<br>
&gt; &gt; thx,<br>
&gt; &gt; gra<br>
&gt; &gt;<br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
mpich-discuss mailing list<br>
<a href="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</a><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>
<br>
End of mpich-discuss Digest, Vol 11, Issue 9<br>
********************************************<br>
</blockquote></div><br><br clear="all"><br>-- <br>VINEET PRATAP<br> (09868366605)<br>        &amp;<br>(09995211212)<br>