Cristobal Navarro wrote:
i made some progress while we were mailing between us.
first of all, im trying to see if my object can be serialized / deserialized in the common way without going into MPI yet.
good idea - one thing at a time.
objects are Lattices, they have Nodes and Edges. nothing more.
it compiles and links ok, and when i test serialization / deserialization with the following code..:
printf("serializing to binlat.x...\n"); //!file mode /* std::ofstream ofs("binlat.x", ios::binary); boost::archive::binary_oarchive oa(ofs); */ oa << *(this->lat); ofs.close(); lat->print(); //check what lattice im serializing //!Deserialization - read file binlat.x and reconstruct printf("reconstructing serialized binlat.x...\n"); Lattice nl; std::ifstream ifs("binlat.x", ios::binary); boost::archive::binary_iarchive ia(ifs); //!deserialize object ia >> nl; ifs.close(); nl.print();
Hmmm- what surrounds this?
oa << *(this->lat);
doesn't look right to me. coincidentally, this same construct is used on another thread anyay try { const class Lattice lat ... ... ar << lat } that might work better. Robert Ramey
i get bad errors when deserializing, complaining about a bool and char. serializing to binlat.x... Lattice::print().....START Nodes=2 Edges= 1 Node[0] sp=1 ext=1 Linked to edge 2 (Node 3 or 0 ) Node[3] sp=1 ext=2 Linked to edge 2 (Node 3 or 0 ) Lattice::print().....END [enter] reconstructing swerialized binlat.x... [enter] plattice: /usr/local/include/boost/archive/basic_binary_iprimitive.hpp:98: void boost::archive::basic_binary_iprimitive
::load(bool&) [with Archive = boost::archive::binary_iarchive, Elem = char, Tr = std::char_traits<char>]: Assertion `0 == i || 1 == i' failed. [lenovo00:29384] *** Process received signal *** [lenovo00:29384] Signal: Aborted (6) [lenovo00:29384] Signal code: (-6) [lenovo00:29384] [ 0] [0xfea410] [lenovo00:29384] [ 1] /lib/tls/i686/cmov/libc.so.6(abort+0x182) [0xd41a82] [lenovo00:29384] [ 2] /lib/tls/i686/cmov/libc.so.6(__assert_fail+0xf8) [0xd37718] [lenovo00:29384] [ 3] .. .. *** End of error message *** i started debugging, and realized that the problem is completely gone when i remove "edges" from the serialization members of "Lattice" object. its weird, because "edge" is a map of
and much simplier than "nodes" which does work. obviously i cannot continue without edges, so i need to fix it somehow, but i dont understand the error related to edges, maybe is something im not seeing. dont get distracted by the messy code, i had to edit it a little to focus on the case. regards Cristobal
On Thu, Aug 26, 2010 at 4:35 PM, Robert Ramey
wrote: Change the "would" into "is": it is possible to mix Boost.MPI with Boost.Serialization. Any objext that can be serialized can be sent by Boost.MPI. This was actually the basic idea behind Boost.MPI, to use Boost.Serialization to pack and unpack MPI buffers, or to create custom MPI datatypes.
On thing that I never understood is why you need MPI data types at all. If one is serializing (packing) to a binary array, and sending that, what hae MPI data types have to do with it.
If one were using heterogenious machines, I could understand the usage of MPI types. But as I understand it, the MPI serialization presumes that the machines are binary compatible. So I'm just not seeing this.
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users