Skip to content

Commit

Permalink
Add scaling factor for data distribution particle counts
Browse files Browse the repository at this point in the history
Add scaling paramter to tests to scale particle count in order
to create memory footprints that more accurately reflect a data
distribution.

Data distribution inputs are in particle counts.
Particles are 32-byte structures so a data distribution measured in
bytes needs to be scaled down so the particals instiated match
the actual data footprint, in multiples of 32-byte particles.
  • Loading branch information
jprorama committed Aug 20, 2024
1 parent e051203 commit 9cf8232
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
12 changes: 12 additions & 0 deletions commons/h5bench_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,15 @@ _set_params(char *key, char *val_in, bench_params *params_in_out, int do_write)
(*params_in_out).useDataDist = 1;
(*params_in_out).data_dist_path = strdup(val);
}
else if (strcmp(key, "DATA_DIST_SCALE") == 0) {
float num = 0.0;
char *tok;
tok = strtok(val, "/");
num = strtof(tok, NULL);
if (tok = strtok(NULL, "/"))
num = num / strtof(tok, NULL); // two terms with / delim is fraction
(*params_in_out).data_dist_scale = num;
}
else if (strcmp(key, "ENV_METADATA_FILE") == 0) {
(*params_in_out).env_meta_path = strdup(val);
}
Expand Down Expand Up @@ -1070,6 +1079,7 @@ bench_params_init(bench_params *params_out)
(*params_out).data_coll = 0;
(*params_out).asyncMode = MODE_SYNC;
(*params_out).subfiling = 0;
(*params_out).useDataDist = 0;

(*params_out).cnt_time_step = 0;
(*params_out).cnt_time_step_delay = 0;
Expand Down Expand Up @@ -1098,6 +1108,8 @@ bench_params_init(bench_params *params_out)

(*params_out).csv_path = NULL;
(*params_out).csv_fs = NULL;
(*params_out).data_dist_path = NULL;
(*params_out).data_dist_scale = 1.0;
(*params_out).env_meta_path = NULL;
(*params_out).file_per_proc = 0;
(*params_out).align = 0;
Expand Down
1 change: 1 addition & 0 deletions commons/h5bench_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ typedef struct bench_params {
char * env_meta_path;
FILE * csv_fs;
char * data_dist_path;
float data_dist_scale;
int file_per_proc;
int align;
unsigned long align_threshold;
Expand Down
6 changes: 5 additions & 1 deletion h5bench_patterns/h5bench_write_data_dist.c
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,11 @@ main(int argc, char *argv[])
index = atoi(tok);
tok = strtok(NULL, " ");
if (tok) {
holder[index] = strtoll(tok, NULL, 10);
/* don't compute scale if factor is 1, identity */
if (params.data_dist_scale == 1.0)
holder[index] = strtoll(tok, NULL, 10);
else
holder[index] = (long long) (params.data_dist_scale * strtoll(tok, NULL, 10));
}
} else {
return -1;
Expand Down

0 comments on commit 9cf8232

Please sign in to comment.