我正在使用 boost 图形库并遇到运行时错误,我似乎无法弄清楚如何修复。
当我使用错误的顶点数和处理器数组合创建并广度优先搜索 rmat 图时,我得到一个 MPI_Unpack
运行时错误。
Number of Vertices
Processors | 1,000,000 | 2,000,000
1 | pass | pass
2 | pass | fail
3 | pass | pass
4 | pass | pass
根据堆栈跟踪,我认为代码在第一次同步调用时失败,因为在广度优先搜索代码中检查要处理的顶点队列是否为空。
有人能告诉我我的代码有什么问题吗?我在运行 red hat linux(版本 6.2)和 gcc 4.4.6 的 mac pro 上使用 boost 版本 1.41.0(如果有帮助的话)。
我的代码是:
#include <boost/graph/use_mpi.hpp>
#include <boost/mpi/environment.hpp>
#include <boost/mpi/communicator.hpp>
#include <boost/graph/distributed/concepts.hpp>
#include <boost/graph/adj_list_serialize.hpp>
#include <boost/graph/distributed/mpi_process_group.hpp>
#include <boost/graph/distributed/adjacency_list.hpp>
#include <boost/random/linear_congruential.hpp>
#include <boost/graph/distributed/breadth_first_search.hpp>
#include <boost/graph/rmat_graph_generator.hpp>
using namespace boost;
using namespace graph;
using namespace distributed;
int main(int argc, char* argv[])
{
mpi::environment env(argc, argv);
mpi::communicator world;
int verts = 20;
if(argc > 1){
verts = atoi(argv[1]);
}
int edgs = 12*verts;
if(argc > 2){
edgs = atoi(argv[2]);
}
typedef adjacency_list<listS, distributedS<mpi_process_group, vecS>, undirectedS> Graph;
minstd_rand gen_rmat;
typedef rmat_iterator<minstd_rand, Graph> RMATgen;
Graph g(RMATgen(gen_rmat, verts, 12*verts, 0.33, 0.15, 0.49, 0.03), RMATgen(), verts);
world.barrier();
synchronize(g.process_group());
world.barrier();
breadth_first_search(g, vertex(0, g), visitor(bfs_visitor<null_visitor>()));
world.barrier();
return 0;
}
我得到的运行时错误是:
terminate called after throwing an instance of boost::exception_detail::clone_impl
<boost::exception_detail::error_info_injector<boost::mph::exception> >
what(): MPI_Unpack: MPI_ERR_ARG: invalid argument of some other kind
最佳答案
事实证明升级到 boost 1.50.0 已经解决了这个问题。
关于c++ - Boost图库分布式广度优先搜索MPI_Unpack运行时报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11618483/