当我尝试将我的c ++程序与英特尔MPI连接起来时,我遇到了这个问题:
[key01027@ginar ising]$ mpiicc -o bin/ising obj/main.o obj/solver.o obj/periodicfunction.o obj/tools.o obj/treeofdevil.o -L ~/ising_solver/gurobi650/linux64/lib/ -L ~/ising_solver/boost_install/lib/ -parallel -lgurobi_c++ -lgurobi65 -lboost_regex -lboost_thread -lboost_system -lboost_mpi -lboost_serialization
obj/solver.o: In function `boost::archive::detail::iserializer<boost::mpi::packed_iarchive, std::vector<double, std::allocator<double> > >::load_object_data(boost::archive::detail::basic_iarchive&, void*, unsigned int) const':
solver.cpp:(.text._ZNK5boost7archive6detail11iserializerINS_3mpi15packed_iarchiveESt6vectorIdSaIdEEE16load_object_dataERNS1_14basic_iarchiveEPvj[_ZNK5boost7archive6detail11iserializerINS_3mpi15packed_iarchiveESt6vectorIdSaIdEEE16load_object_dataERNS1_14basic_iarchiveEPvj]+0x209): undefined reference to `boost::serialization::array_wrapper<double> const boost::serialization::make_array<unsigned long>(double*, unsigned long)'
关键错误是:
undefined reference to `boost::serialization::array_wrapper<double> const boost::serialization::make_array<unsigned long>(double*, unsigned long)'
我想我正确安装了boost mpi。我已在链接中包含序列化(-lboost_serialization)......我该怎么办?
我不确定是因为以下序列化方案,序列化boost元组:
namespace boost { namespace serialization {
template<typename Archive, typename T1>
void serialize(Archive & ar,
boost::tuple<T1> & t,
const unsigned int)
{
ar & t.get<0>();
}
template<typename Archive, typename T1,typename T2>
void serialize(Archive & ar,
boost::tuple<T1,T2> & t,
const unsigned int)
{
ar & t.get<0>();
ar & t.get<1>();
}
template<typename Archive, typename T1,typename T2,typename T3>
void serialize(Archive & ar,
boost::tuple<T1, T2, T3> & t,
const unsigned int)
{
ar & t.get<0>();
ar & t.get<1>();
ar & t.get<2>();
}
template<typename Archive, typename T1,typename T2,typename T3 ,typename T4>
void serialize(Archive & ar,
boost::tuple<T1, T2, T3 ,T4> & t,
const unsigned int)
{
ar & t.get<0>();
ar & t.get<1>();
ar & t.get<2>();
ar & t.get<3>();
}
template<typename Archive, typename T1,typename T2,typename T3 ,typename T4,typename T5>
void serialize(Archive & ar,
boost::tuple<T1, T2, T3 ,T4, T5> & t,
const unsigned int)
{
ar & t.get<0>();
ar & t.get<1>();
ar & t.get<2>();
ar & t.get<3>();
ar & t.get<4>();
}
template<typename Archive, typename T1,typename T2,typename T3 ,typename T4,typename T5,typename T6 >
void serialize(Archive & ar,
boost::tuple<T1, T2, T3 ,T4, T5, T6> & t,
const unsigned int)
{
ar & t.get<0>();
ar & t.get<1>();
ar & t.get<2>();
ar & t.get<3>();
ar & t.get<4>();
ar & t.get<5>();
}
template<typename Archive, typename T1,typename T2,typename T3 ,typename T4,typename T5,typename T6 ,typename T7>
void serialize(Archive & ar,
boost::tuple<T1, T2, T3 ,T4, T5, T6 ,T7> & t,
const unsigned int)
{
ar & t.get<0>();
ar & t.get<1>();
ar & t.get<2>();
ar & t.get<3>();
ar & t.get<4>();
ar & t.get<5>();
ar & t.get<6>();
}
}}
答案 0 :(得分:1)
在文件&#34; boost / include / boost / serialization / array.hpp&#34;中,注释掉这两行:
template<class S>
friend const boost::serialization::array_wrapper<T> make_array( T* t, S s);
然后它会很好地链接。
答案 1 :(得分:0)
好的....基本上,我使用boost 1.58.0而不是boost 1.61.0重新执行与下面相同的安装:
how do i install boost with intel compiler and intel mpi?
问题就消失了......我不确定为什么......