Re: [Boost-users] mpi/serialization: broadcasting derived class through base pointer
-----Original Message----- From: Matthias Troyer [mailto:troyer@phys.ethz.ch] Sent: 16 December 2010 15:20 To: Subject: Re: [Boost-users] mpi/serialization: broadcast function and the value argument
On Dec 16, 2010, at 10:54 PM, Hicham Mouline wrote:
1.44 As I wrote, I am able to debug deep into boost mpi and archive. Please let me know if I should send any more stacks or other data,
Please try with 1.45. Pointer serialization in Boost.MPI has been broken in 1.44 due to changes in Boost.Serialization.
Matthias
Hello Matthias, Robert Ramey, I am revisiting the topic of mpi broadcast-receiving a polymorphic object through a base class null pointer: void recv_histodata(boost::mpi::communicator& world) { historical_data_base* hd = nullptr; boost::mpi::broadcast(world, hd, master_process); } historical_data_base has 3 derived classes. I get the unregistered class exception from the serialization library, and so I am trying to register the derived type as shown in the serialization doc at /libs/serialization/doc/index.html : reference ar.template register_type<derived_one>(); but where do I put that? Regards, MM
MM wrote:
-----Original Message----- ...
Hello Matthias, Robert Ramey, I am revisiting the topic of mpi broadcast-receiving a polymorphic object through a base class null pointer:
void recv_histodata(boost::mpi::communicator& world) { historical_data_base* hd = nullptr; boost::mpi::broadcast(world, hd, master_process); } historical_data_base has 3 derived classes.
I get the unregistered class exception from the serialization library, and so I am trying to register the derived type as shown in the serialization doc at /libs/serialization/doc/index.html : reference
ar.template register_type<derived_one>();
but where do I put that?
invoke that any time after the archive is created but before the "derived_one" is serialized. make sure you do it in the same place on saving an loading. I believe the following would work. binary_oarchive oa(...) oa.template register_type<derived_one>; ... binary_iarchive ia(...) ia.template register_type<derived_one>; ...
Regards,
MM
-----Original Message----- invoke that any time after the archive is created but before the "derived_one" is serialized. make sure you do it in the same place on saving an loading. I believe the following would work.
binary_oarchive oa(...)
oa.template register_type<derived_one>;
...
binary_iarchive ia(...) ia.template register_type<derived_one>; ...
Matthias, Is this something automatically done in boost::mpi::broadcast() or the functions it calls? My user code doesn't deal with the archive directly, it's boost::mpi's that does. Regards MM
-----Original Message-----
From: boost-users-bounces@lists.boost.org [mailto:boost-users-
bounces@lists.boost.org] On Behalf Of Robert Ramey
Sent: 20 January 2012 17:05
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] mpi/serialization: broadcasting derivedclass
through base pointer
MM wrote:
-----Original Message-----
...
Hello Matthias, Robert Ramey,
I am revisiting the topic of mpi broadcast-receiving a polymorphic
object through a base class null pointer:
void recv_histodata(boost::mpi::communicator& world)
{
historical_data_base* hd = nullptr;
boost::mpi::broadcast(world, hd, master_process);
}
historical_data_base has 3 derived classes.
I get the unregistered class exception from the serialization
library, and so I am trying to register the derived type as shown in
the serialization doc at /libs/serialization/doc/index.html :
reference
ar.template register_type<derived_one>();
but where do I put that?
invoke that any time after the archive is created but before the
"derived_one" is serialized.
make sure you do it in the same place on saving an loading. I believe
the
following would work.
binary_oarchive oa(...)
oa.template register_type<derived_one>;
...
binary_iarchive ia(...)
ia.template register_type<derived_one>;
...
I went with the export guid route. It builds but it seems to go into an infinite loop. This is: interface_archive.hpp template<class T> Archive & operator>>(T & t){
this->This()->load_override(t, 0);
return * this->This(); } which calls itself again after a couple of in-between calls to other functions. Here is a stack:
nhcomp.exe!boost::archive::detail::interface_iarchive<boost::mpi::packed_iar chive>::operator>><boost::archive::class_id_type>(boost::archive::class_id_t ype & t) Line 60 C++ nhcomp.exe!boost::archive::detail::common_iarchive<boost::mpi::packed_iarchi ve>::vload(boost::archive::class_id_type & t) Line 52 C++ nhcomp.exe!boost::archive::detail::basic_iarchive_impl::load<boost::archive: :class_id_type>(boost::archive::detail::basic_iarchive & ar, boost::archive::class_id_type & t) Line 198 C++ nhcomp.exe!boost::archive::detail::basic_iarchive_impl::load_pointer(boost:: archive::detail::basic_iarchive & ar, void * & t, const boost::archive::detail::basic_pointer_iserializer * bpis_ptr, const boost::archive::detail::basic_pointer_iserializer * (const boost::serialization::extended_type_info &)* finder) Line 411 C++ nhcomp.exe!boost::archive::detail::basic_iarchive::load_pointer(void * & t, const boost::archive::detail::basic_pointer_iserializer * bpis_ptr, const boost::archive::detail::basic_pointer_iserializer * (const boost::serialization::extended_type_info &)* finder) Line 551 C++ nhcomp.exe!boost::archive::detail::load_pointer_type<boost::mpi::packed_iarc hive>::invoke<nicohich::histodatas::historical_data_base *>(boost::mpi::packed_iarchive & ar, nicohich::histodatas::historical_data_base * & t) Line 524 + 0x15 bytes C++ nhcomp.exe!boost::archive::load<boost::mpi::packed_iarchive,nicohich::histod atas::historical_data_base *>(boost::mpi::packed_iarchive & ar, nicohich::histodatas::historical_data_base * & t) Line 592 + 0xd bytes C++ nhcomp.exe!boost::archive::detail::common_iarchive<boost::mpi::packed_iarchi ve>::load_override<nicohich::histodatas::historical_data_base *>(nicohich::histodatas::historical_data_base * & t, int __formal) Line 66 + 0x15 bytes C++ nhcomp.exe!boost::mpi::packed_iarchive::load_override<nicohich::histodatas:: historical_data_base *>(nicohich::histodatas::historical_data_base * & x, int version, boost::mpl::bool_<0> __formal) Line 102 C++ nhcomp.exe!boost::mpi::packed_iarchive::load_override<nicohich::histodatas:: historical_data_base *>(nicohich::histodatas::historical_data_base * & x, int version) Line 119 C++ nhcomp.exe!boost::archive::detail::interface_iarchive<boost::mpi::packed_iar chive>::operator>><nicohich::histodatas::historical_data_base *>(nicohich::histodatas::historical_data_base * & t) Line 61 C++ rds,
On Jan 21, 2012, at 12:16 AM, MM wrote:
I went with the export guid route. It builds but it seems to go into an infinite loop.
This is:
interface_archive.hpp template<class T> Archive & operator>>(T & t){
this->This()->load_override(t, 0);
return * this->This(); }
which calls itself again after a couple of in-between calls to other functions. Here is a stack:
nhcomp.exe!boost::archive::detail::interface_iarchive<boost::mpi::packed_iarchive>::operator>><boost::archive::class_id_type>(boost::archive::class_id_type & t) Line 60 C++
nhcomp.exe!boost::archive::detail::common_iarchive<boost::mpi::packed_iarchive>::vload(boost::archive::class_id_type & t) Line 52 C++ nhcomp.exe!boost::archive::detail::basic_iarchive_impl::load<boost::archive::class_id_type>(boost::archive::detail::basic_iarchive & ar, boost::archive::class_id_type & t) Line 198 C++ nhcomp.exe!boost::archive::detail::basic_iarchive_impl::load_pointer(boost::archive::detail::basic_iarchive & ar, void * & t, const boost::archive::detail::basic_pointer_iserializer * bpis_ptr, const boost::archive::detail::basic_pointer_iserializer * (const boost::serialization::extended_type_info &)* finder) Line 411 C++ nhcomp.exe!boost::archive::detail::basic_iarchive::load_pointer(void * & t, const boost::archive::detail::basic_pointer_iserializer * bpis_ptr, const boost::archive::detail::basic_pointer_iserializer * (const boost::serialization::extended_type_info &)* finder) Line 551 C++ nhcomp.exe!boost::archive::detail::load_pointer_type<boost::mpi::packed_iarchive>::invoke<nicohich::histodatas::historical_data_base *>(boost::mpi::packed_iarchive & ar, nicohich::histodatas::historical_data_base * & t) Line 524 + 0x15 bytes C++ nhcomp.exe!boost::archive::load<boost::mpi::packed_iarchive,nicohich::histodatas::historical_data_base *>(boost::mpi::packed_iarchive & ar, nicohich::histodatas::historical_data_base * & t) Line 592 + 0xd bytes C++ nhcomp.exe!boost::archive::detail::common_iarchive<boost::mpi::packed_iarchive>::load_override<nicohich::histodatas::historical_data_base *>(nicohich::histodatas::historical_data_base * & t, int __formal) Line 66 + 0x15 bytes C++ nhcomp.exe!boost::mpi::packed_iarchive::load_override<nicohich::histodatas::historical_data_base *>(nicohich::histodatas::historical_data_base * & x, int version, boost::mpl::bool_<0> __formal) Line 102 C++ nhcomp.exe!boost::mpi::packed_iarchive::load_override<nicohich::histodatas::historical_data_base *>(nicohich::histodatas::historical_data_base * & x, int version) Line 119 C++ nhcomp.exe!boost::archive::detail::interface_iarchive<boost::mpi::packed_iarchive>::operator>><nicohich::histodatas::historical_data_base *>(nicohich::histodatas::historical_data_base * & t) Line 61 C++
rds,
this is not an infinite loop since it calls operator>> with a different type - can you please post more if you think there is an infinite loop. I am still confused as to what the reason for your problems is. Also, did you test whether what you want to do works if you use binary archives, to store and load the object? Matthias
From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Matthias Troyer Sent: 29 January 2012 12:32 To: boost-users@lists.boost.org Subject: Re: [Boost-users] mpi/serialization: broadcasting derivedclass
through base pointer
this is not an infinite loop since it calls operator>> with a different
type - can you please post more if you think there is an infinite >loop. I am still confused as to what the reason for your problems is.
Also, did you test whether what you want to do works if you use binary
archives, to store and load the object?
Matthias
This was happening at a stage where I was not consistent in the sending broadcast with the receiving broadcast. Just to double check, I assume that it should be possible to: 1. send with mpi::broadcast( , const base_pointer, ) and receive with mpi::broadcast( , const base_pointer, ), granted the derived classes have been exported with BOOST_CLASS_EXPORT_KEY in both translation units. 2. send with mpi::broadcast( , const derived_pointer, ) and receive with mpi::broadcast( , const base_pointer, ), granted the derived classes have been exported with BOOST_CLASS_EXPORT_KEY in both translation units. I am doing 1. and 2.. In both cases the receiver throws "class unregistered" even though the BOOST_CLASS_EXPORT_KEY expands correctly in both sender and receiver(slave) translation units. What was the fix you were comitting over the weekend? thanks MM
On Jan 29, 2012, at 2:26 PM, MM wrote:
From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Matthias Troyer Sent: 29 January 2012 12:32 To: boost-users@lists.boost.org Subject: Re: [Boost-users] mpi/serialization: broadcasting derivedclass through base pointer
this is not an infinite loop since it calls operator>> with a different type - can you please post more if you think there is an infinite >loop. I am still confused as to what the reason for your problems is.
Also, did you test whether what you want to do works if you use binary archives, to store and load the object?
Matthias
This was happening at a stage where I was not consistent in the sending broadcast with the receiving broadcast.
Just to double check, I assume that it should be possible to:
1. send with mpi::broadcast( , const base_pointer, ) and receive with mpi::broadcast( , const base_pointer, ), granted the derived classes have been exported with BOOST_CLASS_EXPORT_KEY in both translation units.
2. send with mpi::broadcast( , const derived_pointer, ) and receive with mpi::broadcast( , const base_pointer, ), granted the derived classes have been exported with BOOST_CLASS_EXPORT_KEY in both translation units.
I am doing 1. and 2.. In both cases the receiver throws "class unregistered" even though the BOOST_CLASS_EXPORT_KEY expands correctly in both sender and receiver(slave) translation units.
Yes, the idea is that these should work. To see where the problem is I had asked you:
… did you test whether what you want to do works if you use binary archives, to store and load the object?
Matthias
Matthias Troyer, I send the broadcast with send.cpp boost::mpi::broadcast( , const derived*&, ) receive.cpp boost::mpi::broadcast( , base*&, ) both .cpp files contain BOOST_CLASS_EXPORT_KEY macro for the derived types. send succeeds while receive throws unregistered exception however. Robert Ramey, while debugging, could you point out where I should see the class name being sent down the archive? and where it is read from the archive? Thanks, MM
Matthias Troyer,
I send the broadcast with
send.cpp boost::mpi::broadcast( , const derived*&, )
receive.cpp boost::mpi::broadcast( , base*&, )
both .cpp files contain BOOST_CLASS_EXPORT_KEY macro for the derived types.
send succeeds while receive throws unregistered exception however.
Robert Ramey, while debugging, could you point out where I should see the class name being sent down the archive? and where it is read from the archive?
Thanks,
MM
I confirm that on the reception side, the class name is not found in the archive (debugging this). typedef templateclass<arg> myclass; On the sending side, I have BOOST_CLASS_EXPORT_KEY( namespace::namespace::myclass ) I don't know why it is not sent down the pipe. Could someone pinpoint where I should see the class name sent in the mpi archive code? It is obvious where for input but not for output. MM
MM wrote: typedef templateclass<arg> myclass;
On the sending side, I have BOOST_CLASS_EXPORT_KEY( namespace::namespace::myclass )
I don't know why it is not sent down the pipe.
Note that you'll have to have BOOST_CLASS_EXPORT... on BOTH sides. This is usually assured by having the save and load symetrical. Robert Ramey
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Robert Ramey Sent: 24 January 2012 17:53 To: boost-users@lists.boost.org Subject: Re: [Boost-users] mpi/serialization: broadcasting derived classhrough base pointer 1.47
MM wrote: typedef templateclass<arg> myclass;
On the sending side, I have BOOST_CLASS_EXPORT_KEY( namespace::namespace::myclass )
I don't know why it is not sent down the pipe.
Note that you'll have to have BOOST_CLASS_EXPORT... on BOTH sides.
This is usually assured by having the save and load symetrical.
Robert Ramey
Thanks, I do. So there's nothing particular about using BOOST_CLASS_EXPORT_KEY with a instantiation of a class template? I think what's left is to find where the class name is written for the mpi o packed archive, which is what I'm looking for. MM
On 24 Jan 2012, at 19:28, MM wrote:
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Robert Ramey Sent: 24 January 2012 17:53 To: boost-users@lists.boost.org Subject: Re: [Boost-users] mpi/serialization: broadcasting derived classhrough base pointer 1.47
MM wrote: typedef templateclass<arg> myclass;
On the sending side, I have BOOST_CLASS_EXPORT_KEY( namespace::namespace::myclass )
I don't know why it is not sent down the pipe.
Note that you'll have to have BOOST_CLASS_EXPORT... on BOTH sides.
This is usually assured by having the save and load symetrical.
Robert Ramey
Thanks, I do.
So there's nothing particular about using BOOST_CLASS_EXPORT_KEY with a instantiation of a class template?
I think what's left is to find where the class name is written for the mpi o packed archive, which is what I'm looking for.
I found the cuplrit and will submit a patch when I find time - probably tomorrow night or over the weekend. Matthias
On Thu, Jan 26, 2012 at 7:24 PM, Matthias Troyer <troyer@phys.ethz.ch> wrote:
On 24 Jan 2012, at 19:28, MM wrote:
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Robert Ramey Sent: 24 January 2012 17:53 To: boost-users@lists.boost.org Subject: Re: [Boost-users] mpi/serialization: broadcasting derived classhrough base pointer 1.47
MM wrote: typedef templateclass<arg> myclass;
On the sending side, I have BOOST_CLASS_EXPORT_KEY( namespace::namespace::myclass )
I don't know why it is not sent down the pipe.
Note that you'll have to have BOOST_CLASS_EXPORT... on BOTH sides.
This is usually assured by having the save and load symetrical.
Robert Ramey
Thanks, I do.
So there's nothing particular about using BOOST_CLASS_EXPORT_KEY with a instantiation of a class template?
I think what's left is to find where the class name is written for the mpi o packed archive, which is what I'm looking for.
I found the cuplrit and will submit a patch when I find time - probably tomorrow night or over the weekend. Matthias
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
has this been fixed yet?
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Jari Sent: 19 February 2012 23:39 To: boost-users@lists.boost.org Subject: Re: [Boost-users] mpi/serialization: broadcasting derived classhrough base pointer 1.47
On Thu, Jan 26, 2012 at 7:24 PM, Matthias Troyer <troyer@phys.ethz.ch> wrote:
On 24 Jan 2012, at 19:28, MM wrote:
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Robert Ramey Sent: 24 January 2012 17:53 To: boost-users@lists.boost.org Subject: Re: [Boost-users] mpi/serialization: broadcasting derived classhrough base pointer 1.47
MM wrote: typedef templateclass<arg> myclass;
On the sending side, I have BOOST_CLASS_EXPORT_KEY( namespace::namespace::myclass )
I don't know why it is not sent down the pipe.
Note that you'll have to have BOOST_CLASS_EXPORT... on BOTH sides.
This is usually assured by having the save and load symetrical.
Robert Ramey
Thanks, I do.
So there's nothing particular about using BOOST_CLASS_EXPORT_KEY
instantiation of a class template?
I think what's left is to find where the class name is written for
packed archive, which is what I'm looking for.
I found the cuplrit and will submit a patch when I find time -
with a the mpi o probably tomorrow night or over the weekend.
Matthias
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
has this been fixed yet?
Matthias asked me to test the mpi archives. I need to get time to look at the issue again. Do you observe the same problem? Regards MM
On Mon, Feb 20, 2012 at 12:07 PM, MM <finjulhich@gmail.com> wrote:
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Jari Sent: 19 February 2012 23:39 To: boost-users@lists.boost.org Subject: Re: [Boost-users] mpi/serialization: broadcasting derived classhrough base pointer 1.47
On Thu, Jan 26, 2012 at 7:24 PM, Matthias Troyer <troyer@phys.ethz.ch> wrote:
On 24 Jan 2012, at 19:28, MM wrote:
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Robert Ramey Sent: 24 January 2012 17:53 To: boost-users@lists.boost.org Subject: Re: [Boost-users] mpi/serialization: broadcasting derived classhrough base pointer 1.47
MM wrote: typedef templateclass<arg> myclass;
On the sending side, I have BOOST_CLASS_EXPORT_KEY( namespace::namespace::myclass )
I don't know why it is not sent down the pipe.
Note that you'll have to have BOOST_CLASS_EXPORT... on BOTH sides.
This is usually assured by having the save and load symetrical.
Robert Ramey
Thanks, I do.
So there's nothing particular about using BOOST_CLASS_EXPORT_KEY
instantiation of a class template?
I think what's left is to find where the class name is written for
packed archive, which is what I'm looking for.
I found the cuplrit and will submit a patch when I find time -
with a the mpi o probably tomorrow night or over the weekend.
Matthias
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
has this been fixed yet?
Matthias asked me to test the mpi archives. I need to get time to look at the issue again. Do you observe the same problem?
Regards
MM
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
yes class name not found. but i think I got it working but include correct headers before BOOST_CLASS_EXPORT macro. the macro didnt register the class until this. but i dont know what headers it requires i just included lot of the serialization headers
terminate called after throwing an instance of 'boost::archive::archive_exception' what(): array size too short What does this error mean? The message was too small or std::vector size was not big enough? std::vector< boost::mpi::request > reqs ; std::vector< T > Neighbor2Proc ; std::vector< T > Neighbor4Proc( 18 ) ;
Hello, On Tue, Jan 31, 2012 at 03:30, Jacques C. Richard <richard@tamu.edu> wrote:
terminate called after throwing an instance of 'boost::archive::archive_exception' what(): array size too short
What does this error mean? The message was too small or std::vector size was not big enough?
It's hard to say withour seeing any code. Can you please post a minimal example that produces the error? Best regards, Riccardo
Here's a much, much reduced version (w/o fftw)! Thanks! On Jan 31, 2012, at 4:34 AM, Riccardo Murri wrote:
Hello,
On Tue, Jan 31, 2012 at 03:30, Jacques C. Richard <richard@tamu.edu> wrote:
terminate called after throwing an instance of 'boost::archive::archive_exception' what(): array size too short
What does this error mean? The message was too small or std::vector size was not big enough?
It's hard to say withour seeing any code.
Can you please post a minimal example that produces the error?
Best regards, Riccardo
Dr. Jacques C. Richard NSF Research Experiences for Undergraduates (REU) Sites Sr. Lecturer/Research Associate, Aerospace Engineering Dept. Texas A & M University, College Station, TX 77843-3141 richard@tamu.edu 979-845-3916 (fax 6051) http://aeweb.tamu.edu/Richard/
From the backtrace it seems that the code dies when performing serialization of a "lattice_type" element. This leads me to think
Hello, I tried to run your code but it's still too big and complex for me to be able to say anything without a long debugging session, which I cannot do now. So please take this email with a grain of salt, as I could have totally misunderstood the code... I compiled the code you sent with Boost.MPI 1.45 and OpenMPI 1.4. Running it on two MPI ranks, I always get the same two errors: * Rank 1 dies with the "archive_exception / array size too short" error, but * Rank 0 dies with a segmentation fault. I managed to get rid of the "archive_exception / array size too short" error from rank 1 (modified slbmpi.h attached), but the rank 0 still segfaults. (1) Concerning the "array size" error: your code reads: reqs.push_back( world.isend( Sender , SendTag , &Neighbor2Proc[ i ] , Msg2Send_size ) ) ; [Aside: I think there's a typo here: the first argument to "world.isend" is the *destination rank*, so I guess you have "Sender" where "Receiver" should be...] This sends Msg2Send_size elements of type "lattice_type" starting at location "&Neighbor2Proc[i]". However, the corresponding "world.irecv" has: reqs.push_back( world.irecv( msg.source() , msg.tag() , Neighbor4Proc[ i ] ) ) ; // , Msg2Send_size: not compiling: request irecv(int source, int tag, T * values, int n) const; @ http://www.boost.org/doc/libs/1_48_0/doc/html/boost/mpi/communicator.html#id... so you are receiving an array of "Msg2Send_size" elements into a single value of type "lattice_type". If you change the sender line to: reqs.push_back( world.isend( Receiver , SendTag , Neighbor2Proc[i] ) ); then the type of the sent object and the receiving slot do match, and the error is gone. If you wanted to send more than one element of Neighbor2Proc, then you have to use an exactly corresponding type in the recv call. (2) Regading the segfault: Adding some debug statements to slbmpi.h, I can see that it dies when executing "world.isend(..., Neighbor2Proc[i])": rmurri@xenia:~/tst$ mpirun -np 2 --tag-output ./a.out ... [1,0]<stdout>:Process=0's MiniGridSize= 3 3 3 ... [1,0]<stdout>:init_internal_neighbors_wf: Process 0 of 2 about to exchange (if necessary) w/+/-1! Sender=0, Receiver=1, Neighbor2Proc.size()=1, Msg2Send_size=1, i=0 @ idx= 0 0 0 [1,0]<stdout>: [1,0]<stdout>:Pause @ "init_internal_neighbors_wf: _slbmpi_h: 108: pre-exchange" if 1 process: <Enter> or <Return> continues; ^C aborts: [1,0]<stderr>:DEBUG: slbmpi.h:124 <==== THIS IS JUST BEFORE world.isend(...) [1,0]<stderr>:[xenia:06768] *** Process received signal *** [1,0]<stderr>:[xenia:06768] Signal: Segmentation fault (11) [1,0]<stderr>:[xenia:06768] Signal code: (128) [1,0]<stderr>:[xenia:06768] Failing at address: (nil) [1,0]<stderr>:[xenia:06768] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x10060) [0x7f6453010060] [1,0]<stderr>:[xenia:06768] [ 1] ./a.out(_ZN5boost7archive4saveINS_3mpi15packed_oarchiveEKP12lattice_typeEEvRT_RT0_+0x14) [0x44b4aa] ... [1,0]<stderr>:[xenia:06768] [29] ./a.out(_ZN5boost7archive4saveINS_3mpi15packed_oarchiveEKNS_13serialization5arrayIKP12lattice_typeEEEEvRT_RT0_+0x23) [0x44a1f0] [1,0]<stderr>:[xenia:06768] *** End of error message *** that the "lattice_type" element "Neighbor2Proc[i]" has not been fully initialized. Now the serialization code for "lattice_type" reads: struct lattice_type { ... public: lattice_type* neighbors[ en - 1 ]; .... protected: template<class Archive> //serializes (boost::mpi::packed_iarchive& ar) & deserializes (boost::mpi::packed_oarchive& ar) inline void serialize( Archive & ar , const unsigned int ) { ar & neighbors ; // for 'packing' (& unpacking) for message-passing: put together in 'series' to exchange } ... As far as I understand, this means the boost::serialization code will try to dereference each pointer in the "neighbors" array and serialize the pointed-to elements. Could it be that some elements of "lattice_type::neighbors" are NULL pointers? (It would make sense for elements at a corner of the grid.) Also, IIRC, the "serialize" code is responsible for serializing *all* fields in a struct: in this case you are basically transmitting just a tiny part of the "lattice_type" and will thus get garbage on the receiving side... Hope this helps, Riccardo
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Robert Ramey Sent: 24 January 2012 17:53 To: boost-users@lists.boost.org Subject: Re: [Boost-users] mpi/serialization: broadcasting derived classhrough base pointer 1.47
MM wrote: typedef templateclass<arg> myclass;
On the sending side, I have BOOST_CLASS_EXPORT_KEY( namespace::namespace::myclass )
I don't know why it is not sent down the pipe.
Note that you'll have to have BOOST_CLASS_EXPORT... on BOTH sides.
This is usually assured by having the save and load symetrical.
Robert Ramey
I have generated preprocessed output of the translation unit and the macros expand correctly to: namespace boost { namespace serialization { template<> struct guid_defined< nicohich::histodatas::daily_data > : boost::mpl::true_ {}; template<> inline const char * guid< nicohich::histodatas::daily_data >(){ return "nicohich::histodatas::daily_data"; } } } namespace boost { namespace serialization { template<> struct guid_defined< nicohich::histodatas::future_daily_data > : boost::mpl::true_ {}; template<> inline const char * guid< nicohich::histodatas::future_daily_data >(){ return "nicohich::histodatas::future_daily_data"; } } } namespace boost { namespace serialization { template<> struct guid_defined< nicohich::histodatas::minute_data > : boost::mpl::true_ {}; template<> inline const char * guid< nicohich::histodatas::minute_data >(){ return "nicohich::histodatas::minute_data"; } } } This bit appears AFTER the _declaration_ of the serialize template function, but _before_ its implementation. These derived types only have the serialize<> template function, not the save and load because they don't need them. The base class has a save() and load(). This is very puzzling, Regards, MM
participants (6)
-
Jacques C. Richard
-
Jari
-
Matthias Troyer
-
MM
-
Riccardo Murri
-
Robert Ramey