Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support h5dump command line options for subfiling VFD #3880

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 52 additions & 4 deletions tools/src/h5dump/h5dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,29 @@ static struct h5_long_options l_opts[] = {{"attribute", require_arg, 'a'},
{"vfd-info", require_arg, '6'},
{NULL, 0, '\0'}};

#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_SUBFILING_VFD)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than needing to call MPI_Init in every serial tool that wants to support parallel VFDs/VOL connectors, I think it makes more sense to remove the check for whether MPI is initialized in the tools library and then document that a parallel VFD or VOL connector should initialize MPI itself if it needs it and it wasn't already initialized. However, this assumes that systems which were previously broken in this regard (Theta IIRC) are no longer problematic due to the tools trying to open a file with any available VFD when the first attempt fails. In fact, it may even be appropriate to remove that functionality from the tools at this point.

Regardless, we shouldn't generally have functionality in the tools with an #ifdef for a particular VFD.

static int mpi_code_g = MPI_ERR_OTHER;
static int use_subfiling_vfd_g = false;
static int
set_mpi(int argc, char *argv[])
{
int required = MPI_THREAD_MULTIPLE;
int provided = 0;
int mpi_initialized;

MPI_Initialized(&mpi_initialized);
/* Initialize MPI */
if (!mpi_initialized) {
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: leave
*
Expand All @@ -161,7 +184,11 @@ static void
leave(int ret)
{
h5tools_close();

#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_SUBFILING_VFD)
if (MPI_SUCCESS == mpi_code_g) {
MPI_Finalize();
}
#endif
exit(ret);
}

Expand Down Expand Up @@ -885,7 +912,11 @@ 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)
if (0 == strcmp(vfd_info_g.u.name, drivernames[SUBFILING_VFD_IDX])) {
use_subfiling_vfd_g = true;
}
#endif
break;
case 'g':
dump_opts.display_all = 0;
Expand Down Expand Up @@ -1213,13 +1244,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);
use_custom_vfd_g = true;

#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_SUBFILING_VFD)
if (vfd_info_g.u.value == H5_VFD_SUBFILING) {
use_subfiling_vfd_g = true;
}
#endif
use_custom_vfd_g = true;
break;

case '5':
vfd_info_g.type = VFD_BY_NAME;
vfd_info_g.u.name = H5_optarg;
use_custom_vfd_g = true;
#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_SUBFILING_VFD)
if (0 == strcmp(vfd_info_g.u.name, drivernames[SUBFILING_VFD_IDX])) {
use_subfiling_vfd_g = true;
}
#endif
use_custom_vfd_g = true;
break;

case '6':
Expand Down Expand Up @@ -1363,6 +1405,12 @@ main(int argc, char *argv[])
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);

#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_SUBFILING_VFD)
if (use_subfiling_vfd_g) {
set_mpi(argc, argv);
}
#endif

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) {
Expand Down