Question about vertex_set and warp::parfor_all_vertices

33 views
Skip to first unread message

jacobk...@gmail.com

unread,
Oct 22, 2013, 1:13:16 PM10/22/13
to graph...@googlegroups.com
Hi everybody,

I'm trying to get parfor_all_vertices to run only on specified subsets of the vertices of a graph.  As I read the docs, it looks like I can do that by specifying a vertex_set, but I think I must not be doing something correctly because my code always runs on all vertices, even if the vertex_set is graph.empty_set().

Here's some sample code.  I create a vertex_set that contains only the vertex w/ id==0, and then run the parfor.  

#include <graphlab/engine/warp_engine.hpp> 
#include <graphlab/engine/warp_parfor_all_vertices.hpp> 


typedef graphlab::empty edge_data_type;
typedef graphlab::empty vertex_data_type;

typedef graphlab::distributed_graph<vertex_data_type,
                                    edge_data_type> graph_type;

bool find_zero(const graph_type::vertex_type& v){
  return (v.id()==0);
}

void compute(graph_type::vertex_type& v){
  // we should only have one node here.
  std::cout<<"working node with id "<<v.id()<<std::endl;

}
int main(int argc, char** argv) {
  

  graphlab::distributed_control dc;
  graphlab::command_line_options clopts("Louvain modularity maximization");

  std::string prefix;
  std::string format="tsv";
  clopts.attach_option("graph", prefix,
                       "Graph input. reads all graphs matching prefix*");
  clopts.attach_option("format", format,
                       "The graph format");
   if(!clopts.parse(argc, argv)) return EXIT_FAILURE;
   graph_type graph(dc, clopts);
   graph.load_format(prefix, format);
   graph.finalize();

   graphlab::warp::warp_engine<graph_type> no_engine(dc,graph,clopts);
   
   graphlab::vertex_set ZERO = graph.select(find_zero);
   std::cout<<"Size of active set: "<<graph.vertex_set_size(ZERO)<<std::endl;
   graphlab::warp::parfor_all_vertices(graph,compute,ZERO);
}


And an input file:
0 1
0 2
0 3
1 2
1 3
2 3
1 0
2 0
3 0
2 1
3 1
3 2

And this is the result:
./warpset  --graph K4 --format tsv
INFO:     dc.cpp(init:573): Cluster of 1 instances created.
INFO:     distributed_graph.hpp(set_ingress_method:3200): Automatically determine ingress method: grid
INFO:     distributed_graph.hpp(load_from_posixfs:2189): Loading graph from file: ./K4
INFO:     distributed_ingress_base.hpp(finalize:185): Finalizing Graph...
WARNING:  memory_info.cpp(log_usage:96): Unable to print memory info for: Post Flush. No memory extensions api available.
INFO:     distributed_ingress_base.hpp(exchange_global_info:532): Graph info: 
nverts: 4
nedges: 12
nreplicas: 4
replication factor: 1
INFO:     distributed_ingress_base.hpp(finalize:185): Finalizing Graph...
Size of active set: 1
working node with id 0
working node with id 1
working node with id 2
working node with id 3

So it appears that the vertex_set is being properly created (or at least its cardinality is!) but the parfor still runs the compute() over all nodes.   Replacing ZERO with graph.empty_set() does the same thing. 

  
Thanks!

Yucheng Low

unread,
Oct 22, 2013, 4:09:54 PM10/22/13
to graph...@googlegroups.com
Hi,

Sorry. That is a bug. I just pushed a fix. 

Yucheng

--
You received this message because you are subscribed to the Google Groups "GraphLab API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to graphlabapi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

jacobk...@gmail.com

unread,
Oct 22, 2013, 7:13:18 PM10/22/13
to graph...@googlegroups.com
Hi Yucheng,

I did a pull and a complete rebuild with ./configure --cleanup and I'm getting the same behavior with commit   852223cf259be5bee55ed092909cd3ff2459d9b5

Yucheng Low

unread,
Oct 22, 2013, 7:26:21 PM10/22/13
to graph...@googlegroups.com
Oh damn. I forgot to merge the pull request. I just did.

Yucheng

jacobk...@gmail.com

unread,
Oct 22, 2013, 7:57:24 PM10/22/13
to graph...@googlegroups.com
It works! Thanks! 
Reply all
Reply to author
Forward
0 new messages