然而,我遇到的第一个问题是,我的Windows HPC MPI和boost 1.63无法识别以下行:
typedef mpi :: process_group process_group_type;
我发现在这种情况下可以使用 boost::graph::distributed::mpi_process_group .
我的代码看起来像这样,并且除了一行之外,解释与教程几乎完全相同:
using namespace boost;
using boost::graph::distributed::mpi_process_group;
int main(int argc, char *argv[]) {
boost::mpi::environment env(argc, argv);
typedef adjacency_list < listS, distributedS,
directedS,
no_property, // Vertex properties
property // Edge properties
> graph_t;
typedef graph_traits < graph_t >::vertex_descriptor vertex_descriptor;
typedef graph_traits < graph_t >::edge_descriptor edge_descriptor;
typedef std::pair Edge;
const int num_nodes = 5;
enum nodes { A, B, C, D, E };
char name[] = "ABCDE";
Edge edge_array[] = { Edge(A, C), Edge(B, B), Edge(B, D), Edge(B, E),
Edge(C, B), Edge(C, D), Edge(D, E), Edge(E, A), Edge(E, B)
};
int weights[] = { 1, 2, 1, 2, 7, 3, 1, 1, 1 };
int num_arcs = sizeof(edge_array) / sizeof(Edge);
graph_t g(edge_array, edge_array + num_arcs, weights, num_nodes);
// Keeps track of the predecessor of each vertex
std::vector p(num_vertices(g));
// Keeps track of the distance to each vertex
std::vector d(num_vertices(g));
vertex_descriptor s = vertex(A, g);
dijkstra_shortest_paths
(g, s,
predecessor_map(
make_iterator_property_map(p.begin(), get(vertex_index, g))).
distance_map(
make_iterator_property_map(d.begin(), get(vertex_index, g)))
);
std::cout << std::endl;
return EXIT_SUCCESS;
}
尽管如此,我仍然有一个错误:
..boost_1_63_0 \ boost \ graph \ distributed \ dijkstra_shortest_paths.hpp(116):错误C2664:'void boost :: local_put,boost :: default_color_type>(boost :: dummy_property_map,const Key&,const Value&)':不能将参数1从'boost :: iterator_property_map >>,IndexMap,boost :: default_color_type,boost :: default_color_type&>'转换为'boost :: dummy_property_map'
我搜索了很多网站,我正在考虑尝试另一个提升版或另一个mpi . 教程是否按照链接中的说明工作,我的代码是否正常工作,或者我做错了什么?
非常感谢你!
Addendum: Problem was solved
这个问题的解决方案基本上是两件事:
首先,为了检查包含,我以错误的顺序包含了boost目录,从序列化开始并继续...
第二个因素是库和操作系统 . 一般来说,Boost Graph库在unix系统上运行得更顺畅 .