From 4b9ee6b88b3415baa684c9a2d0fb9379f7687768 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Wed, 21 Jan 2015 16:00:22 -0500 Subject: [svn-r25996] - merge changes from trunk to eliminate usage of IS_H5FD_MPI Macro. - add 2 missing feature flags for VFDs: H5FD_FEAT_HAS_MPI & H5FD_FEAT_ALLOCATE_EARLY and use them as appropriate. tested with h5commitest --- bin/checkposix | 1 - src/H5AC.c | 2 +- src/H5C.c | 2 +- src/H5Dchunk.c | 2 +- src/H5Dcontig.c | 2 +- src/H5Dint.c | 6 +++--- src/H5Dio.c | 7 ++++--- src/H5Dmpio.c | 4 ++-- src/H5FDmpio.c | 4 +++- src/H5FDprivate.h | 8 -------- src/H5FDpublic.h | 13 ++++++++++++- src/H5Fint.c | 2 +- src/H5Fmpi.c | 8 ++++---- src/hdf5.lnt | 6 ------ test/links.c | 3 ++- 15 files changed, 35 insertions(+), 35 deletions(-) diff --git a/bin/checkposix b/bin/checkposix index 69d43b4..db47ff3 100755 --- a/bin/checkposix +++ b/bin/checkposix @@ -83,7 +83,6 @@ if(<>) { next if $name =~ /^(ABS|ADDR_OVERFLOW|ALL_MEMBERS|BOUND|CONSTR|DETECT_[I|F|M]|DOWN)$/; next if $name =~ /^(MIN3?|MAX3?|NELMTS|POWER_OF_TWO|REGION_OVERFLOW)$/; next if $name =~ /^(UNIQUE_MEMBERS)$/; - next if $name =~ /^(IS_H5FD_MPIO)$/; next if $name =~ /^addr_defined$/; # These functions/macros are exempt. diff --git a/src/H5AC.c b/src/H5AC.c index 91a49c5..42cf268 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -481,7 +481,7 @@ H5AC_create(const H5F_t *f, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad cache configuration") #ifdef H5_HAVE_PARALLEL - if(IS_H5FD_MPI(f)) { + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { MPI_Comm mpi_comm; int mpi_rank; int mpi_size; diff --git a/src/H5C.c b/src/H5C.c index fa28584..2a17da5 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -7612,7 +7612,7 @@ H5C_flush_single_entry(H5F_t * f, * otherwise as no file I/O can result. */ if(!clear_only && entry_ptr->is_dirty && - IS_H5FD_MPI(f)) { + H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { H5P_genplist_t *dxpl; /* Dataset transfer property list */ unsigned coll_meta; /* Collective metadata write flag */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 820d4b6..15846d4 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -3306,7 +3306,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, #ifdef H5_HAVE_PARALLEL /* Retrieve MPI parameters */ - if(IS_H5FD_MPI(dset->oloc.file)) { + if(H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI)) { /* Set the MPI-capable file driver flag */ using_mpi = TRUE; diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index e5012ca..8d4cd02 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -225,7 +225,7 @@ H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id) #ifdef H5_HAVE_PARALLEL /* Retrieve MPI parameters */ - if(IS_H5FD_MPI(dset->oloc.file)) { + if(H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI)) { /* Get the MPI communicator */ if(MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(dset->oloc.file))) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator") diff --git a/src/H5Dint.c b/src/H5Dint.c index a354a16..a077b37 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1026,7 +1026,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "compact dataset must have early space allocation") /* If MPI VFD is used, no filter support yet. */ - if(IS_H5FD_MPI(file) && pline->nused > 0) + if(H5F_HAS_FEATURE(file, H5FD_FEAT_HAS_MPI) && pline->nused > 0) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "Parallel I/O does not support filters yet") /* Get the dataset's external file list information */ @@ -1046,7 +1046,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, } /* end if */ /* Check if this dataset is going into a parallel file and set space allocation time */ - if(IS_H5FD_MPI(file)) + if(H5F_HAS_FEATURE(file, H5FD_FEAT_ALLOCATE_EARLY)) new_dset->shared->dcpl_cache.fill.alloc_time = H5D_ALLOC_TIME_EARLY; /* Set the dataset's I/O operations */ @@ -1328,7 +1328,7 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id) */ if((H5F_INTENT(dataset->oloc.file) & H5F_ACC_RDWR) && !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) - && IS_H5FD_MPI(dataset->oloc.file)) { + && H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_ALLOCATE_EARLY)) { if(H5D__alloc_storage(dataset, dxpl_id, H5D_ALLOC_OPEN, FALSE, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file storage") } /* end if */ diff --git a/src/H5Dio.c b/src/H5Dio.c index b0fc822..7495f7f 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -427,7 +427,8 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, #ifdef H5_HAVE_PARALLEL /* Collective access is not permissible without a MPI based VFD */ - if(dxpl_cache->xfer_mode == H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPI(dataset->oloc.file)) + if(dxpl_cache->xfer_mode == H5FD_MPIO_COLLECTIVE && + !(H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI))) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based drivers only") #endif /*H5_HAVE_PARALLEL*/ @@ -646,7 +647,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, /* Various MPI based checks */ #ifdef H5_HAVE_PARALLEL - if(IS_H5FD_MPI(dataset->oloc.file)) { + if(H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI)) { /* If MPI based VFD is used, no VL datatype support yet. */ /* This is because they use the global heap in the file and we don't */ /* support parallel access of that yet */ @@ -889,7 +890,7 @@ const #ifdef H5_HAVE_PARALLEL /* Determine if the file was opened with an MPI VFD */ - io_info->using_mpi_vfd = IS_H5FD_MPI(dset->oloc.file); + io_info->using_mpi_vfd = H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI); #endif /* H5_HAVE_PARALLEL */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 88c6075..58bcc04 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -474,7 +474,7 @@ H5D__contig_collective_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(IS_H5FD_MPIO(io_info->dset->oloc.file)); + HDassert(H5FD_MPIO == H5F_DRIVER_ID(io_info->dset->oloc.file)); HDassert(TRUE == H5P_isa_class(io_info->dxpl_id, H5P_DATASET_XFER)); /* Call generic internal collective I/O routine */ @@ -521,7 +521,7 @@ H5D__contig_collective_write(H5D_io_info_t *io_info, const H5D_type_info_t *type FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(IS_H5FD_MPIO(io_info->dset->oloc.file)); + HDassert(H5FD_MPIO == H5F_DRIVER_ID(io_info->dset->oloc.file)); HDassert(TRUE == H5P_isa_class(io_info->dxpl_id, H5P_DATASET_XFER)); /* Call generic internal collective I/O routine */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 5189939..851a962 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1213,8 +1213,10 @@ H5FD_mpio_query(const H5FD_t UNUSED *_file, unsigned long *flags /* out */) /* Set the VFL feature flags that this driver supports */ if(flags) { *flags=0; - *flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ + *flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ + *flags|=H5FD_FEAT_HAS_MPI; /* This driver uses MPI */ + *flags|=H5FD_FEAT_ALLOCATE_EARLY; /* Allocate space early instead of late */ } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 37aad3f..a11fc01 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -40,14 +40,6 @@ /* Length of filename buffer */ #define H5FD_MAX_FILENAME_LEN 1024 -/* MPI based VFDs */ -#define IS_H5FD_MPIO(f) /* (H5F_t *f) */ \ - (H5FD_MPIO==H5F_DRIVER_ID(f)) - -/* Single macro to check for all file drivers that use MPI */ -#define IS_H5FD_MPI(file) \ - (IS_H5FD_MPIO(file)) - #ifdef H5_HAVE_PARALLEL /* ======== Temporary data transfer properties ======== */ /* Definitions for memory MPI type property */ diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index f1b3920..b4c9903 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -177,6 +177,18 @@ typedef enum H5F_mem_t H5FD_mem_t; * of type 'int' and is compatible with POSIX I/O calls. */ #define H5FD_FEAT_POSIX_COMPAT_HANDLE 0x00000080 + /* + * Defining the H5FD_FEAT_HAS_MPI for a VFL driver means that + * the driver makes use of MPI communication and code may retrieve + * communicator/rank information from it + */ +#define H5FD_FEAT_HAS_MPI 0x00000100 + /* + * Defining the H5FD_FEAT_ALLOCATE_EARLY for a VFL driver will force + * the library to use the H5D_ALLOC_TIME_EARLY on dataset create + * instead of the default H5D_ALLOC_TIME_LATE + */ +#define H5FD_FEAT_ALLOCATE_EARLY 0x00000200 /* * Defining the H5FD_FEAT_ALLOW_FILE_IMAGE for a VFL driver means that * the driver is able to use a file image in the fapl as the initial @@ -190,7 +202,6 @@ typedef enum H5F_mem_t H5FD_mem_t; */ #define H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS 0x00000800 - /* Forward declaration */ typedef struct H5FD_t H5FD_t; diff --git a/src/H5Fint.c b/src/H5Fint.c index 4e8fe65..e7726eb 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -693,7 +693,7 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t * merged into the trunk and journaling is enabled, at least until * we make it work. - QAK) */ - f->shared->use_tmp_space = !(IS_H5FD_MPI(f)); + f->shared->use_tmp_space = !H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI); /* * Create a metadata cache with the specified number of elements. diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 4d3ca34..39b8dfa 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -208,8 +208,8 @@ H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Check VFD */ - if(!IS_H5FD_MPIO(file)) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect VFL driver, must use MPI-I/O driver") + if(!H5F_HAS_FEATURE(file, H5FD_FEAT_HAS_MPI)) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect VFL driver, does not support MPI atomicity mode") /* set atomicity value */ if (H5FD_set_mpio_atomicity (file->shared->lf, flag) < 0) @@ -248,8 +248,8 @@ H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Check VFD */ - if(!IS_H5FD_MPIO(file)) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect VFL driver, must use MPI-I/O driver") + if(!H5F_HAS_FEATURE(file, H5FD_FEAT_HAS_MPI)) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect VFL driver, does not support MPI atomicity mode") /* get atomicity value */ if (H5FD_get_mpio_atomicity (file->shared->lf, flag) < 0) diff --git a/src/hdf5.lnt b/src/hdf5.lnt index f3e81f8..6b94b8b 100644 --- a/src/hdf5.lnt +++ b/src/hdf5.lnt @@ -17,12 +17,6 @@ // Suppress message about "Constant value boolean" in TRUE macros -emacro(506,TRUE) -// Suppress message about "Constant value boolean" in IS_H5FD_MPI* macros --emacro(506,IS_H5FD_MPI) - -// Suppress message about "Boolean within 'if' always evaluates false" in IS_H5FD_MPI* macros --emacro((774),IS_H5FD_MPI) - // Suppress message about our use of 'goto' in our error macros -emacro(801,HGOTO_DONE, H5Epush_goto) diff --git a/test/links.c b/test/links.c index 95398cd..d45a233 100644 --- a/test/links.c +++ b/test/links.c @@ -4145,7 +4145,8 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) op_data.target_file = filename2; /* Core file driver has issues when used as the member file driver for a family file */ /* Family file driver cannot be used with family or multi drivers for member files */ - /* Also disable parallel member drivers, because IS_H5FD_MPI whould report FALSE, causing problems */ + /* Also disable parallel member drivers, because H5F_HAS_FEATURE(H5FD_FEAT_HAS_MPI) + would report FALSE, causing problems */ base_driver = H5Pget_driver(fapl); op_data.base_fapl = (base_driver == H5FD_FAMILY || base_driver == H5FD_MULTI || base_driver == H5FD_MPIO || base_driver == H5FD_CORE) ? H5P_DEFAULT : fapl; -- cgit v0.12