From 74573e797e6bd627328cf9f654ce51cb21e7f60e Mon Sep 17 00:00:00 2001 From: Glenn Song Date: Thu, 22 Feb 2024 16:26:59 -0600 Subject: [PATCH 01/20] Handle certain subfiling environment variables that are not set to anything --- src/H5FDsubfiling/H5subfiling_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/H5FDsubfiling/H5subfiling_common.c b/src/H5FDsubfiling/H5subfiling_common.c index 1127ae0a386..51d150ac6e0 100644 --- a/src/H5FDsubfiling/H5subfiling_common.c +++ b/src/H5FDsubfiling/H5subfiling_common.c @@ -1186,7 +1186,7 @@ get_ioc_selection_criteria_from_env(H5FD_subfiling_ioc_select_t *ioc_selection_t *ioc_sel_info_str = NULL; - if (env_value) { + if (env_value && (strlen(env_value) > 0)) { /* * Parse I/O Concentrator selection strategy criteria as * either a single value or two colon-separated values of @@ -1821,7 +1821,8 @@ init_subfiling_context(subfiling_context_t *sf_context, const char *base_filenam "couldn't allocate space for subfiling filename"); /* Check for a subfile name prefix setting in the environment */ - if ((env_value = getenv(H5FD_SUBFILING_SUBFILE_PREFIX))) { + env_value = getenv(H5FD_SUBFILING_SUBFILE_PREFIX); + if (env_value && (strlen(env_value) > 0)) { if (NULL == (sf_context->subfile_prefix = strdup(env_value))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't copy subfile prefix value"); } From 9659199178f7b2a3301501ebf6d9620580132582 Mon Sep 17 00:00:00 2001 From: Glenn Song Date: Mon, 26 Feb 2024 16:56:01 -0600 Subject: [PATCH 02/20] Fix all subfiling environment variables --- src/H5FDsubfiling/H5FDioc.c | 6 ++++-- src/H5FDsubfiling/H5subfiling_common.c | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/H5FDsubfiling/H5FDioc.c b/src/H5FDsubfiling/H5FDioc.c index b019add4009..00f4bc53106 100644 --- a/src/H5FDsubfiling/H5FDioc.c +++ b/src/H5FDsubfiling/H5FDioc.c @@ -224,7 +224,7 @@ H5FD_ioc_init(void) /* Check if IOC VFD has been loaded dynamically */ env_var = getenv(HDF5_DRIVER); - if (env_var && !strcmp(env_var, H5FD_IOC_NAME)) { + if ((env_var && !strcmp(env_var, H5FD_IOC_NAME) && (strlen(env_value) > 0))) { int mpi_initialized = 0; int provided = 0; @@ -1497,8 +1497,10 @@ H5FD__ioc_del(const char *name, hid_t fapl) /* TODO: No support for subfile directory prefix currently */ /* TODO: Possibly try loading config file prefix from file before deleting */ - snprintf(tmp_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, + if (prefix_env && (strlen(prefix_env) > 0)) { + snprintf(tmp_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, prefix_env ? prefix_env : file_dirname, base_filename, (uint64_t)st.st_ino); + } if (NULL == (config_file = fopen(tmp_filename, "r"))) { if (ENOENT == errno) { diff --git a/src/H5FDsubfiling/H5subfiling_common.c b/src/H5FDsubfiling/H5subfiling_common.c index 51d150ac6e0..8ba9bea678d 100644 --- a/src/H5FDsubfiling/H5subfiling_common.c +++ b/src/H5FDsubfiling/H5subfiling_common.c @@ -777,7 +777,7 @@ init_subfiling(const char *base_filename, uint64_t file_id, H5FD_subfiling_param /* Check if a prefix has been set for the configuration file name */ prefix_env = getenv(H5FD_SUBFILING_CONFIG_FILE_PREFIX); - if (prefix_env) { + if (prefix_env && (strlen(prefix_env > 0)) { if (NULL == (new_context->config_file_prefix = strdup(prefix_env))) H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTCOPY, FAIL, "couldn't copy config file prefix string"); } @@ -851,7 +851,8 @@ init_subfiling(const char *base_filename, uint64_t file_id, H5FD_subfiling_param char *env_value = NULL; /* Check for a subfiling stripe size setting from the environment */ - if ((env_value = getenv(H5FD_SUBFILING_STRIPE_SIZE))) { + env_value = getenv(H5FD_SUBFILING_STRIPE_SIZE); + if (env_value && (strlen(env_value) > 0)) { long long stripe_size = -1; errno = 0; @@ -981,7 +982,8 @@ init_app_topology(int64_t sf_context_id, H5FD_subfiling_params_t *subfiling_conf case SELECT_IOC_ONE_PER_NODE: { if (comm_size > 1) { /* Check for an IOC-per-node value set in the environment */ - if ((env_value = getenv(H5FD_SUBFILING_IOC_PER_NODE))) { + env_value = getenv(H5FD_SUBFILING_IOC_PER_NODE); + if (env_value && (strlen(env_value) > 0)) { errno = 0; ioc_select_val = strtol(env_value, NULL, 0); if ((ERANGE == errno)) { From 69112cdfd9f2c40c7ec892032c3807a89ae0be92 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 23:02:56 +0000 Subject: [PATCH 03/20] Committing clang-format changes --- src/H5FDsubfiling/H5FDioc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5FDsubfiling/H5FDioc.c b/src/H5FDsubfiling/H5FDioc.c index 00f4bc53106..e98a6900931 100644 --- a/src/H5FDsubfiling/H5FDioc.c +++ b/src/H5FDsubfiling/H5FDioc.c @@ -1499,7 +1499,7 @@ H5FD__ioc_del(const char *name, hid_t fapl) /* TODO: Possibly try loading config file prefix from file before deleting */ if (prefix_env && (strlen(prefix_env) > 0)) { snprintf(tmp_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, - prefix_env ? prefix_env : file_dirname, base_filename, (uint64_t)st.st_ino); + prefix_env ? prefix_env : file_dirname, base_filename, (uint64_t)st.st_ino); } if (NULL == (config_file = fopen(tmp_filename, "r"))) { From 2a3d6f1c39b148f74c449b901cef09f6f74d49a9 Mon Sep 17 00:00:00 2001 From: Glenn Song Date: Thu, 7 Mar 2024 19:09:39 -0600 Subject: [PATCH 04/20] Update for Jordan's comments --- src/H5FDsubfiling/H5FDioc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/H5FDsubfiling/H5FDioc.c b/src/H5FDsubfiling/H5FDioc.c index 00f4bc53106..7d74b02befe 100644 --- a/src/H5FDsubfiling/H5FDioc.c +++ b/src/H5FDsubfiling/H5FDioc.c @@ -224,7 +224,7 @@ H5FD_ioc_init(void) /* Check if IOC VFD has been loaded dynamically */ env_var = getenv(HDF5_DRIVER); - if ((env_var && !strcmp(env_var, H5FD_IOC_NAME) && (strlen(env_value) > 0))) { + if (env_var && strlen(env_var) > 0 && !strcmp(env_var, H5FD_IOC_NAME)) { int mpi_initialized = 0; int provided = 0; @@ -1497,11 +1497,9 @@ H5FD__ioc_del(const char *name, hid_t fapl) /* TODO: No support for subfile directory prefix currently */ /* TODO: Possibly try loading config file prefix from file before deleting */ - if (prefix_env && (strlen(prefix_env) > 0)) { - snprintf(tmp_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, + snprintf(tmp_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, prefix_env ? prefix_env : file_dirname, base_filename, (uint64_t)st.st_ino); - } - + if (NULL == (config_file = fopen(tmp_filename, "r"))) { if (ENOENT == errno) { #ifdef H5FD_IOC_DEBUG From 88c5e945a766e20cfccdb536f9e4d9e9319c369e Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 8 Mar 2024 01:17:07 +0000 Subject: [PATCH 05/20] Committing clang-format changes --- src/H5FDsubfiling/H5FDioc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5FDsubfiling/H5FDioc.c b/src/H5FDsubfiling/H5FDioc.c index 7d74b02befe..673392d7add 100644 --- a/src/H5FDsubfiling/H5FDioc.c +++ b/src/H5FDsubfiling/H5FDioc.c @@ -1499,7 +1499,7 @@ H5FD__ioc_del(const char *name, hid_t fapl) /* TODO: Possibly try loading config file prefix from file before deleting */ snprintf(tmp_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, prefix_env ? prefix_env : file_dirname, base_filename, (uint64_t)st.st_ino); - + if (NULL == (config_file = fopen(tmp_filename, "r"))) { if (ENOENT == errno) { #ifdef H5FD_IOC_DEBUG From 08e6cf5dfdc6dbff9f058abeeb872e4642f3e587 Mon Sep 17 00:00:00 2001 From: Glenn Song Date: Thu, 7 Mar 2024 19:27:55 -0600 Subject: [PATCH 06/20] Passes all tests --- src/H5FDsubfiling/H5subfiling_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5FDsubfiling/H5subfiling_common.c b/src/H5FDsubfiling/H5subfiling_common.c index 8ba9bea678d..4c90835ca44 100644 --- a/src/H5FDsubfiling/H5subfiling_common.c +++ b/src/H5FDsubfiling/H5subfiling_common.c @@ -777,7 +777,7 @@ init_subfiling(const char *base_filename, uint64_t file_id, H5FD_subfiling_param /* Check if a prefix has been set for the configuration file name */ prefix_env = getenv(H5FD_SUBFILING_CONFIG_FILE_PREFIX); - if (prefix_env && (strlen(prefix_env > 0)) { + if (prefix_env && (strlen(prefix_env) > 0)) { if (NULL == (new_context->config_file_prefix = strdup(prefix_env))) H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTCOPY, FAIL, "couldn't copy config file prefix string"); } From b768e0ed72847959edb576e364127ddac353107a Mon Sep 17 00:00:00 2001 From: Glenn Song Date: Wed, 13 Mar 2024 19:38:02 -0500 Subject: [PATCH 07/20] Make Jordan's changes --- src/H5FDsubfiling/H5FDioc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5FDsubfiling/H5FDioc.c b/src/H5FDsubfiling/H5FDioc.c index 673392d7add..7156384896c 100644 --- a/src/H5FDsubfiling/H5FDioc.c +++ b/src/H5FDsubfiling/H5FDioc.c @@ -1498,7 +1498,7 @@ H5FD__ioc_del(const char *name, hid_t fapl) /* TODO: No support for subfile directory prefix currently */ /* TODO: Possibly try loading config file prefix from file before deleting */ snprintf(tmp_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, - prefix_env ? prefix_env : file_dirname, base_filename, (uint64_t)st.st_ino); + prefix_env && (strlen(prefix_env) > 0) ? prefix_env : file_dirname, base_filename, (uint64_t)st.st_ino); if (NULL == (config_file = fopen(tmp_filename, "r"))) { if (ENOENT == errno) { From abf4d99642959a697e4a9323a3a6bbacce824d19 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Mar 2024 00:39:41 +0000 Subject: [PATCH 08/20] Committing clang-format changes --- src/H5FDsubfiling/H5FDioc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/H5FDsubfiling/H5FDioc.c b/src/H5FDsubfiling/H5FDioc.c index 7156384896c..fc581775867 100644 --- a/src/H5FDsubfiling/H5FDioc.c +++ b/src/H5FDsubfiling/H5FDioc.c @@ -1498,7 +1498,8 @@ H5FD__ioc_del(const char *name, hid_t fapl) /* TODO: No support for subfile directory prefix currently */ /* TODO: Possibly try loading config file prefix from file before deleting */ snprintf(tmp_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, - prefix_env && (strlen(prefix_env) > 0) ? prefix_env : file_dirname, base_filename, (uint64_t)st.st_ino); + prefix_env && (strlen(prefix_env) > 0) ? prefix_env : file_dirname, base_filename, + (uint64_t)st.st_ino); if (NULL == (config_file = fopen(tmp_filename, "r"))) { if (ENOENT == errno) { From 653f3d01ae34d17626e6ea74c5fd733e419b30ea Mon Sep 17 00:00:00 2001 From: Glenn Song Date: Fri, 15 Mar 2024 13:01:37 -0500 Subject: [PATCH 09/20] Test empty subfiling environment variables --- testpar/t_subfiling_vfd.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/testpar/t_subfiling_vfd.c b/testpar/t_subfiling_vfd.c index 2ebb0e41961..be42e689d61 100644 --- a/testpar/t_subfiling_vfd.c +++ b/testpar/t_subfiling_vfd.c @@ -3237,6 +3237,43 @@ main(int argc, char **argv) SKIPPED(); #endif + if (MAINPROCESS) + printf("\nRe-running tests with environment variables set to the empty string\n"); + + char* subfiling_subfile_prefix_saved = getenv("H5FD_SUBFILING_SUBFILE_PREFIX"); + char* subfiling_ioc_selection_criteria_saved = getenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA"); + char* subfiling_ioc_per_node_saved = getenv("H5FD_SUBFILING_IOC_PER_NODE"); + char* subfiling_stripe_size_saved = getenv("H5FD_SUBFILING_STRIPE_SIZE"); + char* subfiling_config_file_prefix_saved = getenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX"); + + HDsetenv("H5FD_SUBFILING_SUBFILE_PREFIX", "", 1); + HDsetenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA", "", 1); + HDsetenv("H5FD_SUBFILING_IOC_PER_NODE", "", 1); + HDsetenv("H5FD_SUBFILING_STRIPE_SIZE", "", 1); + HDsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX", "", 1); + + for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { + if (MPI_SUCCESS == (mpi_code_g = MPI_Barrier(comm_g))) { + (*tests[i])(); + } + else { + if (MAINPROCESS) + MESG("MPI_Barrier failed"); + nerrors++; + } + } + + HDunsetenv("H5FD_SUBFILING_SUBFILE_PREFIX"); + HDunsetenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA"); + HDunsetenv("H5FD_SUBFILING_IOC_PER_NODE"); + HDunsetenv("H5FD_SUBFILING_STRIPE_SIZE"); + HDunsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX"); + HDsetenv("H5FD_SUBFILING_SUBFILE_PREFIX", subfiling_subfile_prefix_saved, 1); + HDsetenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA", subfiling_ioc_selection_criteria_saved, 1); + HDsetenv("H5FD_SUBFILING_IOC_PER_NODE", subfiling_ioc_per_node_saved, 1); + HDsetenv("H5FD_SUBFILING_STRIPE_SIZE", subfiling_stripe_size_saved, 1); + HDsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX", subfiling_config_file_prefix_saved, 1); + if (nerrors) goto exit; From bb26dfab0a175a371a89331e96da19c979e44702 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Mar 2024 18:03:22 +0000 Subject: [PATCH 10/20] Committing clang-format changes --- testpar/t_subfiling_vfd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/testpar/t_subfiling_vfd.c b/testpar/t_subfiling_vfd.c index be42e689d61..d7b1438a46d 100644 --- a/testpar/t_subfiling_vfd.c +++ b/testpar/t_subfiling_vfd.c @@ -3240,11 +3240,11 @@ main(int argc, char **argv) if (MAINPROCESS) printf("\nRe-running tests with environment variables set to the empty string\n"); - char* subfiling_subfile_prefix_saved = getenv("H5FD_SUBFILING_SUBFILE_PREFIX"); - char* subfiling_ioc_selection_criteria_saved = getenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA"); - char* subfiling_ioc_per_node_saved = getenv("H5FD_SUBFILING_IOC_PER_NODE"); - char* subfiling_stripe_size_saved = getenv("H5FD_SUBFILING_STRIPE_SIZE"); - char* subfiling_config_file_prefix_saved = getenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX"); + char *subfiling_subfile_prefix_saved = getenv("H5FD_SUBFILING_SUBFILE_PREFIX"); + char *subfiling_ioc_selection_criteria_saved = getenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA"); + char *subfiling_ioc_per_node_saved = getenv("H5FD_SUBFILING_IOC_PER_NODE"); + char *subfiling_stripe_size_saved = getenv("H5FD_SUBFILING_STRIPE_SIZE"); + char *subfiling_config_file_prefix_saved = getenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX"); HDsetenv("H5FD_SUBFILING_SUBFILE_PREFIX", "", 1); HDsetenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA", "", 1); From ea174858b6adca6b98100fce06218b97d7008cc0 Mon Sep 17 00:00:00 2001 From: Glenn Song Date: Fri, 15 Mar 2024 15:34:08 -0500 Subject: [PATCH 11/20] Add test case for t_vfd --- testpar/t_subfiling_vfd.c | 27 ++++++++++++++---- testpar/t_vfd.c | 59 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 80 insertions(+), 6 deletions(-) diff --git a/testpar/t_subfiling_vfd.c b/testpar/t_subfiling_vfd.c index d7b1438a46d..6f9f71f9888 100644 --- a/testpar/t_subfiling_vfd.c +++ b/testpar/t_subfiling_vfd.c @@ -3237,6 +3237,7 @@ main(int argc, char **argv) SKIPPED(); #endif +#if H5_HAVE_SUBFILING_VFD if (MAINPROCESS) printf("\nRe-running tests with environment variables set to the empty string\n"); @@ -3268,11 +3269,27 @@ main(int argc, char **argv) HDunsetenv("H5FD_SUBFILING_IOC_PER_NODE"); HDunsetenv("H5FD_SUBFILING_STRIPE_SIZE"); HDunsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX"); - HDsetenv("H5FD_SUBFILING_SUBFILE_PREFIX", subfiling_subfile_prefix_saved, 1); - HDsetenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA", subfiling_ioc_selection_criteria_saved, 1); - HDsetenv("H5FD_SUBFILING_IOC_PER_NODE", subfiling_ioc_per_node_saved, 1); - HDsetenv("H5FD_SUBFILING_STRIPE_SIZE", subfiling_stripe_size_saved, 1); - HDsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX", subfiling_config_file_prefix_saved, 1); + + if (subfiling_subfile_prefix_saved) { + HDsetenv("H5FD_SUBFILING_SUBFILE_PREFIX", subfiling_subfile_prefix_saved, 1); + } + if (subfiling_ioc_selection_criteria_saved) { + HDsetenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA", subfiling_ioc_selection_criteria_saved, 1); + } + if (subfiling_ioc_per_node_saved) { + HDsetenv("H5FD_SUBFILING_IOC_PER_NODE", subfiling_ioc_per_node_saved, 1); + } + if (subfiling_stripe_size_saved) { + HDsetenv("H5FD_SUBFILING_STRIPE_SIZE", subfiling_stripe_size_saved, 1); + } + if(subfiling_config_file_prefix_saved) { + HDsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX", subfiling_config_file_prefix_saved, 1); + } + +#else + if (MAINPROCESS) + SKIPPED(); +#endif if (nerrors) goto exit; diff --git a/testpar/t_vfd.c b/testpar/t_vfd.c index cce5cf775e8..ecf863ac68c 100644 --- a/testpar/t_vfd.c +++ b/testpar/t_vfd.c @@ -6187,11 +6187,16 @@ main(int argc, char **argv) #ifdef H5_HAVE_SUBFILING_VFD int required = MPI_THREAD_MULTIPLE; int provided = 0; + char *subfiling_subfile_prefix_saved = getenv("H5FD_SUBFILING_SUBFILE_PREFIX"); + char *subfiling_ioc_selection_criteria_saved = getenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA"); + char *subfiling_ioc_per_node_saved = getenv("H5FD_SUBFILING_IOC_PER_NODE"); + char *subfiling_stripe_size_saved = getenv("H5FD_SUBFILING_STRIPE_SIZE"); + char *subfiling_config_file_prefix_saved = getenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX"); #endif int mpi_size; int mpi_rank = 0; int ret; - + #ifdef H5_HAVE_SUBFILING_VFD if (MPI_SUCCESS != MPI_Init_thread(&argc, &argv, required, &provided)) { printf(" MPI doesn't support MPI_Init_thread with MPI_THREAD_MULTIPLE. Exiting\n"); @@ -6250,6 +6255,58 @@ main(int argc, char **argv) test_vector_io(mpi_rank, mpi_size); + if (mpi_rank == 0) + printf("\n --- TESTING SUBFILING VFD: environment variables set to empty --- \n"); + + HDsetenv("H5FD_SUBFILING_SUBFILE_PREFIX", "", 1); + HDsetenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA", "", 1); + HDsetenv("H5FD_SUBFILING_IOC_PER_NODE", "", 1); + HDsetenv("H5FD_SUBFILING_STRIPE_SIZE", "", 1); + HDsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX", "", 1); + + MPI_Barrier(comm); + + if (mpi_rank == 0) + printf("\n --- TESTING MPIO VFD: selection I/O --- \n"); + + test_selection_io(mpi_rank, mpi_size); + + if (mpi_rank == 0) + printf("\n --- TESTING MPIO VFD: vector I/O --- \n"); + + if (mpi_size < 2) { + if (mpi_rank == 0) { + printf(" Need at least 2 processes to run tests for vector I/O."); + SKIPPED(); + } + printf("\n"); + goto finish; + } + + test_vector_io(mpi_rank, mpi_size); + + HDunsetenv("H5FD_SUBFILING_SUBFILE_PREFIX"); + HDunsetenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA"); + HDunsetenv("H5FD_SUBFILING_IOC_PER_NODE"); + HDunsetenv("H5FD_SUBFILING_STRIPE_SIZE"); + HDunsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX"); + + if (subfiling_subfile_prefix_saved) { + HDsetenv("H5FD_SUBFILING_SUBFILE_PREFIX", subfiling_subfile_prefix_saved, 1); + } + if (subfiling_ioc_selection_criteria_saved) { + HDsetenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA", subfiling_ioc_selection_criteria_saved, 1); + } + if (subfiling_ioc_per_node_saved) { + HDsetenv("H5FD_SUBFILING_IOC_PER_NODE", subfiling_ioc_per_node_saved, 1); + } + if (subfiling_stripe_size_saved) { + HDsetenv("H5FD_SUBFILING_STRIPE_SIZE", subfiling_stripe_size_saved, 1); + } + if(subfiling_config_file_prefix_saved) { + HDsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX", subfiling_config_file_prefix_saved, 1); + } + finish: /* make sure all processes are finished before final report, cleanup * and exit. From 03d6798a604f84af947c3883390fe3bcb27c344d Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Mar 2024 20:35:56 +0000 Subject: [PATCH 12/20] Committing clang-format changes --- testpar/t_subfiling_vfd.c | 2 +- testpar/t_vfd.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/testpar/t_subfiling_vfd.c b/testpar/t_subfiling_vfd.c index 6f9f71f9888..06b108efded 100644 --- a/testpar/t_subfiling_vfd.c +++ b/testpar/t_subfiling_vfd.c @@ -3282,7 +3282,7 @@ main(int argc, char **argv) if (subfiling_stripe_size_saved) { HDsetenv("H5FD_SUBFILING_STRIPE_SIZE", subfiling_stripe_size_saved, 1); } - if(subfiling_config_file_prefix_saved) { + if (subfiling_config_file_prefix_saved) { HDsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX", subfiling_config_file_prefix_saved, 1); } diff --git a/testpar/t_vfd.c b/testpar/t_vfd.c index ecf863ac68c..5b2fbc6c8c7 100644 --- a/testpar/t_vfd.c +++ b/testpar/t_vfd.c @@ -6185,8 +6185,8 @@ main(int argc, char **argv) { #ifdef H5_HAVE_SUBFILING_VFD - int required = MPI_THREAD_MULTIPLE; - int provided = 0; + int required = MPI_THREAD_MULTIPLE; + int provided = 0; char *subfiling_subfile_prefix_saved = getenv("H5FD_SUBFILING_SUBFILE_PREFIX"); char *subfiling_ioc_selection_criteria_saved = getenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA"); char *subfiling_ioc_per_node_saved = getenv("H5FD_SUBFILING_IOC_PER_NODE"); @@ -6196,7 +6196,7 @@ main(int argc, char **argv) int mpi_size; int mpi_rank = 0; int ret; - + #ifdef H5_HAVE_SUBFILING_VFD if (MPI_SUCCESS != MPI_Init_thread(&argc, &argv, required, &provided)) { printf(" MPI doesn't support MPI_Init_thread with MPI_THREAD_MULTIPLE. Exiting\n"); @@ -6257,7 +6257,7 @@ main(int argc, char **argv) if (mpi_rank == 0) printf("\n --- TESTING SUBFILING VFD: environment variables set to empty --- \n"); - + HDsetenv("H5FD_SUBFILING_SUBFILE_PREFIX", "", 1); HDsetenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA", "", 1); HDsetenv("H5FD_SUBFILING_IOC_PER_NODE", "", 1); @@ -6303,7 +6303,7 @@ main(int argc, char **argv) if (subfiling_stripe_size_saved) { HDsetenv("H5FD_SUBFILING_STRIPE_SIZE", subfiling_stripe_size_saved, 1); } - if(subfiling_config_file_prefix_saved) { + if (subfiling_config_file_prefix_saved) { HDsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX", subfiling_config_file_prefix_saved, 1); } From 4dd9238ae59ca24b5cc598621bb479ff73337e96 Mon Sep 17 00:00:00 2001 From: Glenn Song Date: Fri, 15 Mar 2024 18:06:36 -0500 Subject: [PATCH 13/20] Fixes --- testpar/t_subfiling_vfd.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/testpar/t_subfiling_vfd.c b/testpar/t_subfiling_vfd.c index 6f9f71f9888..f287dd11308 100644 --- a/testpar/t_subfiling_vfd.c +++ b/testpar/t_subfiling_vfd.c @@ -2892,6 +2892,11 @@ main(int argc, char **argv) bool must_unset_config_dir_env = false; int required = MPI_THREAD_MULTIPLE; int provided = 0; + char *subfiling_subfile_prefix_saved; + char *subfiling_ioc_selection_criteria_saved; + char *subfiling_ioc_per_node_saved; + char *subfiling_stripe_size_saved; + char *subfiling_config_file_prefix_saved; HDcompile_assert(SUBFILING_MIN_STRIPE_SIZE <= H5FD_SUBFILING_DEFAULT_STRIPE_SIZE); @@ -3237,22 +3242,33 @@ main(int argc, char **argv) SKIPPED(); #endif -#if H5_HAVE_SUBFILING_VFD if (MAINPROCESS) printf("\nRe-running tests with environment variables set to the empty string\n"); - char *subfiling_subfile_prefix_saved = getenv("H5FD_SUBFILING_SUBFILE_PREFIX"); - char *subfiling_ioc_selection_criteria_saved = getenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA"); - char *subfiling_ioc_per_node_saved = getenv("H5FD_SUBFILING_IOC_PER_NODE"); - char *subfiling_stripe_size_saved = getenv("H5FD_SUBFILING_STRIPE_SIZE"); - char *subfiling_config_file_prefix_saved = getenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX"); - + subfiling_subfile_prefix_saved = getenv("H5FD_SUBFILING_SUBFILE_PREFIX"); + subfiling_ioc_selection_criteria_saved = getenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA"); + subfiling_ioc_per_node_saved = getenv("H5FD_SUBFILING_IOC_PER_NODE"); + subfiling_stripe_size_saved = getenv("H5FD_SUBFILING_STRIPE_SIZE"); + subfiling_config_file_prefix_saved = getenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX"); + HDsetenv("H5FD_SUBFILING_SUBFILE_PREFIX", "", 1); HDsetenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA", "", 1); HDsetenv("H5FD_SUBFILING_IOC_PER_NODE", "", 1); HDsetenv("H5FD_SUBFILING_STRIPE_SIZE", "", 1); HDsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX", "", 1); + /* Grab values from environment variables if set */ + parse_subfiling_env_vars(); + + /* + * Assume that we use the "one IOC per node" selection + * strategy by default, with a possibly modified + * number of IOCs per node value + */ + num_iocs_g = (ioc_per_node_g > 0) ? (int)ioc_per_node_g * num_nodes_g : num_nodes_g; + if (num_iocs_g > mpi_size) + num_iocs_g = mpi_size; + for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { if (MPI_SUCCESS == (mpi_code_g = MPI_Barrier(comm_g))) { (*tests[i])(); @@ -3282,15 +3298,10 @@ main(int argc, char **argv) if (subfiling_stripe_size_saved) { HDsetenv("H5FD_SUBFILING_STRIPE_SIZE", subfiling_stripe_size_saved, 1); } - if(subfiling_config_file_prefix_saved) { + if (subfiling_config_file_prefix_saved) { HDsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX", subfiling_config_file_prefix_saved, 1); } -#else - if (MAINPROCESS) - SKIPPED(); -#endif - if (nerrors) goto exit; From a5961874b853816654ea8a79f906953cb129cf51 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Mar 2024 23:09:49 +0000 Subject: [PATCH 14/20] Committing clang-format changes --- testpar/t_subfiling_vfd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/testpar/t_subfiling_vfd.c b/testpar/t_subfiling_vfd.c index f287dd11308..db03e09c59c 100644 --- a/testpar/t_subfiling_vfd.c +++ b/testpar/t_subfiling_vfd.c @@ -2892,11 +2892,11 @@ main(int argc, char **argv) bool must_unset_config_dir_env = false; int required = MPI_THREAD_MULTIPLE; int provided = 0; - char *subfiling_subfile_prefix_saved; - char *subfiling_ioc_selection_criteria_saved; - char *subfiling_ioc_per_node_saved; - char *subfiling_stripe_size_saved; - char *subfiling_config_file_prefix_saved; + char *subfiling_subfile_prefix_saved; + char *subfiling_ioc_selection_criteria_saved; + char *subfiling_ioc_per_node_saved; + char *subfiling_stripe_size_saved; + char *subfiling_config_file_prefix_saved; HDcompile_assert(SUBFILING_MIN_STRIPE_SIZE <= H5FD_SUBFILING_DEFAULT_STRIPE_SIZE); @@ -3250,7 +3250,7 @@ main(int argc, char **argv) subfiling_ioc_per_node_saved = getenv("H5FD_SUBFILING_IOC_PER_NODE"); subfiling_stripe_size_saved = getenv("H5FD_SUBFILING_STRIPE_SIZE"); subfiling_config_file_prefix_saved = getenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX"); - + HDsetenv("H5FD_SUBFILING_SUBFILE_PREFIX", "", 1); HDsetenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA", "", 1); HDsetenv("H5FD_SUBFILING_IOC_PER_NODE", "", 1); From ee7bb7839dc3a85c6ef89a653b6e13f30bf3c648 Mon Sep 17 00:00:00 2001 From: Glenn Song Date: Fri, 15 Mar 2024 18:24:41 -0500 Subject: [PATCH 15/20] Fixes --- testpar/t_vfd.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/testpar/t_vfd.c b/testpar/t_vfd.c index 5b2fbc6c8c7..54d9452677f 100644 --- a/testpar/t_vfd.c +++ b/testpar/t_vfd.c @@ -6187,11 +6187,11 @@ main(int argc, char **argv) #ifdef H5_HAVE_SUBFILING_VFD int required = MPI_THREAD_MULTIPLE; int provided = 0; - char *subfiling_subfile_prefix_saved = getenv("H5FD_SUBFILING_SUBFILE_PREFIX"); - char *subfiling_ioc_selection_criteria_saved = getenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA"); - char *subfiling_ioc_per_node_saved = getenv("H5FD_SUBFILING_IOC_PER_NODE"); - char *subfiling_stripe_size_saved = getenv("H5FD_SUBFILING_STRIPE_SIZE"); - char *subfiling_config_file_prefix_saved = getenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX"); + char *subfiling_subfile_prefix_saved; + char *subfiling_ioc_selection_criteria_saved; + char *subfiling_ioc_per_node_saved; + char *subfiling_stripe_size_saved; + char *subfiling_config_file_prefix_saved; #endif int mpi_size; int mpi_rank = 0; @@ -6255,9 +6255,17 @@ main(int argc, char **argv) test_vector_io(mpi_rank, mpi_size); +#ifdef H5_HAVE_SUBFILING_VFD + if (mpi_rank == 0) printf("\n --- TESTING SUBFILING VFD: environment variables set to empty --- \n"); + subfiling_subfile_prefix_saved = getenv("H5FD_SUBFILING_SUBFILE_PREFIX"); + subfiling_ioc_selection_criteria_saved = getenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA"); + subfiling_ioc_per_node_saved = getenv("H5FD_SUBFILING_IOC_PER_NODE"); + subfiling_stripe_size_saved = getenv("H5FD_SUBFILING_STRIPE_SIZE"); + subfiling_config_file_prefix_saved = getenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX"); + HDsetenv("H5FD_SUBFILING_SUBFILE_PREFIX", "", 1); HDsetenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA", "", 1); HDsetenv("H5FD_SUBFILING_IOC_PER_NODE", "", 1); @@ -6307,6 +6315,8 @@ main(int argc, char **argv) HDsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX", subfiling_config_file_prefix_saved, 1); } +#endif + finish: /* make sure all processes are finished before final report, cleanup * and exit. From dd5c68705d44d7011ac5916c50886eed8261d4fc Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Mar 2024 23:26:29 +0000 Subject: [PATCH 16/20] Committing clang-format changes --- testpar/t_vfd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testpar/t_vfd.c b/testpar/t_vfd.c index 54d9452677f..0cd5583936c 100644 --- a/testpar/t_vfd.c +++ b/testpar/t_vfd.c @@ -6185,8 +6185,8 @@ main(int argc, char **argv) { #ifdef H5_HAVE_SUBFILING_VFD - int required = MPI_THREAD_MULTIPLE; - int provided = 0; + int required = MPI_THREAD_MULTIPLE; + int provided = 0; char *subfiling_subfile_prefix_saved; char *subfiling_ioc_selection_criteria_saved; char *subfiling_ioc_per_node_saved; From 62e71a687e3127f43063293e33edf02f3b71b9c9 Mon Sep 17 00:00:00 2001 From: Glenn Song Date: Tue, 19 Mar 2024 08:26:58 -0700 Subject: [PATCH 17/20] Fix for Quincey/Jordan --- testpar/t_vfd.c | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/testpar/t_vfd.c b/testpar/t_vfd.c index 0cd5583936c..029d61b0cee 100644 --- a/testpar/t_vfd.c +++ b/testpar/t_vfd.c @@ -6187,11 +6187,6 @@ main(int argc, char **argv) #ifdef H5_HAVE_SUBFILING_VFD int required = MPI_THREAD_MULTIPLE; int provided = 0; - char *subfiling_subfile_prefix_saved; - char *subfiling_ioc_selection_criteria_saved; - char *subfiling_ioc_per_node_saved; - char *subfiling_stripe_size_saved; - char *subfiling_config_file_prefix_saved; #endif int mpi_size; int mpi_rank = 0; @@ -6260,12 +6255,6 @@ main(int argc, char **argv) if (mpi_rank == 0) printf("\n --- TESTING SUBFILING VFD: environment variables set to empty --- \n"); - subfiling_subfile_prefix_saved = getenv("H5FD_SUBFILING_SUBFILE_PREFIX"); - subfiling_ioc_selection_criteria_saved = getenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA"); - subfiling_ioc_per_node_saved = getenv("H5FD_SUBFILING_IOC_PER_NODE"); - subfiling_stripe_size_saved = getenv("H5FD_SUBFILING_STRIPE_SIZE"); - subfiling_config_file_prefix_saved = getenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX"); - HDsetenv("H5FD_SUBFILING_SUBFILE_PREFIX", "", 1); HDsetenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA", "", 1); HDsetenv("H5FD_SUBFILING_IOC_PER_NODE", "", 1); @@ -6299,22 +6288,6 @@ main(int argc, char **argv) HDunsetenv("H5FD_SUBFILING_STRIPE_SIZE"); HDunsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX"); - if (subfiling_subfile_prefix_saved) { - HDsetenv("H5FD_SUBFILING_SUBFILE_PREFIX", subfiling_subfile_prefix_saved, 1); - } - if (subfiling_ioc_selection_criteria_saved) { - HDsetenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA", subfiling_ioc_selection_criteria_saved, 1); - } - if (subfiling_ioc_per_node_saved) { - HDsetenv("H5FD_SUBFILING_IOC_PER_NODE", subfiling_ioc_per_node_saved, 1); - } - if (subfiling_stripe_size_saved) { - HDsetenv("H5FD_SUBFILING_STRIPE_SIZE", subfiling_stripe_size_saved, 1); - } - if (subfiling_config_file_prefix_saved) { - HDsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX", subfiling_config_file_prefix_saved, 1); - } - #endif finish: From 10c6aaf2644b1f62cc4ac93b038196b0dd906e18 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 19 Mar 2024 15:38:02 +0000 Subject: [PATCH 18/20] Committing clang-format changes --- testpar/t_vfd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testpar/t_vfd.c b/testpar/t_vfd.c index 029d61b0cee..9faf1dbe7e8 100644 --- a/testpar/t_vfd.c +++ b/testpar/t_vfd.c @@ -6185,8 +6185,8 @@ main(int argc, char **argv) { #ifdef H5_HAVE_SUBFILING_VFD - int required = MPI_THREAD_MULTIPLE; - int provided = 0; + int required = MPI_THREAD_MULTIPLE; + int provided = 0; #endif int mpi_size; int mpi_rank = 0; From ccd929968a413d9236a1805e6022dcf355363e16 Mon Sep 17 00:00:00 2001 From: Glenn Song Date: Tue, 19 Mar 2024 09:39:34 -0700 Subject: [PATCH 19/20] Remove saving env var code --- testpar/t_subfiling_vfd.c | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/testpar/t_subfiling_vfd.c b/testpar/t_subfiling_vfd.c index db03e09c59c..66b0c1762bc 100644 --- a/testpar/t_subfiling_vfd.c +++ b/testpar/t_subfiling_vfd.c @@ -2892,12 +2892,7 @@ main(int argc, char **argv) bool must_unset_config_dir_env = false; int required = MPI_THREAD_MULTIPLE; int provided = 0; - char *subfiling_subfile_prefix_saved; - char *subfiling_ioc_selection_criteria_saved; - char *subfiling_ioc_per_node_saved; - char *subfiling_stripe_size_saved; - char *subfiling_config_file_prefix_saved; - + HDcompile_assert(SUBFILING_MIN_STRIPE_SIZE <= H5FD_SUBFILING_DEFAULT_STRIPE_SIZE); /* Initialize MPI */ @@ -3245,12 +3240,6 @@ main(int argc, char **argv) if (MAINPROCESS) printf("\nRe-running tests with environment variables set to the empty string\n"); - subfiling_subfile_prefix_saved = getenv("H5FD_SUBFILING_SUBFILE_PREFIX"); - subfiling_ioc_selection_criteria_saved = getenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA"); - subfiling_ioc_per_node_saved = getenv("H5FD_SUBFILING_IOC_PER_NODE"); - subfiling_stripe_size_saved = getenv("H5FD_SUBFILING_STRIPE_SIZE"); - subfiling_config_file_prefix_saved = getenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX"); - HDsetenv("H5FD_SUBFILING_SUBFILE_PREFIX", "", 1); HDsetenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA", "", 1); HDsetenv("H5FD_SUBFILING_IOC_PER_NODE", "", 1); @@ -3286,22 +3275,6 @@ main(int argc, char **argv) HDunsetenv("H5FD_SUBFILING_STRIPE_SIZE"); HDunsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX"); - if (subfiling_subfile_prefix_saved) { - HDsetenv("H5FD_SUBFILING_SUBFILE_PREFIX", subfiling_subfile_prefix_saved, 1); - } - if (subfiling_ioc_selection_criteria_saved) { - HDsetenv("H5FD_SUBFILING_IOC_SELECTION_CRITERIA", subfiling_ioc_selection_criteria_saved, 1); - } - if (subfiling_ioc_per_node_saved) { - HDsetenv("H5FD_SUBFILING_IOC_PER_NODE", subfiling_ioc_per_node_saved, 1); - } - if (subfiling_stripe_size_saved) { - HDsetenv("H5FD_SUBFILING_STRIPE_SIZE", subfiling_stripe_size_saved, 1); - } - if (subfiling_config_file_prefix_saved) { - HDsetenv("H5FD_SUBFILING_CONFIG_FILE_PREFIX", subfiling_config_file_prefix_saved, 1); - } - if (nerrors) goto exit; From 329ba1275e93971f5c991f92484d420ef1279fe3 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 19 Mar 2024 16:41:41 +0000 Subject: [PATCH 20/20] Committing clang-format changes --- testpar/t_subfiling_vfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testpar/t_subfiling_vfd.c b/testpar/t_subfiling_vfd.c index 66b0c1762bc..b0628033222 100644 --- a/testpar/t_subfiling_vfd.c +++ b/testpar/t_subfiling_vfd.c @@ -2892,7 +2892,7 @@ main(int argc, char **argv) bool must_unset_config_dir_env = false; int required = MPI_THREAD_MULTIPLE; int provided = 0; - + HDcompile_assert(SUBFILING_MIN_STRIPE_SIZE <= H5FD_SUBFILING_DEFAULT_STRIPE_SIZE); /* Initialize MPI */