Esempio n. 1
0
sweep_scheduler::sweep_scheduler(size_t num_vertices,
                                 const graphlab_options& opts) :
    ncpus(opts.get_ncpus()),
    num_vertices(num_vertices),
    strict_round_robin(true),
    max_iterations(std::numeric_limits<size_t>::max()),
    vertex_is_scheduled(num_vertices) {
  // initialize defaults
  ASSERT_GE(opts.get_ncpus(), 1);
  ordering = "random";
  set_options(opts);

  if (ordering == "ascending") {
    randomizer = 1;
  } else if(ordering == "random") {
    randomizer = 1500450271;
  }

  if(strict_round_robin) {
    logstream(LOG_INFO)
        << "Using a strict round robin schedule." << std::endl;
    // Max iterations only applies to strict round robin
    if(max_iterations != std::numeric_limits<size_t>::max()) {
      logstream(LOG_INFO)
          << "Using maximum iterations: " << max_iterations << std::endl;
    }
    rr_index = 0;
  } else {
    // each cpu is responsible for its own subset of vertices
    // Initialize the cpu2index counters
    cpu2index.resize(ncpus);
    for(size_t i = 0; i < cpu2index.size(); ++i) cpu2index[i] = i;
  }
  vertex_is_scheduled.resize(num_vertices);
} // end of constructor
 graph_gather_apply<Graph,GatherType>::graph_gather_apply(
     graph_type& graph,
     gather_fun_type gather_fun,
     apply_fun_type apply_fun,
     const graphlab_options& opts) :
   gather_fun(gather_fun), apply_fun(apply_fun), rmi(graph.dc(), this), graph(graph),
   threads(opts.get_ncpus()),
   thread_barrier(opts.get_ncpus()),
   gather_exchange(graph.dc(), opts.get_ncpus(), 64 * 1024) { } 
queued_fifo_scheduler::queued_fifo_scheduler(size_t num_vertices,
                                             const graphlab_options& opts) :
    ncpus(opts.get_ncpus()),
    num_vertices(num_vertices),
    multi(3),
    sub_queue_size(100) {
      ASSERT_GE(opts.get_ncpus(), 1);
      set_options(opts);
      initialize_data_structures();
    }
queued_fifo_scheduler::queued_fifo_scheduler(size_t num_vertices,
                                             const graphlab_options& opts) :
    ncpus(opts.get_ncpus()),
    num_vertices(num_vertices),
    multi(3),
    sub_queue_size(100) {
      ASSERT_GE(opts.get_ncpus(), 1);
      set_options(opts);
      initialize_data_structures();

      logstream(LOG_INFO) << "Queued-FIFO Scheduler:"
                          << " queuesize=" << sub_queue_size 
                          << " multi=" << multi 
                          << std::endl;
    }
Esempio n. 5
0
fifo_scheduler::fifo_scheduler(size_t num_vertices,
                               const graphlab_options& opts):
     multi(3), num_vertices(num_vertices) { 
  ASSERT_GE(opts.get_ncpus(), 1);
  set_options(opts);
  initialize_data_structures();
}
priority_scheduler::priority_scheduler(size_t num_vertices,
                                       const graphlab_options& opts):
    multi(3), 
    min_priority(-std::numeric_limits<double>::max()),
    num_vertices(num_vertices) { 
  ASSERT_GE(opts.get_ncpus(), 1);
  set_options(opts);
  initialize_data_structures();
}