|
Boost Users : |
Subject: Re: [Boost-users] [Boost.MPI] question about serializingcustomobject
From: Cristobal Navarro (axischire_at_[hidden])
Date: 2010-08-30 11:09:35
sure,
this is master process, sends objects.
#SENDER PROCESS (rank 0)
printf("sending latticec to worker 1\n");
lat->print(); //to see what i am sending
cin >> a;
world.send(1, 1, lat);
#RECEIVER PROCESS (rank 1)
Lattice* latr;
printf("worker%2d:: waiting master signal...\n", world.rank());
world.recv(0, 1, latr);
printf("OK\n");
latr->print();
#this is the Lattice class, i have commented almost all atributes on the
serialization method except 2 integers.
class Lattice{
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int version){
ar & numNodes;
ar & numEdges;
//ar & nodes;
//ar & edges;
//ar & keyLists;
//ar & corrupt;
//ar & rec;
//ar & nop;
//ar & acumCoef;
//ar & key;
}
public:
int numNodes;
int numEdges;
map<int, Edge> edges;
map<int, Node> nodes;
string key;
list< list<int> > keyLists;
bool corrupt;
bool rec;
int nop;
string acumCoef;
}
#when i send the object it has
Nodes=2 Edges= 1
#when i receive it, i get
Nodes=131072 Edges= 65536
On Mon, Aug 30, 2010 at 5:46 AM, Matthias Troyer <troyer_at_[hidden]>wrote:
>
> On Aug 30, 2010, at 2:05 AM, Cristobal Navarro wrote:
>
> > hello again
> >
> > i wrote my code for sending one object from rank 0 to rank 1 process sing
> boost.mpi because it is very simple.
> > it worked when sending a string just like in the documentation,
> >
> > however when i sent the object i showed earlier i am getting errors.
> >
> > terminate called after throwing an instance of
> > 'boost::archive::archive_
> > exception'
> > what(): class version St8multimapIiiSt4lessIiESaISt4pairIKiiEEE
> > [lenovo00:06116] *** Process received signal ***
> > [lenovo00:06116] Signal: Aborted (6)
> > [lenovo00:06116] Signal code: (-6)
> > [lenovo00:06116] [ 0] [0x71f410]
> > [lenovo00:06116] [ 1] /lib/tls/i686/cmov/libc.so.6(abort+0x182)
> [0x74da82]
> > [lenovo00:06116] [ 2]
> >
> /usr/lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x14f)
> > [0x4da52f]
> > [lenovo00:06116] [ 3] /usr/lib/libstdc++.so.6(+0xbd465) [0x4d8465]
> > [lenovo00:06116] [ 4] /usr/lib/libstdc++.so.6(+0xbd4a2) [0x4d84a2]
> > [lenovo00:06116] [ 5] /usr/lib/libstdc++.so.6(+0xbd5e1) [0x4d85e1]
> > [lenovo00:06116] [ 6]
> >
> bin/release/plattice(_ZN5boost13serialization15throw_exceptionINS_7archive17archive_exceptionEEEvRKT_+0x3e)
> > [0x80ee491]
> > ...
> > ...
> > ...
> > says something about multimap type error and other
> > things. if i remove the multimap attribute from the serialization method
> i get another
> > error, and if i comment almost everything and only keep 2 integers
> > (numNodes numEdges) for testing... the receiving object has different
> values on
> > those integers.
> >
> > this can be a problem of the internal serializing which uses
> > packed_oarchive/iarchive instead of the binary_oarchive/iarchive i was
> testing earlier when it worked??
> > any indication is welcome if you need more debugging information i can
> provide
> >
>
> Please post the code that just sends two integers and fails to receive them
> correctly
>
> Matthias
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net