1
我想使用並行升壓圖庫運行Delta Stepping算法,但它不能編譯。能否請你幫忙。升壓三角洲步進
#include <boost/graph/use_mpi.hpp>
#include <boost/graph/distributed/mpi_process_group.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/distributed/delta_stepping_shortest_paths.hpp>
#include <boost/graph/distributed/adjacency_list.hpp>
#include <boost/graph/metis.hpp>
#include <boost/graph/distributed/graphviz.hpp>
#include <boost/property_map/property_map.hpp>
#include <fstream>
#include <string>
#ifdef BOOST_NO_EXCEPTIONS
void
boost::throw_exception(std::exception const& ex)
{
std::cout << ex.what() << std::endl;
abort();
}
#endif
using namespace boost;
using boost::graph::distributed::mpi_process_group;
/* An undirected, weighted graph with distance values stored on the
vertices. */
typedef adjacency_list<vecS, distributedS<mpi_process_group, vecS>, undirectedS,
/*Vertex properties=*/property<vertex_distance_t, float>,
/*Edge properties=*/property<edge_weight_t, float> >
Graph;
int main(int argc, char *argv[]) {
boost::mpi::environment env(argc, argv);
// Parse command-line options
const char *filename = "weighted_graph.gr";
if (argc > 1) filename = argv[1];
// Open the METIS input file
std::ifstream in(filename);
graph::metis_reader reader(in);
// Load the graph using the default distribution
Graph g(reader.begin(), reader.end(), reader.weight_begin(),
reader.num_vertices());
// Get vertex 0 in the graph
graph_traits<Graph>::vertex_descriptor start = vertex(0, g);
// Compute shortest paths from vertex 0
// dijkstra_shortest_paths(g, start,
// distance_map(get(vertex_distance, g)));
typedef typename graph_traits<Graph>::vertex_descriptor vertex_t;
typedef typename std::map<vertex_t, vertex_t> vertex_map_t;
typedef associative_property_map<vertex_map_t> predecessor_map_t;
vertex_map_t default_vertex_map;
predecessor_map_t default_predecessor_map(default_vertex_map);
typedef typename std::map<vertex_t, double> vertex_double_map_t;
typedef associative_property_map<vertex_double_map_t> distance_map_t;
vertex_double_map_t default_vertex_double_map;
distance_map_t default_distance_map(default_vertex_double_map);
graph::distributed::delta_stepping_shortest_paths(g, start, dummy_property_map(),
distance_map(get(vertex_distance, g)),
weight_map(get(edge_weight, g)));
// Output a Graphviz DOT file
std::string outfile = filename;
if (argc > 2)
outfile = argv[2];
else {
int i = outfile.rfind('.');
if (i != std::string::npos)
outfile.erase(outfile.begin() + i, outfile.end());
outfile += "-dijkstra.dot";
}
if (process_id(process_group(g)) == 0) {
std::cout << "Writing GraphViz output to " << outfile << "... ";
std::cout.flush();
}
write_graphviz(outfile, g,
make_label_writer(get(vertex_distance, g)),
make_label_writer(get(edge_weight, g)));
if (process_id(process_group(g)) == 0)
std::cout << "Done." << std::endl;
return 0;
}
我跑的代碼如下:
pratsriv @花盆:/家庭/ pratsriv /桌面/ ReadGraph $ MPIC++ parallelDeltastepping.cpp -I /家庭/ pratsriv/boost_1_64_0 /包括/ -L /家/ pratsriv/boost_1_64_0/lib目錄/ -lboost_mpi -lboost_graph_parallel -lboost_system -lboost_serialization
它給了我下面的錯誤:
In file included from parallelDeltastepping.cpp:18:0:
/home/pratsriv/boost_1_64_0/include/boost/graph/distributed/delta_stepping_shortest_paths.hpp: In instantiation of ‘class boost::graph::distributed::delta_stepping_impl<boost::adjacency_list<boost::vecS, boost::distributedS<boost::graph::distributed::mpi_process_group, boost::vecS>, boost::undirectedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_weight_t, float> >, boost::dummy_property_map, boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::global_descriptor_property_map<long unsigned int>, boost::vec_adj_list_vertex_property_map<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>, boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>*, float, float&, boost::vertex_distance_t> >, boost::vertex_distance_t, boost::no_property>, boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::edge_global_property_map<boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, float, float&, long unsigned int, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::edge_weight_t> >, boost::edge_weight_t, boost::no_property> >’:
/home/pratsriv/boost_1_64_0/include/boost/graph/distributed/delta_stepping_shortest_paths.hpp:504:5: required from ‘void boost::graph::distributed::delta_stepping_shortest_paths(const Graph&, typename boost::graph_traits<Graph>::vertex_descriptor, PredecessorMap, DistanceMap, EdgeWeightMap) [with Graph = boost::adjacency_list<boost::vecS, boost::distributedS<boost::graph::distributed::mpi_process_group, boost::vecS>, boost::undirectedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_weight_t, float> >; PredecessorMap = boost::dummy_property_map; DistanceMap = boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::global_descriptor_property_map<long unsigned int>, boost::vec_adj_list_vertex_property_map<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>, boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>*, float, float&, boost::vertex_distance_t> >, boost::vertex_distance_t, boost::no_property>; EdgeWeightMap = boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::edge_global_property_map<boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, float, float&, long unsigned int, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::edge_weight_t> >, boost::edge_weight_t, boost::no_property>; typename boost::graph_traits<Graph>::vertex_descriptor = boost::detail::parallel::global_descriptor<long unsigned int>]’
parallelDeltastepping.cpp:80:37: required from here
/home/pratsriv/boost_1_64_0/include/boost/graph/distributed/delta_stepping_shortest_paths.hpp:74:63: error: no type named ‘value_type’ in ‘struct boost::property_traits<boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::edge_global_property_map<boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, float, float&, long unsigned int, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::edge_weight_t> >, boost::edge_weight_t, boost::no_property> >’
ypedef typename property_traits<EdgeWeightMap>::value_type Dist;
^
/home/pratsriv/boost_1_64_0/include/boost/graph/distributed/delta_stepping_shortest_paths.hpp:123:8: error: no type named ‘value_type’ in ‘struct boost::property_traits<boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::edge_global_property_map<boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, float, float&, long unsigned int, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::edge_weight_t> >, boost::edge_weight_t, boost::no_property> >’
void handle_relax_message(Vertex v, const std::pair<Dist, Vert
^
In file included from /home/pratsriv/boost_1_64_0/include/boost/graph/distributed/crauser_et_al_shortest_paths.hpp:34:0,
from /home/pratsriv/boost_1_64_0/include/boost/graph/distributed/dijkstra_shortest_paths.hpp:20,
from /home/pratsriv/boost_1_64_0/include/boost/graph/dijkstra_shortest_paths.hpp:620,
from parallelDeltastepping.cpp:17:
/home/pratsriv/boost_1_64_0/include/boost/graph/distributed/detail/dijkstra_shortest_paths.hpp: In instantiation of ‘class boost::graph::distributed::detail::dijkstra_msg_value<boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::global_descriptor_property_map<long unsigned int>, boost::vec_adj_list_vertex_property_map<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>, boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>*, float, float&, boost::vertex_distance_t> >, boost::vertex_distance_t, boost::no_property>, boost::dummy_property_map>’:
/home/pratsriv/boost_1_64_0/include/boost/graph/distributed/delta_stepping_shortest_paths.hpp:129:8: required from ‘class boost::graph::distributed::delta_stepping_impl<boost::adjacency_list<boost::vecS, boost::distributedS<boost::graph::distributed::mpi_process_group, boost::vecS>, boost::undirectedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_weight_t, float> >, boost::dummy_property_map, boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::global_descriptor_property_map<long unsigned int>, boost::vec_adj_list_vertex_property_map<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>, boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>*, float, float&, boost::vertex_distance_t> >, boost::vertex_distance_t, boost::no_property>, boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::edge_global_property_map<boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, float, float&, long unsigned int, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::edge_weight_t> >, boost::edge_weight_t, boost::no_property> >’
/home/pratsriv/boost_1_64_0/include/boost/graph/distributed/delta_stepping_shortest_paths.hpp:504:5: required from ‘void boost::graph::distributed::delta_stepping_shortest_paths(const Graph&, typename boost::graph_traits<Graph>::vertex_descriptor, PredecessorMap, DistanceMap, EdgeWeightMap) [with Graph = boost::adjacency_list<boost::vecS, boost::distributedS<boost::graph::distributed::mpi_process_group, boost::vecS>, boost::undirectedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_weight_t, float> >; PredecessorMap = boost::dummy_property_map; DistanceMap = boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::global_descriptor_property_map<long unsigned int>, boost::vec_adj_list_vertex_property_map<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>, boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>*, float, float&, boost::vertex_distance_t> >, boost::vertex_distance_t, boost::no_property>; EdgeWeightMap = boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::edge_global_property_map<boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, float, float&, long unsigned int, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::edge_weight_t> >, boost::edge_weight_t, boost::no_property>; typename boost::graph_traits<Graph>::vertex_descriptor = boost::detail::parallel::global_descriptor<long unsigned int>]’
parallelDeltastepping.cpp:80:37: required from here
/home/pratsriv/boost_1_64_0/include/boost/graph/distributed/detail/dijkstra_shortest_paths.hpp:40:59: error: no type named ‘key_type’ in ‘struct boost::property_traits<boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::global_descriptor_property_map<long unsigned int>, boost::vec_adj_list_vertex_property_map<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>, boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>*, float, float&, boost::vertex_distance_t> >, boost::vertex_distance_t, boost::no_property> >’
edef typename property_traits<DistanceMap>::key_type vertex_desc
^
/home/pratsriv/boost_1_64_0/include/boost/graph/distributed/detail/dijkstra_shortest_paths.hpp:42:61: error: no type named ‘value_type’ in ‘struct boost::property_traits<boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::global_descriptor_property_map<long unsigned int>, boost::vec_adj_list_vertex_property_map<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>, boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>*, float, float&, boost::vertex_distance_t> >, boost::vertex_distance_t, boost::no_property> >’
typedef typename property_traits<DistanceMap>::value_type type;
^
In file included from /home/pratsriv/boost_1_64_0/include/boost/graph/distributed/breadth_first_search.hpp:23:0,
from /home/pratsriv/boost_1_64_0/include/boost/graph/breadth_first_search.hpp:409,
from /home/pratsriv/boost_1_64_0/include/boost/graph/dijkstra_shortest_paths.hpp:21,
from parallelDeltastepping.cpp:17:
/home/pratsriv/boost_1_64_0/include/boost/graph/parallel/properties.hpp: In instantiation of ‘void boost::set_property_map_role(Property, PropertyMap) [with Property = boost::vertex_distance_t; PropertyMap = boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::global_descriptor_property_map<long unsigned int>, boost::vec_adj_list_vertex_property_map<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>, boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>*, float, float&, boost::vertex_distance_t> >, boost::vertex_distance_t, boost::no_property>]’:
/home/pratsriv/boost_1_64_0/include/boost/graph/distributed/delta_stepping_shortest_paths.hpp:499:24: required from ‘void boost::graph::distributed::delta_stepping_shortest_paths(const Graph&, typename boost::graph_traits<Graph>::vertex_descriptor, PredecessorMap, DistanceMap, EdgeWeightMap) [with Graph = boost::adjacency_list<boost::vecS, boost::distributedS<boost::graph::distributed::mpi_process_group, boost::vecS>, boost::undirectedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_weight_t, float> >; PredecessorMap = boost::dummy_property_map; DistanceMap = boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::global_descriptor_property_map<long unsigned int>, boost::vec_adj_list_vertex_property_map<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>, boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>*, float, float&, boost::vertex_distance_t> >, boost::vertex_distance_t, boost::no_property>; EdgeWeightMap = boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::edge_global_property_map<boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, float, float&, long unsigned int, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::edge_weight_t> >, boost::edge_weight_t, boost::no_property>; typename boost::graph_traits<Graph>::vertex_descriptor = boost::detail::parallel::global_descriptor<long unsigned int>]’
parallelDeltastepping.cpp:80:37: required from here
/home/pratsriv/boost_1_64_0/include/boost/graph/parallel/properties.hpp:105:63: error: no type named ‘value_type’ in ‘struct boost::property_traits<boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::global_descriptor_property_map<long unsigned int>, boost::vec_adj_list_vertex_property_map<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>, boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>*, float, float&, boost::vertex_distance_t> >, boost::vertex_distance_t, boost::no_property> >’
ef typename property_traits<PropertyMap>::value_type value_type;
^
/home/pratsriv/boost_1_64_0/include/boost/graph/parallel/properties.hpp:109:5: error: ‘struct boost::bgl_named_params<boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group, boost::detail::parallel::global_descriptor_property_map<long unsigned int>, boost::vec_adj_list_vertex_property_map<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>, boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_distance_t, float>, boost::property<boost::edge_locally_owned_t, bool, boost::property<boost::edge_target_processor_id_t, short int, boost::property<boost::edge_weight_t, float> > >, boost::no_property, boost::listS>*, float, float&, boost::vertex_distance_t> >, boost::vertex_distance_t, boost::no_property>’ has no member named ‘set_reduce’
pm.set_reduce(reduce());
謝謝! 你能不能也建議我應該如何處理並行boost圖庫,以便我更好地理解它。 – Prateek