diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 460153328da..d1f28620141 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -629,6 +629,13 @@ h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info) * * Currently, driver configuration strings are unsupported. */ +#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_SUBFILING_VFD) + if (vfd_info->u.value == H5_VFD_SUBFILING) { + if (H5Pset_fapl_subfiling(fapl_id, + (const H5FD_subfiling_config_t *)vfd_info->info) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_subfiling() failed"); + } +#endif if (H5Pset_driver_by_value(fapl_id, vfd_info->u.value, (const char *)vfd_info->info) < 0) H5TOOLS_GOTO_ERROR(FAIL, "can't load VFD plugin by driver value '%ld'", (long int)vfd_info->u.value); diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index cf296dbcb5b..4b08d1cf474 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -149,7 +149,7 @@ static struct h5_long_options l_opts[] = {{"attribute", require_arg, 'a'}, {"vfd-name", require_arg, '5'}, {"vfd-info", require_arg, '6'}, {NULL, 0, '\0'}}; - +static int mpi_code_g; /*------------------------------------------------------------------------- * Function: leave * @@ -886,7 +886,12 @@ parse_command_line(int argc, const char *const *argv) if (!vfd_info_g.info) vfd_info_g.info = &hdfs_fa_g; #endif - +#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_SUBFILING_VFD) + fprintf(stderr, "vfd_info_g.u.name=%s\n", vfd_info_g.u.name); + if (0 == strcmp(vfd_info_g.u.name, drivernames[SUBFILING_VFD_IDX])) { + set_mpi(argc, argv); + } +#endif break; case 'g': dump_opts.display_all = 0; @@ -1214,12 +1219,24 @@ parse_command_line(int argc, const char *const *argv) case '4': vfd_info_g.type = VFD_BY_VALUE; vfd_info_g.u.value = (H5FD_class_value_t)atoi(H5_optarg); + +#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_SUBFILING_VFD) + if (vfd_info_g.u.value == H5_VFD_SUBFILING) { + set_mpi(argc, argv); + } +#endif use_custom_vfd_g = true; break; case '5': vfd_info_g.type = VFD_BY_NAME; vfd_info_g.u.name = H5_optarg; +#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_SUBFILING_VFD) + fprintf(stderr, "vfd_info_g.u.name=%s\n", vfd_info_g.u.name); + if (0 == strcmp(vfd_info_g.u.name, drivernames[SUBFILING_VFD_IDX])) { + set_mpi(argc, argv); + } +#endif use_custom_vfd_g = true; break; @@ -1234,8 +1251,10 @@ parse_command_line(int argc, const char *const *argv) } } + /* If the file uses the onion VFD, get the revision number */ - if (vfd_info_g.type == VFD_BY_NAME && vfd_info_g.u.name && !strcmp(vfd_info_g.u.name, "onion")) { + if (vfd_info_g.type == VFD_BY_NAME && + vfd_info_g.u.name && !strcmp(vfd_info_g.u.name, "onion")) { if (vfd_info_g.info) { if (!strcmp(vfd_info_g.info, "revision_count")) @@ -1257,6 +1276,7 @@ parse_command_line(int argc, const char *const *argv) vfd_info_g.info = &onion_fa_g; } + parse_end: /* check for file name to be processed */ if (argc <= H5_optind) { @@ -1277,6 +1297,24 @@ parse_command_line(int argc, const char *const *argv) return hand; } +#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_SUBFILING_VFD) +int +set_mpi(argc, argv) +{ + int required = MPI_THREAD_MULTIPLE; + int provided = 0; + + /* Initialize MPI */ + mpi_code_g = MPI_Init_thread(&argc, &argv, required, &provided); + if (MPI_SUCCESS != mpi_code_g) { + printf("MPI_Init_thread failed with error code %d\n", mpi_code_g); + return 1; + } + + return 0; +} +#endif + /*------------------------------------------------------------------------- * Function: main * @@ -1358,13 +1396,14 @@ main(int argc, char *argv[]) goto done; } - /* Enable error reporting if --enable-error-stack command line option is specified */ + /* enable error reporting if command line option */ h5tools_error_report(); /* Initialize indexing options */ h5trav_set_index(sort_by, sort_order); if (use_custom_vol_g || use_custom_vfd_g) { + if ((fapl_id = h5tools_get_fapl(H5P_DEFAULT, use_custom_vol_g ? &vol_info_g : NULL, use_custom_vfd_g ? &vfd_info_g : NULL)) < 0) { error_msg("unable to create FAPL for file access\n"); @@ -1602,6 +1641,9 @@ main(int argc, char *argv[]) /* To Do: clean up XML table */ leave(h5tools_getstatus()); +#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_SUBFILING_VFD) + MPI_Finalize(); +#endif } /* main */ /*-------------------------------------------------------------------------