diff options
author | jhendersonHDF <jhenderson@hdfgroup.org> | 2021-02-17 12:37:23 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-17 12:37:23 (GMT) |
commit | afdb7903c644ef8eab44a66248b85ce9bed60db8 (patch) | |
tree | f93fb1f558ad2cc972b81345f4bd8fbe45dbbb20 /src | |
parent | 2359a9b020761efd83b8a493b12f40b8a9696000 (diff) | |
download | hdf5-afdb7903c644ef8eab44a66248b85ce9bed60db8.zip hdf5-afdb7903c644ef8eab44a66248b85ce9bed60db8.tar.gz hdf5-afdb7903c644ef8eab44a66248b85ce9bed60db8.tar.bz2 |
Fix for HDFFV-11109 - Copy MPI comm and info object into output FAPL from H5F_get_access_plist (#342)
* Avoid freeing MPI_COMM_WORLD in H5_mpi_comm_free
* Copy MPI Comm and Info to new FAPL in H5F_get_access_plist
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Fint.c | 28 | ||||
-rw-r--r-- | src/H5mpi.c | 2 |
2 files changed, 23 insertions, 7 deletions
diff --git a/src/H5Fint.c b/src/H5Fint.c index 67245d5..272f060 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -413,24 +413,40 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) if (f->shared->efc) efc_size = H5F__efc_max_nfiles(f->shared->efc); if (H5P_set(new_plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set elink file cache size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set elink file cache size") if (f->shared->page_buf != NULL) { if (H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &(f->shared->page_buf->max_size)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set page buffer size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set page buffer size") if (H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &(f->shared->page_buf->min_meta_perc)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set minimum metadata fraction of page buffer") if (H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &(f->shared->page_buf->min_raw_perc)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set minimum raw data fraction of page buffer") } /* end if */ #ifdef H5_HAVE_PARALLEL if (H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->shared->coll_md_read)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read flag") if (H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->shared->coll_md_write)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read flag") + if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + MPI_Comm mpi_comm; + MPI_Info mpi_info; + + /* Retrieve and set MPI communicator */ + if (MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(f))) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get MPI communicator") + if (H5P_set(new_plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &mpi_comm) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set MPI communicator") + + /* Retrieve and set MPI info object */ + if (H5P_get(old_plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &mpi_info) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get MPI info object") + if (H5P_set(new_plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &mpi_info) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set MPI info object") + } #endif /* H5_HAVE_PARALLEL */ if (H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0) diff --git a/src/H5mpi.c b/src/H5mpi.c index 613a4bf..1c2d3b7 100644 --- a/src/H5mpi.c +++ b/src/H5mpi.c @@ -210,7 +210,7 @@ H5_mpi_comm_free(MPI_Comm *comm) HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "comm pointer cannot be NULL") /* Free the communicator */ - if (MPI_COMM_NULL != *comm) + if (MPI_COMM_WORLD != *comm && MPI_COMM_NULL != *comm) MPI_Comm_free(comm); *comm = MPI_COMM_NULL; |