/* * test_phase_1.cpp * * Created on: May 25, 2021 * Author: mad */ #include #include #include using namespace phase1; int main(int argc, char** argv) { const int num_threads = argc > 1 ? atoi(argv[1]) : 4; const int log_num_buckets = argc > 2 ? atoi(argv[2]) : 7; uint8_t id[32] = {}; for(size_t i = 0; i < sizeof(id); ++i) { id[i] = i + 1; } const auto total_begin = get_wall_time_micros(); initialize(); DiskSort1 sort_1(32 + kExtraBits, log_num_buckets, "test.p1.t1"); compute_f1(id, num_threads, &sort_1); DiskTable tmp_1("test.p1.table1.tmp"); DiskSort2 sort_2(32 + kExtraBits, log_num_buckets, "test.p1.t2"); compute_table( 2, num_threads, &sort_1, &sort_2, &tmp_1); DiskTable tmp_2("test.p1.table2.tmp"); DiskSort3 sort_3(32 + kExtraBits, log_num_buckets, "test.p1.t3"); compute_table( 3, num_threads, &sort_2, &sort_3, &tmp_2); DiskTable tmp_3("test.p1.table3.tmp"); DiskSort4 sort_4(32 + kExtraBits, log_num_buckets, "test.p1.t4"); compute_table( 4, num_threads, &sort_3, &sort_4, &tmp_3); DiskTable tmp_4("test.p1.table4.tmp"); DiskSort5 sort_5(32 + kExtraBits, log_num_buckets, "test.p1.t5"); compute_table( 5, num_threads, &sort_4, &sort_5, &tmp_4); DiskTable tmp_5("test.p1.table5.tmp"); DiskSort6 sort_6(32 + kExtraBits, log_num_buckets, "test.p1.t6"); compute_table( 6, num_threads, &sort_5, &sort_6, &tmp_5); DiskTable tmp_6("test.p1.table6.tmp"); DiskTable tmp_7("test.p1.table7.tmp"); compute_table( 7, num_threads, &sort_6, nullptr, &tmp_6, &tmp_7); std::cout << "Phase 1 took " << (get_wall_time_micros() - total_begin) / 1e6 << " sec" << std::endl; return 0; }