Skip to content

Commit

Permalink
Fix some error and warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
skyFzz committed Aug 8, 2024
1 parent b09c584 commit 93c07fc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
8 changes: 4 additions & 4 deletions commons/h5bench_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ char* compress_filter_names[] = {
"GZIP",
"SZ3",
"ZFP",
"SNAPPY-CUDA"
"SNAPPY_CUDA"
};

int compress_filter_ids[] = { -1, 5, 4, 1, 32024, 32013, 32003 };
Expand Down Expand Up @@ -883,8 +883,8 @@ _set_params(char *key, char *val_in, bench_params *params_in_out, int do_write)
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 if (strcmp(val_in, "SNAPPY_CUDA") == 0) {
(*params_in_out).compress_filter = SNAPPY_CUDA;
}

else
Expand Down Expand Up @@ -1339,7 +1339,7 @@ print_params(const bench_params *p)
printf(" Compression_filter_name: %s\n", compress_filter_names[p->compress_filter]); // New
printf(" Compression_filter_id: %d\n", compress_filter_ids[p->compress_filter]); // New
printf(" Number of auxiliary data: %d\n", p->cd_nelmts); // new
cd_values = (unsigned int)malloc(5 * sizeof(unsigned int)); // new
cd_values = (unsigned int *)malloc(5 * sizeof(unsigned int)); // new
cd_values[0] = p->cd_value_1; // new
cd_values[1] = p->cd_value_2;
cd_values[2] = p->cd_value_3;
Expand Down
2 changes: 1 addition & 1 deletion commons/h5bench_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ typedef enum compress_filter { // new
GZIP,
SZ3,
ZFP,
SNAPPY-CUDA
SNAPPY_CUDA
} compress_filter;

typedef struct bench_params {
Expand Down
7 changes: 5 additions & 2 deletions h5bench_patterns/h5bench_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ mem_monitor * MEM_MONITOR;

typedef struct filter_info { // new
int USE_COMPRESS;
size_t cd_nelmts;
size_t *cd_nelmts;
unsigned int *cd_values;
char *name;
unsigned int *filter_config;
Expand Down Expand Up @@ -101,15 +101,18 @@ void
filter_info_init() // new
{
FILTER_INFO.USE_COMPRESS = 0;
FILTER_INFO.cd_nelmts = (size_t *)malloc(sizeof(size_t));
FILTER_INFO.cd_values = (unsigned int *)malloc(10 * sizeof(unsigned int));
FILTER_INFO.name = (char *)malloc(10 * sizeof(char));
FILTER_INFO.filter_config = (unsigned int *)malloc(1 * sizeof(unsigned int));
}


// Free memory for filter_info
void
filter_info_free()
{
free(FILTER_INFO.cd_nelmts);
free(FILTER_INFO.cd_values);
free(FILTER_INFO.name);
free(FILTER_INFO.filter_config);
Expand Down Expand Up @@ -139,7 +142,7 @@ get_filter_info(hid_t dset_id) // new
printf(" Compression filter used to decompress: %s\n", FILTER_INFO.name);
printf(" Filter ID: %d\n", FILTER_INFO.filter_id);
printf(" Number of auxiliary data: %d\n", FILTER_INFO.cd_nelmts);
for (int i = 0; i < FILTER_INFO.cd_nelmts; ++i) {
for (int i = 0; i < *(FILTER_INFO.cd_nelmts); ++i) {
printf(" Auxiliary data %d: %d\n", i, FILTER_INFO.cd_values[i]);
}
}
Expand Down
8 changes: 4 additions & 4 deletions h5bench_patterns/h5bench_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#define DIM_MAX 3
#define H5Z_FILTER_ZFP 32013
#define H5Z_FILTER_SZ3 32024
#define H5Z_FILTER_SNAPPY-CUDA 32003
#define H5Z_FILTER_SNAPPY_CUDA 32003

herr_t ierr;

Expand Down Expand Up @@ -899,7 +899,7 @@ set_globals(const bench_params *params)
herr_t ret;

// Construct auxiliary data for the filter
cd_values = (unsigned int)malloc(5 * sizeof(unsigned int));
cd_values = (unsigned int *)malloc(5 * sizeof(unsigned int));
cd_values[0] = params->cd_value_1;
cd_values[1] = params->cd_value_2;
cd_values[2] = params->cd_value_3;
Expand Down Expand Up @@ -943,8 +943,8 @@ set_globals(const bench_params *params)
else if (params->compress_filter == ZFP) {
ret = H5Pset_filter(COMPRESS_INFO.dcpl_id, H5Z_FILTER_ZFP, H5Z_FLAG_MANDATORY, params->cd_nelmts, cd_values);
}
else if (params->compress_filter == SNAPPY-CUDA) {
ret = H5Pset_filter(COMPRESS_INFO.dcpl_id, H5Z_FILTER_SNAPPY-CUDA, H5Z_FLAG_MANDATORY, params->cd_nelmts, cd_values);
else if (params->compress_filter == SNAPPY_CUDA) {
ret = H5Pset_filter(COMPRESS_INFO.dcpl_id, H5Z_FILTER_SNAPPY_CUDA, H5Z_FLAG_MANDATORY, params->cd_nelmts, cd_values);
}
else {
ret = -1;
Expand Down

0 comments on commit 93c07fc

Please sign in to comment.