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"; } }
int main(int argc, char** argv) { Galois::StatManager statManager; LonestarStart(argc, argv, name, desc, url); graph.structureFromFile(filename); unsigned int id = 0; for (Graph::iterator gb = graph.begin(), ge = graph.end(); gb != ge; ++gb, ++id) { graph.getData(*gb).vertexId = graph.getData(*gb).component = id; } Galois::StatTimer T; T.start(); switch (algo) { case serial: SerialAlgo()(); break; default: GaloisAlgo()(); break; } T.stop(); cout<<"Time Spent "<<T.get()<<" ms "<<endl; return 0; }
int main(int argc, char **argv) { if(argc != 4) { std::cout<<"No enough arugments\n"; exit(0); } double alpha = 0.15; int maxIter = 50; int n_threads; std::string meta_file, data_file; n_threads = atoi(argv[1]); meta_file = argv[2]; data_file = argv[3]; int row, col, size; //reading the meta file std::ifstream fmeta(meta_file.c_str()); fmeta >> row >> col >> size; double *R = new double[col]; for(int i=0; i<col; i++) { R[i] = (double)1/col; } double *Y = new double[col](); double *pM = new double[col](); //create a sparse matrix pr_spMatrix spA(n_threads, data_file); spA.getpM(pM, alpha); spA.initNodes(R, Y); spA.initEdges(pM); spA.initV(alpha, col); //--------timing-------------------- Galois::StatTimer T; T.start(); for(size_t i=0; i<maxIter; i++) { spA.pagerank_multiply(); } T.stop(); int maxTop = 10; spA.getR(R); int* idx = new int[col]; sort_idx(R, idx, col); for(int i=0; i<maxTop; i++) { printf("rank: %d | %d | %0.15f\n", i+1, idx[i], R[idx[i]]); } printf("total running time: %f seconds\n", double(T.get())/1000); delete[] idx; delete[] pM; delete[] Y; delete[] R; }