now one more problem if i use it like this then,<br> vector<string> ourvector;<br><br>vector datatype is string obj or other obj...........................<br>how to send this vector data to other processes.................. <br>
<br><div class="gmail_quote">On Wed, Aug 12, 2009 at 10:30 PM, <span dir="ltr"><<a href="mailto:mpich-discuss-request@mcs.anl.gov">mpich-discuss-request@mcs.anl.gov</a>></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 'help' 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 "Re: Contents of mpich-discuss digest..."<br>
<br>
<br>
Today'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 <<a href="mailto:gra_zeus@yahoo.com">gra_zeus@yahoo.com</a>><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: <<a href="mailto:346772.58251.qm@web34502.mail.mud.yahoo.com">346772.58251.qm@web34502.mail.mud.yahoo.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<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'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: <<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>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Wed, 12 Aug 2009 15:23:05 +0530<br>
From: "Vineet Pratap (Vampaier)" <<a href="mailto:pratap.vineet@gmail.com">pratap.vineet@gmail.com</a>><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>
<<a href="mailto:b99924940908120253i55a28d51s4f950667fa2da9b3@mail.gmail.com">b99924940908120253i55a28d51s4f950667fa2da9b3@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Plz Correct this code................<br>
<br>
#include<iostream><br>
#include<vector><br>
#include "mpi.h"<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<int> ourvector(2);<br>
if(myrank == 0){<br>
<br>
ourvector[0] = 98;<br>
<br>
// cout << "The max number the vector can hold is : " <<<br>
ourvector.max_size();<br>
<br>
<br>
// cout << "\nourvector has : " << ourvector.capacity() << " elements<br>
in it";<br>
<br>
ourvector.push_back(99);<br>
<br>
<br>
// cout << "\nNow ourvector has : " << ourvector.size() << " elements<br>
in it";<br>
<br>
// cout << "\nThe Value of the first vector element is : " <<<br>
ourvector[0];<br>
<br>
<br>
// cout << "\nThe Value of our second vector element is : " <<<br>
<a href="http://ourvector.at" target="_blank">ourvector.at</a>(1) << endl;<br>
<br>
MPI::COMM_WORLD.Send(&ourvector[0],2,MPI::INT, 1, 1);<br>
// MPI::COMM_WORLD.Send(&ourvector[1],1,MPI::INT, 1, 1);<br>
}<br>
else{<br>
ourvector.reserve(2);<br>
MPI::COMM_WORLD.Recv(&ourvector[0],2, MPI::INT,0,1);<br>
// MPI::COMM_WORLD.Recv(&ourvector[1],1, MPI::INT,0,1);<br>
<br>
//ourvector.pop_back();<br>
<br>
<br>
cout << "ourvector now has : " << ourvector.capacity() << "<br>
elements" << endl;<br>
cout << "\nNow ourvector has 1st : " << ourvector[0];<br>
cout << "\nNow ourvector has 2nd : " << ourvector[1]<< endl;<br>
// cout << "Our fisrt element in ourvector is : " << ourvector.front()<br>
<< endl;<br>
<br>
<br>
ourvector.resize(9);<br>
<br>
<a href="http://ourvector.at" target="_blank">ourvector.at</a>(8) = 99;<br>
<br>
// cout << "Our last element in ourvect is : " << ourvector.back() <<<br>
endl;<br>
<br>
// cout << "ourvector now holds : " << ourvector.size() << " elements"<br>
<< endl;<br>
}<br>
MPI::Finalize();<br>
return 0;<br>
} <<a href="http://trac.guake-terminal.org/files/" target="_blank">http://trac.guake-terminal.org/files/</a>><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 <<a href="http://trac.guake-terminal.org/files/" target="_blank">http://trac.guake-terminal.org/files/</a>><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>
<<a href="http://trac.guake-terminal.org/files/" target="_blank">http://trac.guake-terminal.org/files/</a>><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<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>><br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Wed, 12 Aug 2009 15:44:45 +0200<br>
From: Dorian Krause <<a href="mailto:ddkrause@uni-bonn.de">ddkrause@uni-bonn.de</a>><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: <<a href="mailto:4A82C74D.1030502@uni-bonn.de">4A82C74D.1030502@uni-bonn.de</a>><br>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
<br>
if you create outvector like<br>
<br>
vector<int> ourvector(2);<br>
<br>
and than push_back "99" the vector will look like<br>
<br>
{ 98, (whatever), 99}<br>
<br>
Try to do call the constructor<br>
<br>
vector<int> 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>
> Plz Correct this code................<br>
><br>
> #include<iostream><br>
> #include<vector><br>
> #include "mpi.h"<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<int> ourvector(2);<br>
> if(myrank == 0){<br>
><br>
> ourvector[0] = 98;<br>
><br>
> // cout << "The max number the vector can hold is : " <<<br>
> ourvector.max_size();<br>
><br>
><br>
> // cout << "\nourvector has : " << ourvector.capacity() << "<br>
> elements in it";<br>
><br>
> ourvector.push_back(99);<br>
><br>
><br>
> // cout << "\nNow ourvector has : " << ourvector.size() << "<br>
> elements in it";<br>
><br>
> // cout << "\nThe Value of the first vector element is : " <<<br>
> ourvector[0];<br>
><br>
><br>
> // cout << "\nThe Value of our second vector element is : " <<<br>
> <a href="http://ourvector.at" target="_blank">ourvector.at</a>(1) << endl;<br>
><br>
> MPI::COMM_WORLD.Send(&ourvector[0],2,MPI::INT, 1, 1);<br>
> // MPI::COMM_WORLD.Send(&ourvector[1],1,MPI::INT, 1, 1);<br>
> }<br>
> else{<br>
> ourvector.reserve(2);<br>
> MPI::COMM_WORLD.Recv(&ourvector[0],2, MPI::INT,0,1);<br>
> // MPI::COMM_WORLD.Recv(&ourvector[1],1, MPI::INT,0,1);<br>
><br>
> //ourvector.pop_back();<br>
><br>
><br>
> cout << "ourvector now has : " << ourvector.capacity() << "<br>
> elements" << endl;<br>
> cout << "\nNow ourvector has 1st : " << ourvector[0];<br>
> cout << "\nNow ourvector has 2nd : " << ourvector[1]<< endl;<br>
> // cout << "Our fisrt element in ourvector is : " <<<br>
> ourvector.front() << endl;<br>
><br>
><br>
> ourvector.resize(9);<br>
><br>
> <a href="http://ourvector.at" target="_blank">ourvector.at</a>(8) = 99;<br>
><br>
> // cout << "Our last element in ourvect is : " <<<br>
> ourvector.back() << endl;<br>
><br>
> // cout << "ourvector now holds : " << ourvector.size() << "<br>
> elements" << endl;<br>
> }<br>
> MPI::Finalize();<br>
> return 0;<br>
> } <<a href="http://trac.guake-terminal.org/files/" target="_blank">http://trac.guake-terminal.org/files/</a>><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 <<a href="http://trac.guake-terminal.org/files/" target="_blank">http://trac.guake-terminal.org/files/</a>><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>
> <<a href="http://trac.guake-terminal.org/files/" target="_blank">http://trac.guake-terminal.org/files/</a>><br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Wed, 12 Aug 2009 09:00:52 -0500<br>
From: Dave Goodell <<a href="mailto:goodell@mcs.anl.gov">goodell@mcs.anl.gov</a>><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: <<a href="mailto:79C6E563-D421-4EED-85D8-9A9D29278C06@mcs.anl.gov">79C6E563-D421-4EED-85D8-9A9D29278C06@mcs.anl.gov</a>><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's going on in there is<br>
to read the code.<br>
<br>
As far as I know we don'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>
> Hello,<br>
><br>
> Can any one comfirm or link me to documents that explain<br>
> communication mechanism of MPI_Bcast and MPI_Reduce?<br>
><br>
> I searched in google and It said Bcast,Reduce can use tree algorithm<br>
> or sequential communication.<br>
> However, I can't find any specification that indicate communication<br>
> mechanism of MPI_Bcast and MPI_Reduce in MPICH2.<br>
><br>
> thx,<br>
> gra<br>
><br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 5<br>
Date: Wed, 12 Aug 2009 10:59:57 -0500<br>
From: "Rajeev Thakur" <<a href="mailto:thakur@mcs.anl.gov">thakur@mcs.anl.gov</a>><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: <<a href="mailto:E1B19E5F762B4CDEA8B54F9141E58351@mcs.anl.gov">E1B19E5F762B4CDEA8B54F9141E58351@mcs.anl.gov</a>><br>
Content-Type: text/plain; charset="us-ascii"<br>
<br>
The code is in the src/mpi/coll directory. See bcast.c and reduce.c.<br>
<br>
Rajeev<br>
<br>
> -----Original Message-----<br>
> From: <a href="mailto:mpich-discuss-bounces@mcs.anl.gov">mpich-discuss-bounces@mcs.anl.gov</a><br>
> [mailto:<a href="mailto:mpich-discuss-bounces@mcs.anl.gov">mpich-discuss-bounces@mcs.anl.gov</a>] On Behalf Of Dave Goodell<br>
> Sent: Wednesday, August 12, 2009 9:01 AM<br>
> To: <a href="mailto:mpich-discuss@mcs.anl.gov">mpich-discuss@mcs.anl.gov</a><br>
> Subject: Re: [mpich-discuss] broadcast and reduce mechanism<br>
><br>
> You can find some information in this paper:<br>
> <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's going on in<br>
> there is<br>
> to read the code.<br>
><br>
> As far as I know we don'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>
> > Hello,<br>
> ><br>
> > Can any one comfirm or link me to documents that explain<br>
> > communication mechanism of MPI_Bcast and MPI_Reduce?<br>
> ><br>
> > I searched in google and It said Bcast,Reduce can use tree<br>
> algorithm<br>
> > or sequential communication.<br>
> > However, I can't find any specification that indicate<br>
> communication<br>
> > mechanism of MPI_Bcast and MPI_Reduce in MPICH2.<br>
> ><br>
> > thx,<br>
> > gra<br>
> ><br>
><br>
><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> &<br>(09995211212)<br>