From 25187e2995d61c1f3abea22de762b2842f930460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Constantin=20F=C3=BCrst?= Date: Tue, 23 Jan 2024 11:58:19 +0100 Subject: [PATCH] add checks for output file success and modify their location --- qdp_project/src/benchmark/MAX_benchmark.cpp | 38 ++++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/qdp_project/src/benchmark/MAX_benchmark.cpp b/qdp_project/src/benchmark/MAX_benchmark.cpp index c120310..bb23390 100644 --- a/qdp_project/src/benchmark/MAX_benchmark.cpp +++ b/qdp_project/src/benchmark/MAX_benchmark.cpp @@ -111,12 +111,18 @@ int main(int argc, char** argv) { std::ofstream out_file; - out_file.open("../results/max_" - "q-" + (std::string)(simple_query == true ? "simple" : "complex") + - "_bm-" + (std::string) BARRIER_MODE + - "_bl-" + (std::string)(BUFFER_LIMIT == 1 ? "limited" : "unlimited") + - "_tc-" + std::to_string(thread_count) + "1MiB-2MiB.csv", std::ios::app); - + const std::string ofname = std::string("results/max_") + + "q-" + (std::string)(simple_query == true ? "simple" : "complex") + + "_bm-" + (std::string) BARRIER_MODE + + "_bl-" + (std::string)(BUFFER_LIMIT == 1 ? "limited" : "unlimited") + + "_tc-" + std::to_string(thread_count) + "1MiB-2MiB.csv"; + + out_file.open(ofname); + + if (out_file.bad()) { + std::cerr << "Failed to open Output File '" << ofname << "'" << std::endl; + } + // set benchmark parameter Linear_Int_Range run("run"); Linear_Int_Range chunk_size("chunk_size"); @@ -130,8 +136,8 @@ int main(int argc, char** argv) { "wait_scan_a", "wait_scan_b", "wait_aggr_j", #endif #if PCM == 1 - pcm_value_collector::getHead("scan_a"), - pcm_value_collector::getHead("scan_b"), + pcm_value_collector::getHead("scan_a"), + pcm_value_collector::getHead("scan_b"), pcm_value_collector::getHead("aggr_j"), #endif "result"); @@ -145,13 +151,19 @@ int main(int argc, char** argv) { fill_mt(data_a, workload_b, 0, 100, 42); fill_mt(data_b, workload_b, 0, 100, 420); + const std::string cfname = std::string("results/max_") + + "q-" + (std::string)(simple_query == true ? "simple" : "complex") + + "_bm-" + (std::string) BARRIER_MODE + + "_bl-" + (std::string)(BUFFER_LIMIT == 1 ? "limited" : "unlimited") + + "_tc-" + std::to_string(thread_count) + ".checksum"; std::ofstream check_file; - check_file.open("../results/max_" - "q-" + (std::string)(simple_query == true ? "simple" : "complex") + - "_bm-" + (std::string) BARRIER_MODE + - "_bl-" + (std::string)(BUFFER_LIMIT == 1 ? "limited" : "unlimited") + - "_tc-" + std::to_string(thread_count) + ".checksum"); + check_file.open(cfname); + + if (check_file.bad()) { + std::cerr << "Failed to open Checksum File '" << cfname << "'" << std::endl; + } + if constexpr (QUERY == 1) { //calculate simple checksum if QUERY == 1 -> simple query is applied check_file << sum_check(compare_value_a, data_a, data_b, workload_b);