diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index 2eb8896..0216107 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -132,14 +132,16 @@ function(get_matrix_data FILE_URL FILE_NAME) file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/${FILE_NAME}/) endfunction() -get_matrix_data("http://sparse-files.engr.tamu.edu/MM/Schenk_AFE/af_shell10.tar.gz" "af_shell10") -get_matrix_data("https://suitesparse-collection-website.herokuapp.com/MM/vanHeukelum/cage15.tar.gz" "cage15") -get_matrix_data("https://suitesparse-collection-website.herokuapp.com/MM/Lee/fem_hifreq_circuit.tar.gz" "fem_hifreq_circuit") +get_matrix_data("https://suitesparse-collection-website.herokuapp.com/MM/MAWI/mawi_201512020330.tar.gz" "mawi_201512020330") +get_matrix_data("https://suitesparse-collection-website.herokuapp.com/MM/LAW/uk-2005.tar.gz" "uk-2005") +get_matrix_data("https://suitesparse-collection-website.herokuapp.com/MM/Dziekonski/dielFilterV3clx.tar.gz" "dielFilterV3clx") +get_matrix_data("https://suitesparse-collection-website.herokuapp.com/MM/Janna/Queen_4147.tar.gz" "Queen_4147") + + + # also possible to use CPMAddPackage, but it will not remove the archive after extraction #CPMAddPackage("http://sparse-files.engr.tamu.edu/MM/Schenk_AFE/af_shell10.tar.gz") -#CPMAddPackage("https://suitesparse-collection-website.herokuapp.com/MM/vanHeukelum/cage15.tar.gz") -#CPMAddPackage("https://suitesparse-collection-website.herokuapp.com/MM/Lee/fem_hifreq_circuit.tar.gz") # ---- Create binary ---- file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp) diff --git a/benchmark/source/fixtures.h b/benchmark/source/fixtures.h index ee0bb2c..5a45fec 100644 --- a/benchmark/source/fixtures.h +++ b/benchmark/source/fixtures.h @@ -269,11 +269,23 @@ class HeapStringVectorFixture : public RandomStringVectorFixture struct matrix_element_t { uint32_t row, col; @@ -288,17 +300,13 @@ struct matrix_element_t { } }; -using matrix_element_double = matrix_element_t; -using matrix_element_complex = matrix_element_t>; - -template -class SparseMatrixAoSVectorFixture : public VectorFixture> { - using ValueType = std::conditional_t, double>; +template +class SparseMatrixAoSVectorFixture : public VectorFixture { public: SparseMatrixAoSVectorFixture() : - file_(get_filename()) { + file_(get_filename(Matrix)) { if (!file_.is_open()) - throw std::runtime_error(std::string("Error opening matrix file: ") +get_filename()); + throw std::runtime_error(std::string("Error opening matrix file: ") +get_filename(Matrix)); read_to_memory(); } @@ -316,41 +324,25 @@ class SparseMatrixAoSVectorFixture : public VectorFixture().value)>; std::fstream file_; std::size_t nrows_{}, ncols_{}; std::vector rows_, cols_; std::vector values_{}; }; -auto c_comp = [](const std::complex& a, const std::complex& b) { - return true; -}; - -template -class SparseMatrixSoAVectorFixture : public VectorFixture, double>> { - using ValueType = std::conditional_t, double>; +template +class SparseMatrixSoAVectorFixture : public VectorFixture { public: SparseMatrixSoAVectorFixture() : - file_(get_filename()) { + file_(get_filename(Matrix)) { if (!file_.is_open()) - throw std::runtime_error(std::string("Error opening matrix file: ") +get_filename()); + throw std::runtime_error(std::string("Error opening matrix file: ") +get_filename(Matrix)); read_to_memory(); } @@ -365,24 +357,12 @@ class SparseMatrixSoAVectorFixture : public VectorFixture().swap(this->data_); + std::vector().swap(this->data_); std::vector().swap(this->rows_); std::vector().swap(this->cols_); } protected: - consteval static const char * get_filename() { - switch (Matrix) { - case af_shell10: - return "af_shell10.mtx"; - case cage15: - return "cage15.mtx"; - case fem_hifreq_circuit: - return "fem_hifreq_circuit.mtx"; - default: - throw std::runtime_error("Unknown matrix"); - } - } void read_to_memory() { fast_matrix_market::read_matrix_market_triplet(file_, nrows_, ncols_, rows_orig_, cols_orig_, values_orig_); @@ -391,5 +371,5 @@ class SparseMatrixSoAVectorFixture : public VectorFixture rows_orig_, cols_orig_, rows_, cols_; - std::vector values_orig_; + std::vector values_orig_{}; }; \ No newline at end of file diff --git a/benchmark/source/ppqsort.cpp b/benchmark/source/ppqsort.cpp index 0b7e38d..337f420 100644 --- a/benchmark/source/ppqsort.cpp +++ b/benchmark/source/ppqsort.cpp @@ -120,15 +120,19 @@ register_string_benchmark(sort_signature, sort_name, OrganPipe, prepended, true, register_string_benchmark(sort_signature, sort_name, Rotated, prepended, true, prepare_code) \ register_string_benchmark(sort_signature, sort_name, Heap, prepended, true, prepare_code) -#define matrix_benchmark_AoS(sort_signature, sort_name, prepare_code) \ -register_matrix_benchmark(sort_signature, sort_name, SparseMatrixAoS, af_shell10, false, prepare_code) \ -register_matrix_benchmark(sort_signature, sort_name, SparseMatrixAoS, cage15, false, prepare_code) \ -register_matrix_benchmark(sort_signature, sort_name, SparseMatrixAoS, fem_hifreq_circuit, true, prepare_code) -#define matrix_benchmark_SoA(sort_signature, sort_name, prepare_code) \ -register_matrix_benchmark(sort_signature, sort_name, SparseMatrixSoA, af_shell10, false, prepare_code) \ -register_matrix_benchmark(sort_signature, sort_name, SparseMatrixSoA, cage15, false, prepare_code) \ -register_matrix_benchmark(sort_signature, sort_name, SparseMatrixSoA, fem_hifreq_circuit, true, prepare_code) +#define matrix_benchmark_AoS(sort_signature, sort_name, prepare_code) \ +register_matrix_benchmark(sort_signature, sort_name, SparseMatrixAoS, mawi_201512020330, matrix_element_t, prepare_code) \ +register_matrix_benchmark(sort_signature, sort_name, SparseMatrixAoS, uk_2005, matrix_element_t, prepare_code) \ +register_matrix_benchmark(sort_signature, sort_name, SparseMatrixAoS, dielFilterV3clx, matrix_element_t>, prepare_code) \ +register_matrix_benchmark(sort_signature, sort_name, SparseMatrixAoS, Queen_4147, matrix_element_t, prepare_code) + + +#define matrix_benchmark_SoA(sort_signature, sort_name, prepare_code) \ +register_matrix_benchmark(sort_signature, sort_name, SparseMatrixSoA, mawi_201512020330, int, prepare_code) \ +register_matrix_benchmark(sort_signature, sort_name, SparseMatrixSoA, uk_2005, uint8_t, prepare_code) \ +register_matrix_benchmark(sort_signature, sort_name, SparseMatrixSoA, dielFilterV3clx, std::complex, prepare_code) \ +register_matrix_benchmark(sort_signature, sort_name, SparseMatrixSoA, Queen_4147, double, prepare_code) #define prepare_adversary(Size) \ int candidate = 0; \ @@ -239,7 +243,6 @@ complete_benchmark_set_aq(aqsort::sort(data_.size(), &cmp, &sw), aqsort, auto sw = [&](std::size_t i, std::size_t j) { std::swap(data_[i], data_[j]); }; auto cmp = [&](std::size_t i, std::size_t j) { return data_[i] < data_[j]; } ); - complete_benchmark_set(mpqsort::sort(mpqsort::execution::par, data_.begin(), data_.end()), mpqsort_par, ""); complete_benchmark_set(ips4o::parallel::sort(data_.begin(), data_.end()), ips4o, "");