Skip to content

Commit

Permalink
use the zstd version 1.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
azimafroozeh committed Nov 18, 2024
1 parent ba708f9 commit 009c37b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
8 changes: 4 additions & 4 deletions publication/compression_ratio_result/float/zstd.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dataset,size
Dino-Vitb16,39.57
GPT2,39.76
Grammarly-lg,39.37
WAV2VEC,43.15
Dino-Vitb16,14.87
GPT2,14.85
Grammarly-lg,14.82
WAV2VEC,9.55
5 changes: 3 additions & 2 deletions publication/source_code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ endif ()

FetchContent_Declare(
zstd
GIT_REPOSITORY https://github.com/facebook/zstd
GIT_TAG 794ea1b0afca0f020f4e57b6732332231fb23c70)
GIT_REPOSITORY https://github.com/facebook/zstd.git
GIT_TAG v1.5.5
)

FetchContent_MakeAvailable(zstd)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ gtest_discover_tests(publication_bench_alp32_compression_ratio)

# Test ZSTD: ----------------------------------------------------------------------------------------------------------
add_executable(publication_bench_zstd_compression_ratio zstd.cpp)
target_link_libraries(publication_bench_zstd_compression_ratio PRIVATE gtest_main libzstd)
target_link_libraries(publication_bench_zstd_compression_ratio PRIVATE gtest_main libzstd_shared)
gtest_discover_tests(publication_bench_zstd_compression_ratio)

# Test Chimp: ----------------------------------------------------------------------------------------------------------
Expand Down
29 changes: 14 additions & 15 deletions publication/source_code/bench_compression_ratio/zstd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,23 @@ class zstd_test : public ::testing::Test {
void* dec_dbl_arr;
size_t zstd_vector_size =
alp::config::ROWGROUP_SIZE; // For Zstd we compress rowgroups since it would be unfair to compress small vectors
size_t enc_size_upper_bound = zstd_vector_size * 8;
size_t input_size = zstd_vector_size * 8;
size_t dec_size = input_size;

void SetUp() override {
enc_dbl_arr = malloc(input_size);
dec_dbl_arr = malloc(input_size);
}
void SetUp() override {}

~zstd_test() override {
free(enc_dbl_arr);
free(dec_dbl_arr);
}
~zstd_test() override {}

template <typename T, int N_DATASETS>
void bench_compression_ratio(const std::array<alp_bench::Column, N_DATASETS>& datasets, const std::string& path) {
if (const auto v = std::getenv("ALP_DATASET_DIR_PATH"); v != nullptr) {
alp_bench::get_paths().alp_dataset_binary_dir_path = *v;
}

size_t enc_size_upper_bound = zstd_vector_size * sizeof(T);
size_t input_size = zstd_vector_size * sizeof(T);
size_t dec_size = input_size;
enc_dbl_arr = malloc(input_size);
dec_dbl_arr = malloc(input_size);

std::ofstream ofile(path, std::ios::out);
ofile << "dataset,size\n";

Expand All @@ -48,8 +45,8 @@ class zstd_test : public ::testing::Test {

if (tuples_count < zstd_vector_size) {
zstd_vector_size = tuples_count;
input_size = zstd_vector_size * 8;
enc_size_upper_bound = zstd_vector_size * 8;
input_size = zstd_vector_size * sizeof(T);
enc_size_upper_bound = zstd_vector_size * sizeof(T);
}

/* Encode - Decode - Validate. */
Expand All @@ -67,7 +64,7 @@ class zstd_test : public ::testing::Test {
ZSTD_compress(enc_dbl_arr, enc_size_upper_bound, dbl_arr, input_size, 3); // Level 3

// SUM COMPRESSED SIZE
compressed_data_size += ENC_SIZE * 8;
compressed_data_size += ENC_SIZE * sizeof(T);

// Decode
ZSTD_decompress(dec_dbl_arr, dec_size, enc_dbl_arr, ENC_SIZE);
Expand All @@ -83,10 +80,12 @@ class zstd_test : public ::testing::Test {

auto compression_ratio = (double)compressed_data_size / processed_tuples;

ofile << std::fixed << std::setprecision(2) << dataset.name << "," << compression_ratio << "\n";
ofile << std::fixed << std::setprecision(2) << dataset.name << "," << compression_ratio << std::endl;
}

delete[] dbl_arr;
free(enc_dbl_arr);
free(dec_dbl_arr);
}
};

Expand Down

0 comments on commit 009c37b

Please sign in to comment.