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

Preserve MPI-I/O file hints when fapl is closed #3755

Merged
merged 12 commits into from
Oct 25, 2023
Merged
Changes from 1 commit
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
25 changes: 24 additions & 1 deletion testpar/t_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1131,8 +1131,16 @@ test_fapl_preserve_hints(void)
hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
hid_t fapl_id = H5I_INVALID_HID; /* File access plist */
const char *filename;

MPI_Info info = MPI_INFO_NULL;
const char *key = "hdf_info_fapl";
const char *value = "xyz";

MPI_Info info_used = MPI_INFO_NULL;
int flag = -1;
char value_used[20];
char key_used[20];

herr_t ret; /* Generic return value */
int mpi_ret; /* MPI return value */

Expand All @@ -1142,7 +1150,7 @@ test_fapl_preserve_hints(void)
mpi_ret = MPI_Info_create(&info);
VRFY((mpi_ret >= 0), "MPI_Info_create succeeded");

mpi_ret = MPI_Info_set(info, "hdf_info_fapl", "true");
mpi_ret = MPI_Info_set(info, key, value);
VRFY((mpi_ret == MPI_SUCCESS), "MPI_Info_set succeeded");

fapl_id = H5Pcreate(H5P_FILE_ACCESS);
Expand All @@ -1165,6 +1173,21 @@ test_fapl_preserve_hints(void)

VRFY((info_used != MPI_INFO_NULL), "H5Pget_fapl_mpio");

memset(key_used, 0, 20);
memset(value_used, 0, 20);

mpi_ret = MPI_Info_get_nthkey(info_used, 0, key_used);
VRFY((mpi_ret == MPI_SUCCESS), "MPI_Info_get_nthkey succeeded");

mpi_ret = MPI_Info_get(info_used, key_used, 20, value_used, &flag);
VRFY((mpi_ret == MPI_SUCCESS), "MPI_Info_get succeeded");

ret = strcmp(key_used, key);
VRFY(ret == 0, "strcmp key");

ret = strcmp(value_used, value);
VRFY(ret == 0, "strcmp value");
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe these changes are fine, but there's a possibility this test may fail depending on whether MPI keys come exactly in the order they were set on the Info object. Otherwise, the MPI I/O VFD has code to get any info set by the MPI implementation after an MPI_File_open call and then set that back on the FAPL (https://github.com/HDFGroup/hdf5/blob/develop/src/H5FDmpio.c#L892-L934)

Copy link
Collaborator

Choose a reason for hiding this comment

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

It may be best to call MPI_Info_get_nkeys and then loop through all the keys, checking to see if any of them match the hint we set here and then failing if none match

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will change that based on MPI_Info_get_nkeys.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


ret = H5Pclose(fapl_id);
VRFY((ret >= 0), "H5Pclose succeeded");

Expand Down