I am student of Computer Science in Universidad de Oriente from Cuba,
and I have a problem with the parallel graph, when I am adding edge
betwen two procesors and one of them change any property of my edge,
the other processor not update the property .
for example my code is :
#include "mpi.h"
#include
#include
#include
#include
#include
#include
#include <list>
using namespace std;
//===============================Vertex================================
struct Vertex{
int id;
// Serialization support is required!
template<typename Archiver>
void serialize(Archiver& ar, const unsigned int ) {
ar & id ;
}
Vertex(int id = 0): id(id){}
};
//===============================Edge================================
struct Edge{
int type;
Edge( int type = 0): type(type){ }
// Serialization support is required!
template<typename Archiver>
void serialize(Archiver& ar,const unsigned int ) {
ar & type;
}
};
using namespace boost;
using boost::graph::distributed::mpi_process_group;
typedef adjacency_list < listS, distributedS, undirectedS, Vertex, Edge > Graph;
typedef typename Graph::edge_descriptor edge_descriptor;
typedef typename Graph::vertex_descriptor vertex_descriptor;
int main (int argc, char ** argv){
boost::mpi::environment env(argc,argv);
mpi::communicator world;
Graph g;
vertex_descriptor vi,vj;
property_map::type type1 = get(&Edge::type, g);
if (g.processor()==0)
vi = add_vertex(Vertex(1),g);
if (g.processor()==1)
vj = add_vertex(Vertex(2),g);
broadcast(world, vj, 1);
broadcast(world, vi, 0);
if (g.processor()==0){
pair p = add_edge(vi, vj, Edge(1), g);
std::cout<<"Process "< p = edge(vi, vj, g);
if(p.second){
std::cout<<"\nProcess "< p = edge(vi, vj, g);
std::cout<<"\nProcess "<