Hello can somebody help me to sending it................<br><br>#include <iostream><br>#include <vector><br>#include <string><br>#include"mpi.h"<br>using namespace std;<br><br>main(int argc, char *argv[])<br>
{<br><br> MPI::Status status;<br> MPI::Init(argc,argv);<br> int myrank = MPI::COMM_WORLD.Get_rank();<br> int numprocs = MPI::COMM_WORLD.Get_size();<br> MPI_Datatype strtype;<br> //int blocklen=16;<br>
//MPI_Aint disp[3]={0,16,32};<br> MPI_Type_contiguous(16,MPI::CHAR,&strtype);<br> MPI_Type_commit(&strtype);<br> vector<string> SS;<br> if(myrank == 0){<br> SS.push_back("The number is 10");<br>
SS.push_back("The number is 20");<br> SS.push_back("The number is 30");<br><br> cout << "At root Node: " << endl;<br><br> int ii;<br> for(ii=0; ii < SS.size(); ii++)<br>
{<br> cout << SS[ii] << endl;<br> }<br> //MPI_Type_contiguous(16,MPI::CHAR,strtype);<br> MPI::COMM_WORLD.Send(&SS[0],3,strtype, 1, 1);<br> }<br>else{<br> SS.reserve(3);<br> MPI::COMM_WORLD.Recv(&SS[0],3,strtype,0,1);<br>
int ii;<br> cout << "At worker Node: " << endl;<br> for(ii=0; ii < SS.size(); ii++)<br> {<br> cout << SS[ii] << endl;<br> }<br> }<br> MPI::Finalize();<br>}<br>
<br><br><br>Now My O/P is:<br>$ mpicxx vecDemo.cpp -o vDemo.out -DMPICH_IGNORE_CXX_SEEK <br>$ mpirun -np 2 ./vDemo.out<br>At root Node: <br>The number is 10<br>The number is 20<br>The number is 30<br>At worker Node: <br>
$<br><br>BUT i want O/P like.......<br>$ mpirun -np 2 ./vDemo.out<br>At root Node: <br>
The number is 10<br>
The number is 20<br>
The number is 30<br>
At worker Node: <br>The number is 10<br>
The number is 20<br>
The number is 30<br>$<br>