void SegmentedSourceROMWriter::init_streams() { SourceROMWriter::init_streams(); write_copyright(&_main_stream, true); write_segment_header(); for (int s = 0; s < ROM::SEGMENTS_STREAMS_COUNT; s++) { _main_segment_streams[s].open(rom_tmp_segment_file(s)); write_copyright(&_main_segment_streams[s], true); } _stuff_stream = &_main_segment_streams[ROM::STUFF_STREAM_INDEX]; }
int main(int argc, char ** argv) { if (argc != 4) fail ("too few arguments to makeucn"); read_ucnid (argv[1]); read_table (argv[2]); read_derived (argv[3]); write_copyright (); write_table (); return 0; }
int main(int argc, const char ** argv) { // print_copyright(); write_copyright(); //* GraphChi initialization will read the command line arguments and the configuration file. */ graphchi_init(argc, argv); /* Metrics object for keeping track of performance counters and other information. Currently required. */ metrics m("sgd-inmemory-factors"); /* Basic arguments for application. NOTE: File will be automatically 'sharded'. */ sgd_lambda = get_option_float("sgd_lambda", 1e-3); sgd_gamma = get_option_float("sgd_gamma", 1e-3); sgd_step_dec = get_option_float("sgd_step_dec", 0.9); int file_format = get_option_int("ff", 3); parse_command_line_args(); parse_implicit_command_line(); /* Preprocess data if needed, or discover preprocess files */ int nshards = convert_matrixmarket<EdgeDataType>(training, 0, 0, file_format, TRAINING, false); init_feature_vectors<std::vector<vertex_data> >(M+N, latent_factors_inmem, !load_factors_from_file); if (validation != ""){ int vshards = convert_matrixmarket<EdgeDataType>(validation, 0, 0, 3, VALIDATION, false); init_validation_rmse_engine<VertexDataType, EdgeDataType>(pvalidation_engine, vshards, &sgd_predict); } /* load initial state from disk (optional) */ if (load_factors_from_file){ load_matrix_market_matrix(training + "_U.mm", 0, D); load_matrix_market_matrix(training + "_V.mm", M, D); } print_config(); /* Run */ SGDVerticesInMemProgram program; graphchi_engine<VertexDataType, EdgeDataType> engine(training, nshards, false, m); set_engine_flags(engine); pengine = &engine; timer train_timer; engine.run(program, niters); // std::cout << "Trn Time for file test: " << std::setw(10) << train_timer.current_time() / niters << std::endl; std::ofstream ofs(result.c_str(), std::ofstream::out | std::ofstream::app); ofs << D << " " << train_timer.current_time() << " "; /* Run TopN program */ n_top = get_option_int("n_int", 10); /*timer test_timer1; ofs << test_timer1.current_time() << " ";*/ //run_general_topn_program(pengine, &latent_factors_inmem, &sgd_predict); timer index_timer; kd_Node* mroot = init_kdtree(&latent_factors_inmem); ofs << index_timer.current_time() << " "; timer test_timer; /* construct kd tree index */ // ofs << "constructing index: " << test_timer.current_time() << " "; run_kd_topn_program(pengine, &latent_factors_inmem, mroot); // std::coua << "Tst Time: " << std::setw(10) << test_timer.current_time() << std::endl; ofs << test_timer.current_time() << std::endl; ofs.close(); /* Output latent factor matrices in matrix-market format */ output_sgd_result(training); test_predictions(&sgd_predict); /* Report execution metrics */ if (!quiet) metrics_report(m); return 0; }