From 8b9c88722fca3ce07645f634477897a6ffdaec93 Mon Sep 17 00:00:00 2001 From: Yin Ziyao Date: Thu, 23 May 2024 23:29:18 +0800 Subject: [PATCH] Add hybrid test for pcsr. --- log/pcsr/propotion.log | 11 +++ sys/pcsr/CMakeLists.txt | 1 + sys/pcsr/test/pcsr_test.h | 2 + sys/pcsr/test/pcsr_test_propotion.cpp | 105 ++++++++++++++++++++++++++ 4 files changed, 119 insertions(+) create mode 100644 log/pcsr/propotion.log create mode 100644 sys/pcsr/test/pcsr_test_propotion.cpp diff --git a/log/pcsr/propotion.log b/log/pcsr/propotion.log new file mode 100644 index 0000000..29968e0 --- /dev/null +++ b/log/pcsr/propotion.log @@ -0,0 +1,11 @@ +livejournal,16,e,insert-read,500000-500000,1.53587e+06 +livejournal,16,e,insert-read,500000-500000,1.56299e+06 +livejournal,16,e,insert-read,500000-500000,1.52229e+06 + +livejournal,16,e,insert-read,100000-900000,4.55711e+06 +livejournal,16,e,insert-read,100000-900000,4.58366e+06 +livejournal,16,e,insert-read,100000-900000,4.56831e+06 + +livejournal,16,e,insert-read,900000-100000,980870 +livejournal,16,e,insert-read,900000-100000,1.00775e+06 +livejournal,16,e,insert-read,900000-100000,1.00096e+06 diff --git a/sys/pcsr/CMakeLists.txt b/sys/pcsr/CMakeLists.txt index a365bce..be5f4b3 100644 --- a/sys/pcsr/CMakeLists.txt +++ b/sys/pcsr/CMakeLists.txt @@ -11,6 +11,7 @@ include_directories(include/algorithms) add_executable(pcsr_alg test/pcsr_test_alg.cpp) add_executable(pcsr_edge test/pcsr_test_edge.cpp) +add_executable(pcsr_propotion test/pcsr_test_propotion.cpp) add_executable(pcsr_mem test/pcsr_test_memory.cpp) add_executable(pcsr_scala test/pcsr_test_scala.cpp) # -src 9 -maxiters 5 -f ../../../data/slashdot.adj diff --git a/sys/pcsr/test/pcsr_test.h b/sys/pcsr/test/pcsr_test.h index 07fc23b..8c741a0 100644 --- a/sys/pcsr/test/pcsr_test.h +++ b/sys/pcsr/test/pcsr_test.h @@ -29,6 +29,8 @@ PCSR *G; std::vector new_srcs; std::vector new_dests; +std::vector query_srcs; +std::vector query_dests; uint32_t num_nodes; uint64_t num_edges; std::string src, dest; diff --git a/sys/pcsr/test/pcsr_test_propotion.cpp b/sys/pcsr/test/pcsr_test_propotion.cpp new file mode 100644 index 0000000..1e5b890 --- /dev/null +++ b/sys/pcsr/test/pcsr_test_propotion.cpp @@ -0,0 +1,105 @@ +#include "pcsr_test.h" + +void batch_ins_del_read(commandLine& P){ + PRINT("=============== Batch Insert BEGIN ==============="); + + auto gname = P.getOptionValue("-gname", "none"); + auto thd_num = P.getOptionLongValue("-core", 1); + auto log = P.getOptionValue("-log","none"); + std::ofstream log_file(log, ios::app); + + PCSR &Ga = *G; + // std::vector update_sizes = {10, 100, 1000 ,10000,100000,1000000, 10000000}; + std::vector update_sizes = {900000}; + std::vector update_sizes2 = {100000}; + auto r = random_aspen(); + auto update_times = std::vector(); + size_t n_trials = 1; + for (size_t us=0; us(nn, r.ith_rand(100+ts), a, b, c); + for( uint32_t i = 0; i < updates_to_run; i++) { + std::pair edge = rmat(i); + new_srcs.push_back(edge.first); + new_dests.push_back(edge.second); + } + // generate random deges from new_srcs and new_dests + std::default_random_engine generator; + std::uniform_int_distribution distribution(0, new_srcs.size() - 1); + for (size_t i = 0; i < updates_to_run2; i++) { + size_t index = distribution(generator); + query_srcs.push_back(new_srcs[index]); + query_dests.push_back(new_dests[index]); + } + + + gettimeofday(&t_start, &tzp); + + // for (uint32_t i =0 ; i< 500000;i++){ + // Ga.add_edge_update(new_srcs[i],new_dests[i],1); + // Ga.find_value(query_srcs[i], query_dests[i]); + // } + // for (uint32_t i =0 ; i< 100000;i++){ + // Ga.add_edge_update(new_srcs[i],new_dests[i],1); + // for (uint32_t n = 0; n < 9; n++){ + // Ga.find_value(query_srcs[i*9+n], query_dests[i*9+n]); + // } + // } + for (uint32_t i =0 ; i< 100000;i++){ + for (uint32_t n = 0; n < 9; n++){ + Ga.add_edge_update(new_srcs[i*9+n], new_dests[i*9+n], 1); + } + Ga.find_value(query_srcs[i],query_dests[i]); + } + + gettimeofday(&t_end, &tzp); + avg_insert += cal_time_elapsed(&t_start, &t_end); + + } + double time_i = (double) avg_insert / n_trials; + double insert_throughput = 1000000 / time_i; + printf("batch_size = %zu, average insert: %f, throughput %e\n", updates_to_run, time_i, insert_throughput); + log_file<< gname<<","<