Ejemplo n.º 1
0
void run() {
  typedef typename Algo::Graph Graph;

  Algo algo;
  Graph graph;

  algo.readGraph(graph, filename, transposeGraphName);

  Galois::preAlloc(numThreads + (2*graph.size() * sizeof(typename Graph::node_data_type)) / Galois::Runtime::MM::hugePageSize);
  Galois::reportPageAlloc("MeminfoPre");

  Galois::StatTimer T;
  auto eamp = -amp;///tolerance;
  std::cout << "Running " << algo.name() << " version\n";
  std::cout << "tolerance: " << tolerance << "\n";
  std::cout << "effective amp: " << eamp << "\n";
  T.start();
  Galois::do_all_local(graph, [&graph] (typename Graph::GraphNode n) { graph.getData(n).init(); });
  algo(graph, tolerance, eamp);
  T.stop();
  
  Galois::reportPageAlloc("MeminfoPost");

  if (!skipVerify) {
    algo.verify(graph, tolerance);
    printTop(graph, 10, algo.name().c_str(), numThreads);
  }
}
Ejemplo n.º 2
0
void runPPR() {
  typedef typename Algo::Graph Graph;

  Algo algo;
  Graph graph;

  algo.readGraph(graph, filename, transposeGraphName);

  std::cout << "Read " << std::distance(graph.begin(), graph.end()) << " Nodes\n";

  Galois::preAlloc(numThreads + (graph.size() * sizeof(typename Graph::node_data_type)) / Galois::Runtime::MM::hugePageSize);
  Galois::reportPageAlloc("MeminfoPre");

  unsigned numSeeds = 2;

  Galois::StatTimer Tt;
  Tt.start();
  auto seeds = findPPRSeeds(graph, numSeeds);
  Tt.stop();
  std::cout << "Find " << numSeeds << " seeds (found " << seeds.size() << ") in " << Tt.get() << "ms\n";

  std::map<typename Graph::GraphNode, std::deque<unsigned> > clusters;

  unsigned counter = 0;
  for (auto seed : seeds) {

    Galois::StatTimer T1, T2, T3;
    std::cout << "Running " << algo.name() << " version\n";
    T1.start();
    Galois::do_all_local(graph, [&graph] (typename Graph::GraphNode n) { graph.getData(n).init(); });
    T1.stop();
    T2.start();
    algo(graph, seed);
    T2.stop();
    T3.start();
    auto c = algo.cluster_from_sweep(graph);
    T3.stop();
    std::cout << T1.get() << " " << T2.get() << " " << T3.get() << "\n";

    std::cout << seed << " : " << c.size() << "\n";
    // for (auto n : c)
    //   std::cout << n << " ";
    // std::cout << "\n";

    for (auto n : c)
      clusters[n].push_back(counter);
    ++counter;

    Galois::reportPageAlloc("MeminfoPost");
  }

  for (auto np : clusters) {
    std::cout << np.first << ": ";
    for (auto n : np.second)
      std::cout << n << " ";
    std::cout << "\n";
  }
}
void initialize(Algo& algo,
    typename Algo::Graph& graph,
    typename Algo::Graph::GraphNode& source) {

  algo.readGraph(graph);
  std::cout << "Read " << graph.size() << " nodes\n";

  if (startNode >= graph.size()) {
    std::cerr << "failed to set source: " << startNode << "\n";
    assert(0);
    abort();
  }
  
  typename Algo::Graph::iterator it = graph.begin();
  std::advance(it, startNode);
  source = *it;
}