Skip to content

Commit

Permalink
Merge branch 'compression-feature' of github.com:skyFzz/h5bench into …
Browse files Browse the repository at this point in the history
…compression-feature
  • Loading branch information
skyFzz committed Aug 15, 2024
2 parents 60b2794 + 4d5385d commit 70aecb2
Show file tree
Hide file tree
Showing 5 changed files with 271 additions and 273 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/clang-format-fix.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
name: clang-format Check
name: clang-format Fix Format
on:
workflow_dispatch:
push:
jobs:
formatting-check:
name: Formatting Check
name: Commit Format Changes
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip-ci')"
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- name: Run clang-format style check for C programs.
uses: DoozyX/clang-format-lint-action@v0.11
- uses: actions/checkout@v3
- name: Fix C formatting issues detected by clang-format
uses: DoozyX/clang-format-lint-action@v0.13
with:
source: '.'
extensions: 'c,h,cpp,hpp'
clangFormatVersion: 10
inplace: True
style: file
# exclude: './config '
- uses: EndBug/add-and-commit@v7
- uses: EndBug/add-and-commit@v9
with:
author_name: github-actions
author_email: github-actions[bot]@users.noreply.github.com
message: 'Committing clang-format changes'
message: 'committing clang-format changes'
178 changes: 85 additions & 93 deletions commons/h5bench_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,9 @@ int parse_unit(char *str_in, unsigned long long *num, char **unit_str);

int has_vol_async;

char* compress_filter_names[] = {
"INVALID",
"N_BIT",
"SZIP",
"GZIP",
"SZ3",
"ZFP",
"SNAPPY_CUDA"
};

int compress_filter_ids[] = { -1, 5, 4, 1, 32024, 32013, 32003 };
char *compress_filter_names[] = {"INVALID", "N_BIT", "SZIP", "GZIP", "SZ3", "ZFP", "SNAPPY_CUDA"};

int compress_filter_ids[] = {-1, 5, 4, 1, 32024, 32013, 32003};
static unsigned int *cd_values;

unsigned long
Expand Down Expand Up @@ -196,7 +188,7 @@ ts_delayed_close(mem_monitor *mon, unsigned long *metadata_time_total, int dset_

if (!has_vol_async) {
return 0;
}
}

for (int i = 0; i < mon->time_step_cnt; i++) {
ts_run = &(mon->time_steps[i]);
Expand All @@ -214,7 +206,7 @@ ts_delayed_close(mem_monitor *mon, unsigned long *metadata_time_total, int dset_
}
}
*metadata_time_total = meta_time;
return 0;
return 0;
}

int
Expand Down Expand Up @@ -865,62 +857,62 @@ _set_params(char *key, char *val_in, bench_params *params_in_out, int do_write)
else
(*params_in_out).read_option = READ_OPTION_INVALID;
}
else if (strcmp(key, "COMPRESS_FILTER") == 0) { // New
if (strcmp(val_in, "N_BIT") == 0) {
(*params_in_out).compress_filter = N_BIT;
}
else if (strcmp(val_in, "SZIP") == 0) {
(*params_in_out).compress_filter = SZIP;
}
else if (strcmp(val_in, "GZIP") == 0) {
(*params_in_out).compress_filter = GZIP;
}
else if (strcmp(val_in, "SZ3") == 0) {
(*params_in_out).compress_filter = SZ3;
}
else if (strcmp(val_in, "ZFP") == 0) {
(*params_in_out).compress_filter = ZFP;
}
else if (strcmp(val_in, "SNAPPY_CUDA") == 0) {
(*params_in_out).compress_filter = SNAPPY_CUDA;
}
else
(*params_in_out).compress_filter = COMPRESS_FILTER_INVALID;
}
else if (strcmp(key, "CD_NELMTS") == 0) {
(*params_in_out).cd_nelmts = atoi(val);
}
else if (strcmp(key, "CD_VALUES_1") == 0) {
(*params_in_out).cd_value_1 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_2") == 0) {
(*params_in_out).cd_value_2 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_3") == 0) {
(*params_in_out).cd_value_3 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_4") == 0) {
(*params_in_out).cd_value_4 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_5") == 0) {
(*params_in_out).cd_value_5 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_6") == 0) {
(*params_in_out).cd_value_6 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_7") == 0) {
(*params_in_out).cd_value_7 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_8") == 0) {
(*params_in_out).cd_value_8 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_9") == 0) {
(*params_in_out).cd_value_9 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_10") == 0) {
(*params_in_out).cd_value_10 = atoi(val);
}
else if (strcmp(key, "COMPRESS_FILTER") == 0) { // New
if (strcmp(val_in, "N_BIT") == 0) {
(*params_in_out).compress_filter = N_BIT;
}
else if (strcmp(val_in, "SZIP") == 0) {
(*params_in_out).compress_filter = SZIP;
}
else if (strcmp(val_in, "GZIP") == 0) {
(*params_in_out).compress_filter = GZIP;
}
else if (strcmp(val_in, "SZ3") == 0) {
(*params_in_out).compress_filter = SZ3;
}
else if (strcmp(val_in, "ZFP") == 0) {
(*params_in_out).compress_filter = ZFP;
}
else if (strcmp(val_in, "SNAPPY_CUDA") == 0) {
(*params_in_out).compress_filter = SNAPPY_CUDA;
}

else
(*params_in_out).compress_filter = COMPRESS_FILTER_INVALID;
}
else if (strcmp(key, "CD_NELMTS") == 0) {
(*params_in_out).cd_nelmts = atoi(val);
}
else if (strcmp(key, "CD_VALUES_1") == 0) {
(*params_in_out).cd_value_1 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_2") == 0) {
(*params_in_out).cd_value_2 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_3") == 0) {
(*params_in_out).cd_value_3 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_4") == 0) {
(*params_in_out).cd_value_4 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_5") == 0) {
(*params_in_out).cd_value_5 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_6") == 0) {
(*params_in_out).cd_value_6 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_7") == 0) {
(*params_in_out).cd_value_7 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_8") == 0) {
(*params_in_out).cd_value_8 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_9") == 0) {
(*params_in_out).cd_value_9 = atoi(val);
}
else if (strcmp(key, "CD_VALUES_10") == 0) {
(*params_in_out).cd_value_10 = atoi(val);
}
else if (strcmp(key, "NUM_DIMS") == 0) {
int num = atoi(val);
if (num > 0)
Expand Down Expand Up @@ -1170,12 +1162,12 @@ bench_params_init(bench_params *params_out)
(*params_out).align_threshold = 0;
(*params_out).align_len = 0;

(*params_out).cd_nelmts = 0; // new
(*params_out).cd_value_1 = 0; // new
(*params_out).cd_value_2 = 0; // new
(*params_out).cd_value_3 = 0; // new
(*params_out).cd_value_4 = 0; // new
(*params_out).cd_value_5 = 0; // new
(*params_out).cd_nelmts = 0; // new
(*params_out).cd_value_1 = 0; // new
(*params_out).cd_value_2 = 0; // new
(*params_out).cd_value_3 = 0; // new
(*params_out).cd_value_4 = 0; // new
(*params_out).cd_value_5 = 0; // new
}

