I want to send a string variable via MPI, but I don't know how should I do it! my code is here:
static string fourTupX="Hello";
now I want to send it via MPI:
int l=std::strlen(fourTupX.c_str());
l++;
MPI::COMM_WORLD.Send (&l,1,MPI::INT,1,7);
MPI::COMM_WORLD.Send ( &fourTupX, 1, MPI::CHAR, 1, 1 );
and receive it in another side:
int l;
source=0;
MPI::COMM_WORLD.Recv (&l,1,MPI::INT , source, 7, status1 );
cout<<l;
char* myfourTupX=new char[l];
MPI::COMM_WORLD.Recv (myfourTupX,l,MPI_CHAR , source, 1, status1 );
but after receiving there isn't any thing in fourTupx!!! what is the problem?