Esempio n. 1
0
    /**
     * Called before an execution interval is started.
     *
     * On every even iteration, we load pivot's item connected user lists to memory.
     * Here we manage the memory to ensure that we do not load too much
     * edges into memory.
     */
    void before_exec_interval(vid_t window_st, vid_t window_en, graphchi_context &gcontext) {

        /* on even iterations, loads pivot items into memory base on the membudget_mb allowed memory size */
        if ((gcontext.iteration % 2 == 0)) {
            //if (debug){
            printf("entering iteration: %d on before_exec_interval\n", gcontext.iteration);
            printf("pivot_st is %d window_St %d, window_en %d\n", adjcontainer->pivot_st, window_st, window_en);
            //}
            if (adjcontainer->pivot_st < std::min(std::min((int)M,end_user), (int)window_en)) {
                size_t max_grab_edges = get_option_long("membudget_mb", 1024) * 1024 * 1024 / 8;
                if (grabbed_edges < max_grab_edges * 0.8) {
                    Rcpp::Rcerr << "Window init, grabbed: " << grabbed_edges << " edges" << " extending pivor_range to : " << window_en + 1 << std::endl;
                    adjcontainer->extend_pivotrange(std::min(std::min((int)M, end_user), (int)window_en + 1));
                    Rcpp::Rcerr << "Window en is: " << window_en << " vertices: " << gcontext.nvertices << std::endl;
                    if (window_en+1 >= gcontext.nvertices) {
                        // every user was a pivot item, so we are done
                        Rcpp::Rcerr<<"Setting last iteration to: " << gcontext.iteration + 2 << std::endl;
                        gcontext.set_last_iteration(gcontext.iteration + 2);
                    }
                } else {
                    Rcpp::Rcerr << "Too many edges, already grabbed: " << grabbed_edges << std::endl;
                }
            }
        }

    }
Esempio n. 2
0
  /**
   * Called before an execution interval is started.
   *
   * On every even iteration, we load pivot's item connected user lists to memory. 
   * Here we manage the memory to ensure that we do not load too much
   * edges into memory.
   */
  void before_exec_interval(vid_t window_st, vid_t window_en, graphchi_context &gcontext) {        

    /* on even iterations, loads pivot items into memory base on the membudget_mb allowed memory size */
    if (gcontext.iteration % 2 == 0) {
      if (!quiet){
        printf("entering iteration: %d on before_exec_interval\n", gcontext.iteration);
        printf("pivot_st is %d window_en %d\n", adjcontainer->pivot_st, window_en);
      }
      if (adjcontainer->pivot_st <= window_en) {
        size_t max_grab_edges = get_option_long("membudget_mb", 1024) * 1024 * 1024 / 8;
        if (grabbed_edges < max_grab_edges * 0.8) {
          logstream(LOG_DEBUG) << "Window init, grabbed: " << grabbed_edges << " edges" << " extending pivor_range to : " << window_en + 1 << std::endl;
          adjcontainer->extend_pivotrange(window_en + 1);
          logstream(LOG_DEBUG) << "Window en is: " << window_en << " vertices: " << gcontext.nvertices << std::endl;
          if (window_en+1 == gcontext.nvertices) {
            // every item was a pivot item, so we are done
            logstream(LOG_DEBUG)<<"Setting last iteration to: " << gcontext.iteration + 2 << std::endl;
            gcontext.set_last_iteration(gcontext.iteration + 2);                    
          }
        } else {
          logstream(LOG_DEBUG) << "Too many edges, already grabbed: " << grabbed_edges << std::endl;
        }
      }
    }

  }
Esempio n. 3
0
        binary_adjacency_list_reader(std::string filename) : filename(filename) {
            fd = open(filename.c_str(), O_RDONLY);
            if (fd < 0) {
                logstream(LOG_FATAL) << "Could not open file: " << filename << " error: " <<
                strerror(errno) << std::endl;
            }
            assert(fd >= 0);
            
            blocksize = (size_t) get_option_long("preprocessing.bufsize", 64 * 1024 * 1024);
            block = (char*) malloc(blocksize);
            blockptr = block;
            total_to_process = get_filesize(filename);
            blocklen = 0;
            fpos = 0;

            header = read_val<bin_adj_header>();
            assert(header.format_version == FORMAT_VERSION);
        }