Currently I am working on parallel application which uses MPI. My problem is to serialize an object TH3D in slavers nodes to send it to master. In master node I use TH3D:Add to sum every object received. I guess serializing should be done by TStreamer and TBuffer, but I do not know how!
Does anybody could help?
Luís A. Perles
Medical Physics PhD. Student
USP - Brazil
Thank you for quick answer. Those examples was almost what I needed.
I am using the Object Oriented implementation of MPI (OOMPI), which seens to be the best approach when building a full object oriented application. With MPI/OOMPI I can send only basic types or vectors (int, double, char, and so on). It is possible to serialize an object by TMessage::Buffer() method, inherited from TBuffer class. This is my program to a slave node (it is working):
My problem now is how to fill a TMessage/TBuffer with a received message and get the object. I have tried this program on master node without success:
for(Int_t i = 1; i < size; i++)
{
int lg;
OOMPI_COMM_WORLD[i].Recv(lg); //buffer length
char *kg = new char [lg]; //buffer
OOMPI_COMM_WORLD[i].Recv(kg,lg);
msg = new TMessage ();
msg->SetBuffer (kg, lg); //filling message buffer
TH1D *h1s = (TH1D *) msg->ReadObject(msg->GetClass());
h1s->Draw();
}
Where ‘i’ run over my all nodes.
I can compile this program, but when I run I get this error message:
*** Break *** segmentation violation
Generating stack trace…
0x4139cca8 in from /lib/i686/libc.so.6
0x41389c57 in __libc_start_main + 0xc7 from /lib/i686/libc.so.6
0x08066d41 in strcpy + 0x3d from testprogram
Does anybody could explain me why my code above does not work?
I am trying to serialize a ROOT object to send it through MPI interface. It should not be very dificult, but the lack of information about it compromises a lot the development. Its almost done but I can not get back the serialized ROOT object. Where is the mistake?
Thank you very much for your helpfull hints! I have adopted the Rademakers suggestion, but I plan to test Phillipe suggestion .
These hints helped me to build a simple library, which I will describe in “My Root App” section.