Boost logo

Boost Users :

Subject: Re: [Boost-users] [graph] Example parallel BGL
From: Marcin Zalewski (marcin.zalewski_at_[hidden])
Date: 2015-08-03 06:18:32


On Thu, Jul 30, 2015 at 9:51 AM Sensei <senseiwa_at_[hidden]> wrote:

>
> Dear all,
>
> I'd like to play with Parallel BGL (with MPI), and I'd like to see some
> example code. I've followed the Overview and the Adjacency List example,
> but I cannot compile my code.
>

You can find some examples here:

https://github.com/boostorg/graph_parallel/tree/master/example

You can also look at tests:

https://github.com/boostorg/graph_parallel/tree/master/test

> Right now, I'd like to create a graph, and then fill in with some nodes.
> Then, access the nodes belonging to a single process, but I wish I had
> an error there
>
> My error concerns the definition of the graph: No template named
> 'bsp_process_group' in namespace 'boost::parallel'; did you mean
> 'boost::process_group'? The code follows.
>
> What am I doing wrong here? I may have forgotten some header... Is there
> any distributed (complete) example code that I might read?
>
> Thanks & Cheers!
>
>
>
> #include <iostream>
> #include <string>
> #include <vector>
>
> #include <boost/mpi.hpp>
> #include <boost/graph/use_mpi.hpp>
> #include <boost/graph/distributed/mpi_process_group.hpp>
> #include <boost/graph/distributed/adjacency_list.hpp>
>
> int main(int argc, const char * argv[])
> {
> boost::mpi::environment env;
> boost::mpi::communicator comm;
>
> typedef boost::adjacency_list<boost::vecS,
>
> boost::distributedS<boost::parallel::bsp_process_group, boost::vecS>,
> boost::directedS> graph;
> typedef boost::erdos_renyi_iterator<boost::minstd_rand, graph>
> generator;
>
> if (comm.rank() == 0)
> {
> boost::add_edge(1, 2);
> boost::add_edge(2, 2);
> boost::add_edge(2, 3);
> boost::add_edge(3, 4);
> boost::add_edge(4, 5);
> boost::add_edge(5, 1);
>
> // access ***only rank 0 nodes***
> }
> return 0;
> }
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net