Exemplo n.º 1
0
int main(int argc, char** argv) {
  Galois::StatManager statManager;
  LonestarStart(argc, argv, name, desc, url);

  Galois::StatTimer Tinitial("InitializeTime");
  Tinitial.start();
  graph.structureFromFile(inputFilename.c_str());
  std::cout << "Num nodes: " << graph.size() << "\n";
  Tinitial.stop();

  //Galois::preAlloc(numThreads);
  Galois::Statistic("MeminfoPre", GaloisRuntime::MM::pageAllocInfo());
  switch (algo) {
    case demo: run<DemoAlgo>(); break;
    case asynchronous: run<AsynchronousAlgo>(); break;
    default: std::cerr << "Unknown algo: " << algo << "\n";
  }
  Galois::Statistic("MeminfoPost", GaloisRuntime::MM::pageAllocInfo());

  if (!skipVerify && !verify()) {
    std::cerr << "verification failed\n";
    assert(0 && "verification failed");
    abort();
  }

  return 0;
}
Exemplo n.º 2
0
int main(int argc, char** argv) {

  

  Galois::StatManager statManager;
  LonestarStart(argc, argv, name, desc, url);

  Galois::StatTimer Tinitial("InitializeTime");
  Tinitial.start();

  SymbolicGraph graph;
  Graph outgraph;

  // Load input graph. Read to an LC_Graph and then convert to a
  // FirstGraph. (based on makeGraph from Boruvka.)
  
  double** matrix2;
  double* rhs;
  int matrix_size2 = 15000; 
  double l_boundary_condition = -100; 
  double r_boundary_condition = 100; 
  
  get_matrix_and_rhs(matrix_size2, &matrix2, &rhs, l_boundary_condition, r_boundary_condition);
  /*
  for(int i = 0; i<matrix_size2; i++){
	for(int j = 0; j<matrix_size2; j++){
		
		printf("%lf ", matrix2[i][j]);
	} 
	
	printf(" | %lf\n", rhs[i]); 
  }
  */
  
  
  clock_t t_start = clock();
  makeGraph(graph,matrix2,matrix_size2); 
  //makeGraph(graph, inputFilename.c_str());
  nodecount = graph.size();
  std::cout << "Num nodes: " << nodecount << "\n";

  // Verify IDs assigned to each node
  {
    unsigned int i = 0;
    for (SymbolicGraph::iterator ii = graph.begin(), ei = graph.end();
         ii != ei; ++ii) {
      Node& data = graph.getData(*ii);
      assert(data.id == i++);
      assert(!data.seen);
    }
    assert(i == nodecount);
  }

  // Initialize dependency ordering
  depgraph = new DepItem[nodecount];
  assert(depgraph);

  Tinitial.stop();

  //Galois::preAlloc(numThreads);
  Galois::reportPageAlloc("MeminfoPre");

  // First run the symbolic factorization
  std::cout << "Symbolic factorization\n";
  run(SymbolicAlgo<SymbolicGraph,Graph>(graph, outgraph), "SymbolicTime");

  // Clear the seen flags for the numeric factorization.
  for (SymbolicGraph::iterator ii = graph.begin(), ei = graph.end();
       ii != ei; ++ii) {
    Node& data = graph.getData(*ii);
    assert(data.seen);
    data.seen = false;
  }

  // We should now have built a directed graph (outgraph) and total
  // ordering. Now run the numeric factorization.
  //
  // FIXME: Convert back to a LC_Graph?
  std::cout << "Numeric factorization\n";
  run(NumericAlgo<Graph>(outgraph), "NumericTime");

  Galois::reportPageAlloc("MeminfoPost");

  if (!skipVerify && !verify(outgraph)) {
    std::cerr << "verification failed\n";
    assert(0 && "verification failed");
    abort();
  }
  
  get_solution_from_graph(outgraph, rhs);
  
  printf("\nTime taken: %.4fs\n", (float)(clock() - t_start)/CLOCKS_PER_SEC);
  return 0;
}
Exemplo n.º 3
0
int main(int argc, char** argv) {
  Galois::StatManager statManager;
  LonestarStart(argc, argv, name, desc, url);

  Galois::StatTimer Tinitial("InitializeTime");
  Tinitial.start();

  // Load filled graph with edge data
  Galois::Graph::readGraph(graph, inputFilename.c_str());
  std::cout << "Num nodes: " << graph.size() << "\n";

  // Assign IDs to each node
  {
    unsigned int n = graph.size(), i = 0;
    for (Graph::iterator ii = graph.begin(), ei = graph.end(); ii != ei; ++ii) {
      Node& data = graph.getData(*ii);
      data.id = i++;
      assert(!data.seen);
    }
    assert(i == n);

    // Load dependence ordering
    depgraph = new DepItem[n];
    assert(depgraph);
    std::ifstream depfile(depFilename.c_str());
    i = 0;
    while (depfile) {
      unsigned int node;
      depfile >> node;
      if ( !depfile ) break;
      assert(node < n);
      if ( i < 0 || i >= n ) {
        std::cout << "Error loading dependencies.\n";
        abort();
      }
      depgraph[i] = node;
      i++;
    }
    assert(i == n);
    depfile.close();
  }

  Tinitial.stop();

  //Galois::preAlloc(numThreads);
  Galois::reportPageAlloc("MeminfoPre");

  switch (algo) {
    case demo: run<DemoAlgo>(); break;
    //case asynchronous: run<AsynchronousAlgo>(); break;
    default: std::cerr << "Unknown algo: " << algo << "\n";
  }
  Galois::reportPageAlloc("MeminfoPost");

  if (!skipVerify && !verify()) {
    std::cerr << "verification failed\n";
    assert(0 && "verification failed");
    abort();
  }

  return 0;
}