int
Expand Down Expand Up @@ -1349,24 +1341,24 @@ print_params(const bench_params *p)

if (p->useCompress) {
printf("Use compression: %d\n", p->useCompress);
printf(" Compression_filter_name: %s\n", compress_filter_names[p->compress_filter]);
printf(" Compression_filter_id: %d\n", compress_filter_ids[p->compress_filter]);
printf(" Number of compression filter parameters: %d\n", p->cd_nelmts);
cd_values = (unsigned int *)malloc(10 * sizeof(unsigned int));
cd_values[0] = p->cd_value_1;
cd_values[1] = p->cd_value_2;
cd_values[2] = p->cd_value_3;
cd_values[3] = p->cd_value_4;
cd_values[4] = p->cd_value_5;
cd_values[5] = p->cd_value_6;
cd_values[6] = p->cd_value_7;
cd_values[7] = p->cd_value_8;
cd_values[8] = p->cd_value_9;
cd_values[9] = p->cd_value_10;
for (int i = 0; i < p->cd_nelmts; ++i) {
printf(" Compression parameter %d: %d\n", i + 1, cd_values[i]);
}
free(cd_values);
printf(" Compression_filter_name: %s\n", compress_filter_names[p->compress_filter]);
printf(" Compression_filter_id: %d\n", compress_filter_ids[p->compress_filter]);
printf(" Number of compression filter parameters: %d\n", p->cd_nelmts);
cd_values = (unsigned int *)malloc(10 * sizeof(unsigned int));
cd_values[0] = p->cd_value_1;
cd_values[1] = p->cd_value_2;
cd_values[2] = p->cd_value_3;
cd_values[3] = p->cd_value_4;
cd_values[4] = p->cd_value_5;
cd_values[5] = p->cd_value_6;
cd_values[6] = p->cd_value_7;
cd_values[7] = p->cd_value_8;
cd_values[8] = p->cd_value_9;
cd_values[9] = p->cd_value_10;
for (int i = 0; i < p->cd_nelmts; ++i) {
printf(" Compression parameter %d: %d\n", i + 1, cd_values[i]);
}
free(cd_values);
printf(" chunk_dim1: %lu\n", p->chunk_dim_1);
if (p->num_dims >= 2) {
printf(" chunk_dim2: %lu\n", p->chunk_dim_2);
Expand Down
44 changes: 22 additions & 22 deletions commons/h5bench_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,21 @@ typedef enum compress_filter {
N_BIT,
SZIP,
GZIP,
SZ3,
ZFP,
SNAPPY_CUDA
SZ3,
ZFP,
SNAPPY_CUDA
} compress_filter;

typedef struct bench_params {
io_operation io_op;
pattern mem_pattern;
pattern file_pattern;
read_option read_option;
io_operation io_op;
pattern mem_pattern;
pattern file_pattern;
read_option read_option;
compress_filter compress_filter;
int useCompress;
int useCSV;
async_mode asyncMode;
int subfiling;
int useCompress;
int useCSV;
async_mode asyncMode;
int subfiling;
union access_pattern {
read_pattern pattern_read;
write_pattern pattern_write;
Expand Down Expand Up @@ -159,17 +159,17 @@ typedef struct bench_params {
unsigned long align_threshold;
unsigned long align_len;
unsigned long stdev_dim_1;
size_t cd_nelmts;
unsigned int cd_value_1;
unsigned int cd_value_2;
unsigned int cd_value_3;
unsigned int cd_value_4;
unsigned int cd_value_5;
unsigned int cd_value_6;
unsigned int cd_value_7;
unsigned int cd_value_8;
unsigned int cd_value_9;
unsigned int cd_value_10;
size_t cd_nelmts;
unsigned int cd_value_1;
unsigned int cd_value_2;
unsigned int cd_value_3;
unsigned int cd_value_4;
unsigned int cd_value_5;
unsigned int cd_value_6;
unsigned int cd_value_7;
unsigned int cd_value_8;
unsigned int cd_value_9;
unsigned int cd_value_10;
} bench_params;

typedef struct data_md {
Expand Down
Loading

0 comments on commit 70aecb2

Please sign in to comment.