Re: [Boost-users] How to create distributed_property_map (??????? ?????)

So, now i have: struct centrality_t { typedef vertex_property_tag kind; }; typedef property<centrality_t, double> VertexCentrality; typedef boost::adjacency_list<listS, distributedS<mpi_process_group,vecS>, undirectedS, VertexCentrality> Graph; typedef boost::unique_rmat_iterator<boost::minstd_rand, Graph> RMATGen; struct no_self_loops { no_self_loops() {} bool operator()(const std::pair<int,int>& e) { return e.first != e.second; } }; template <typename G> struct VertexKey { typedef int value_type; typedef typename graph_traits<G>::vertex_descriptor key_type; typedef read_write_property_map_tag category; typedef int* reference; }; int main(int argc, char* argv[]) { boost::mpi::environment env(argc, argv); boost::minstd_rand gen; unsigned int SCALE = atoi(argv[1]); unsigned int EDGE_FACTOR = atoi(argv[2]); unsigned int N = pow(2, SCALE); unsigned int E = EDGE_FACTOR * N; Graph g( boost::make_filter_iterator<no_self_loops> ( RMATGen(gen, N, E, 0.45, 0.15, 0.15, 0.25), RMATGen()), boost::make_filter_iterator<no_self_loops>(RMATGen(), RMATGen()), N); typedef boost::property_map<Graph, centrality_t>::type LocalMap; typedef boost::parallel::distributed_property_map<mpi_process_group, LocalMap, VertexKey<Graph> > CentralityMap; LocalMap local_map = get(centrality_t(), g); mpi_process_group process_groupe; //VertexKey<Graph> vertex_key; CentralityMap centrality_map(process_groupe, local_map); //brandes_betweenness_centrality(g, centrality_map); } network.cpp: In function ‘int main(int, char**)’: network.cpp:78: error: no matching function for call to ... /opt/boost_1_54_0_icc/boost/property_map/parallel/ distributed_property_map.hpp:329: note: candidates are: boost::parallel::distributed_property_map<ProcessGroup, GlobalMap, StorageMap>::distributed_property_map(const ProcessGroup&, const GlobalMap&, const StorageMap&) Is this right arguments centrality_map(process_groupe, local_map) ? Or it must be: VertexKey<Graph> vertex_key; CentralityMap centrality_map = boost::parallel::make_distributed_property_map(process_groupe, local_map, vertex_key); In this case: network.cpp:78: instantiated from here /opt/boost_1_54_0_icc/boost/property_map/parallel/impl/distributed_property_map.ipp:140: error: request for member ‘first’ in ‘p’, which is of non-class type ‘double’ /opt/boost_1_54_0_icc/boost/property_map/parallel/impl/distributed_property_map.ipp:142: error: request for member ‘second’ in ‘p’, which is of non-class type ‘double’ /opt/boost_1_54_0_icc/boost/property_map/parallel/impl/distributed_property_map.ipp:142: error: request for member ‘second’ in ‘p’, which is of non-class type ‘double’ Any suggestions? Thanks.

Forget it. I done: struct centrality_t { typedef vertex_property_tag kind; }; typedef property<centrality_t, double> VertexCentrality; typedef boost::adjacency_list<listS, distributedS<mpi_process_group,vecS>, undirectedS, VertexCentrality> Graph; typedef boost::unique_rmat_iterator<boost::minstd_rand, Graph> RMATGen; struct no_self_loops { no_self_loops() {} bool operator()(const std::pair<int,int>& e) { return e.first != e.second; } }; int main(int argc, char* argv[]) { boost::mpi::environment env(argc, argv); boost::minstd_rand gen; unsigned int SCALE = atoi(argv[1]); unsigned int EDGE_FACTOR = atoi(argv[2]); unsigned int N = pow(2, SCALE); unsigned int E = EDGE_FACTOR * N; Graph g( boost::make_filter_iterator<no_self_loops> ( RMATGen(gen, N, E, 0.45, 0.15, 0.15, 0.25), RMATGen()), boost::make_filter_iterator<no_self_loops>(RMATGen(), RMATGen ()), N); boost::property_map<Graph, centrality_t>::type centrality_map = get (centrality_t(), g); boost::property_map<Graph, vertex_index_t>::type index_map = get (vertex_index_t(), g); boost::brandes_betweenness_centrality(g, centrality_map); typedef graph_traits<Graph>::vertex_iterator vertex_iter; std::pair<vertex_iter, vertex_iter> vp; for (vp = vertices(g); vp.first != vp.second; ++vp.first) std::cout << index_map[*vp.first] << ": " << centrality_map [*vp.first] << "\n"; } But output looks like mistake. mpiexec -np 1 ./network2 4 3 0: 5 1: 4 2: 1 3: 0 4: 2 5: 8 6: 1 7: 0 8: 3 9: 3 10: 1 11: 0 12: 5.5 13: 3 14: 1 15: 0
participants (2)
-
Nikolay Kinash
-
Николай Кинаш