From c1d4a7aa42a6b59028fa22dcd8f4dfe9c391003c Mon Sep 17 00:00:00 2001 From: John-Paul Robinson Date: Thu, 3 Oct 2024 09:29:59 -0500 Subject: [PATCH] Move output.csv file open to the the main function and limit to rank 0 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 hpc-io/h5bench#131 for base write benchmarks. --- commons/h5bench_util.c | 3 --- h5bench_patterns/h5bench_write.c | 4 ++++ h5bench_patterns/h5bench_write_normal_dist.c | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/commons/h5bench_util.c b/commons/h5bench_util.c index 5f898c86..024fccb6 100644 --- a/commons/h5bench_util.c +++ b/commons/h5bench_util.c @@ -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; diff --git a/h5bench_patterns/h5bench_write.c b/h5bench_patterns/h5bench_write.c index a7151702..d1bc9718 100644 --- a/h5bench_patterns/h5bench_write.c +++ b/h5bench_patterns/h5bench_write.c @@ -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"); diff --git a/h5bench_patterns/h5bench_write_normal_dist.c b/h5bench_patterns/h5bench_write_normal_dist.c index 46deeb59..db4dbd4c 100644 --- a/h5bench_patterns/h5bench_write_normal_dist.c +++ b/h5bench_patterns/h5bench_write_normal_dist.c @@ -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");