Skip to content

Commit

Permalink
Move output.csv file open to the the main function and limit to rank 0
Browse files Browse the repository at this point in the history
This avoids opening the file in all ranks, causing file open contention
between ranks.  Contention increases with rank count and stripe count.

Proposed partial fix for #131 for base write benchmarks.
  • Loading branch information
jprorama committed Oct 3, 2024
1 parent 977e879 commit c1d4a7a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 0 additions & 3 deletions commons/h5bench_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1049,9 +1049,6 @@ _set_params(char *key, char *val_in, bench_params *params_in_out, int do_write)
(*params_in_out).asyncMode = MODE_SYNC;
}

if ((*params_in_out).useCSV)
(*params_in_out).csv_fs = csv_init(params_in_out->csv_path, params_in_out->env_meta_path);

if (val)
free(val);
return 1;
Expand Down
4 changes: 4 additions & 0 deletions h5bench_patterns/h5bench_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,10 @@ main(int argc, char *argv[])
return 0;
}

if (MY_RANK == 0)
if (params.useCSV)
params.csv_fs = csv_init(params.csv_path, params.env_meta_path);

if (params.io_op != IO_WRITE) {
if (MY_RANK == 0)
printf("Make sure the configuration file has IO_OPERATION=WRITE defined\n");
Expand Down
4 changes: 4 additions & 0 deletions h5bench_patterns/h5bench_write_normal_dist.c
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,10 @@ main(int argc, char *argv[])
return 0;
}

if (MY_RANK == 0)
if (params.useCSV)
params.csv_fs = csv_init(params.csv_path, params.env_meta_path);

if (params.io_op != IO_WRITE) {
if (MY_RANK == 0)
printf("Make sure the configuration file has IO_OPERATION=WRITE defined\n");
Expand Down

0 comments on commit c1d4a7a

Please sign in to comment.