From e2c95c478aeb1fbf31b06f6bfcea4b750d414df6 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Thu, 23 Mar 2000 21:12:44 -0500 Subject: [svn-r2057] Purpose: Bug fix for parallel mode. Description: H5FD_mpio_tas_allsame was called for all cases, even when MPIO is not used for access. That corrupted the internal file handle structure. Solution: Define a macro, IS_H5FD_MPIO(f), for testing if f is opened with MPIO access. Will call H5FD_mpio_tas_allsame only if this condition is true. Platform tested: O2K, both -64 and -n32 modes. --- src/H5B.c | 3 ++- src/H5D.c | 18 +++++++++--------- src/H5Distore.c | 4 ++-- src/H5F.c | 6 ++++-- src/H5FDmpio.c | 1 + src/H5FDmpio.h | 6 +++++- src/H5Fistore.c | 4 ++-- src/H5Gnode.c | 3 ++- src/H5HL.c | 9 ++++++--- src/H5O.c | 4 +++- src/H5Smpio.c | 2 +- 11 files changed, 37 insertions(+), 23 deletions(-) diff --git a/src/H5B.c b/src/H5B.c index b388531..47a6e15 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -463,7 +463,8 @@ H5B_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5B_t *bt) * for the final unchanged children. */ #ifdef H5_HAVE_PARALLEL - H5FD_mpio_tas_allsame(f->shared->lf, TRUE); /* only p0 will write */ + if (IS_H5FD_MPIO(f)) + H5FD_mpio_tas_allsame(f->shared->lf, TRUE); /* only p0 will write */ #endif /* H5_HAVE_PARALLEL */ if (H5F_block_write(f, addr, (hsize_t)size, H5P_DEFAULT, bt->page)<0) { HRETURN_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, diff --git a/src/H5D.c b/src/H5D.c index 030a973..2372c76 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -904,7 +904,7 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, #ifdef H5_HAVE_PARALLEL /* If MPIO is used, no filter support yet. */ - if (H5FD_MPIO==f->shared->lf->driver_id && + if (IS_H5FD_MPIO(f) && create_parms->pline.nfilters>0) { HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL, "Parallel IO does not support filters yet"); @@ -1292,7 +1292,7 @@ H5D_open_oid(H5G_entry_t *ent) #ifdef H5_HAVE_PARALLEL /* If MPIO is used, no filter support yet. */ - if (H5FD_MPIO==dataset->ent.file->shared->lf->driver_id && + if (IS_H5FD_MPIO(dataset->ent.file) && dataset->create_parms->pline.nfilters>0){ HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL, "Parallel IO does not support filters yet"); @@ -1529,7 +1529,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, if (H5FD_MPIO==xfer_parms->driver_id && (dx=xfer_parms->driver_info) && H5FD_MPIO_COLLECTIVE==dx->xfer_mode) { - if (H5FD_MPIO!=dataset->ent.file->shared->lf->driver_id) + if (!(IS_H5FD_MPIO(dataset->ent.file))) HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPIO driver only"); } @@ -1572,7 +1572,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, * (the latter in case the arguments to sconv_funcs * turn out to be inappropriate for MPI-IO). */ if (H5_mpi_opt_types_g && - H5FD_MPIO==dataset->ent.file->shared->lf->driver_id) { + IS_H5FD_MPIO(dataset->ent.file)) { sconv->read = H5S_mpio_spaces_read; } #endif /*HAVE_PARALLEL*/ @@ -1883,7 +1883,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* If MPIO 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 */ - if (H5FD_MPIO==dataset->ent.file->shared->lf->driver_id && + if (IS_H5FD_MPIO(dataset->ent.file) && H5T_get_class(mem_type)==H5T_VLEN) { HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing VL datatypes yet"); @@ -1893,7 +1893,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* If MPIO is used, no dataset region reference support yet. */ /* This is because they use the global heap in the file and we don't */ /* support parallel access of that yet */ - if (H5FD_MPIO==dataset->ent.file->shared->lf->driver_id && + if (IS_H5FD_MPIO(dataset->ent.file) && H5T_get_class(mem_type)==H5T_REFERENCE && H5T_get_ref_type(mem_type)==H5R_DATASET_REGION) { HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, @@ -1939,7 +1939,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, if (H5FD_MPIO==xfer_parms->driver_id && (dx=xfer_parms->driver_info) && H5FD_MPIO_COLLECTIVE==dx->xfer_mode) { - if (H5FD_MPIO!=dataset->ent.file->shared->lf->driver_id) + if (!(IS_H5FD_MPIO(dataset->ent.file))) HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPIO driver only"); } @@ -1989,7 +1989,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, * (the latter in case the arguments to sconv_funcs * turn out to be inappropriate for MPI-IO). */ if (H5_mpi_opt_types_g && - H5FD_MPIO==dataset->ent.file->shared->lf->driver_id) { + IS_H5FD_MPIO(dataset->ent.file)) { sconv->write = H5S_mpio_spaces_write; } #endif /*HAVE_PARALLEL*/ @@ -2494,7 +2494,7 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space) * If the dataset is accessed via parallel I/O, allocate file space * for all chunks now and initialize each chunk with the fill value. */ - if (H5FD_MPIO==dset->ent.file->shared->lf->driver_id) { + if (IS_H5FD_MPIO(dset->ent.file)) { /* We only handle simple data spaces so far */ intn ndims; hsize_t dim[H5O_LAYOUT_NDIMS]; diff --git a/src/H5Distore.c b/src/H5Distore.c index a7c7a8a..31506e6 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -1675,7 +1675,7 @@ H5F_istore_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, * MPI processes could be writing to other elements in the same chunk. * Do a direct write-through of only the elements requested. */ - if (H5FD_MPIO==f->shared->lf->driver_id) { + if (IS_H5FD_MPIO(f)) { H5F_istore_ud1_t udata; H5O_layout_t l; /* temporary layout */ @@ -1849,7 +1849,7 @@ H5F_istore_write(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, * MPI processes could be writing to other elements in the same chunk. * Do a direct write-through of only the elements requested. */ - if (H5FD_MPIO==f->shared->lf->driver_id) { + if (IS_H5FD_MPIO(f)) { H5F_istore_ud1_t udata; H5O_layout_t l; /* temporary layout */ if (H5F_istore_get_addr(f, layout, chunk_offset, &udata)<0){ diff --git a/src/H5F.c b/src/H5F.c index 0cbf889..5edca8a 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -1735,7 +1735,8 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, } else { /* Write superblock */ #ifdef H5_HAVE_PARALLEL - H5FD_mpio_tas_allsame(f->shared->lf, TRUE); /*only p0 will write*/ + if (IS_H5FD_MPIO(f)) + H5FD_mpio_tas_allsame(f->shared->lf, TRUE); /*only p0 will write*/ #endif if (H5FD_write(f->shared->lf, H5P_DEFAULT, f->shared->boot_addr, superblock_size, sbuf)<0) { @@ -1746,7 +1747,8 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, /* Write driver information block */ if (HADDR_UNDEF!=f->shared->driver_addr) { #ifdef H5_HAVE_PARALLEL - H5FD_mpio_tas_allsame(f->shared->lf, TRUE); /*only p0 will write*/ + if (IS_H5FD_MPIO(f)) + H5FD_mpio_tas_allsame(f->shared->lf, TRUE); /*only p0 will write*/ #endif if (H5FD_write(f->shared->lf, H5P_DEFAULT, f->shared->base_addr+superblock_size, driver_size, diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 7cac7f3..89dd768 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -424,6 +424,7 @@ H5FD_mpio_tas_allsame(H5FD_t *_file, hbool_t newval) #endif assert(file); + assert(H5FD_MPIO==file->pub.driver_id); oldval = file->allsame; file->allsame = newval; diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h index 31be940..d1f3c65 100644 --- a/src/H5FDmpio.h +++ b/src/H5FDmpio.h @@ -34,8 +34,12 @@ typedef struct H5FD_mpio_dxpl_t { H5FD_mpio_xfer_t xfer_mode; /*collective or independent I/O */ } H5FD_mpio_dxpl_t; -/* Function prototypes */ #ifdef H5_HAVE_PARALLEL +/* Macros */ +#define IS_H5FD_MPIO(f) /* (H5F_t *f) */ \ + (H5FD_MPIO==f->shared->lf->driver_id) + +/* Function prototypes */ __DLL__ hid_t H5FD_mpio_init(void); __DLL__ herr_t H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info); __DLL__ herr_t H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, diff --git a/src/H5Fistore.c b/src/H5Fistore.c index a7c7a8a..31506e6 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -1675,7 +1675,7 @@ H5F_istore_read(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, * MPI processes could be writing to other elements in the same chunk. * Do a direct write-through of only the elements requested. */ - if (H5FD_MPIO==f->shared->lf->driver_id) { + if (IS_H5FD_MPIO(f)) { H5F_istore_ud1_t udata; H5O_layout_t l; /* temporary layout */ @@ -1849,7 +1849,7 @@ H5F_istore_write(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, * MPI processes could be writing to other elements in the same chunk. * Do a direct write-through of only the elements requested. */ - if (H5FD_MPIO==f->shared->lf->driver_id) { + if (IS_H5FD_MPIO(f)) { H5F_istore_ud1_t udata; H5O_layout_t l; /* temporary layout */ if (H5F_istore_get_addr(f, layout, chunk_offset, &udata)<0){ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 8684a4a..a65f187 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -357,7 +357,8 @@ H5G_node_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5G_node_t *sym) HDmemset(p, 0, size - (p - buf)); #ifdef H5_HAVE_PARALLEL - H5FD_mpio_tas_allsame(f->shared->lf, TRUE); /*only p0 will write*/ + if (IS_H5FD_MPIO(f)) + H5FD_mpio_tas_allsame(f->shared->lf, TRUE); /*only p0 will write*/ #endif /* H5_HAVE_PARALLEL */ status = H5F_block_write(f, addr, (hsize_t)size, H5P_DEFAULT, buf); buf = H5MM_xfree(buf); diff --git a/src/H5HL.c b/src/H5HL.c index 9dec1eb..340387f 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -380,7 +380,8 @@ H5HL_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5HL_t *heap) if (H5F_addr_eq(heap->addr, hdr_end_addr)) { /* The header and data are contiguous */ #ifdef H5_HAVE_PARALLEL - H5FD_mpio_tas_allsame( f->shared->lf, TRUE ); /* only p0 writes */ + if (IS_H5FD_MPIO(f)) + H5FD_mpio_tas_allsame( f->shared->lf, TRUE ); /* only p0 writes */ #endif /* H5_HAVE_PARALLEL */ if (H5F_block_write(f, addr, (hsize_t)(H5HL_SIZEOF_HDR(f)+heap->disk_alloc), @@ -390,7 +391,8 @@ H5HL_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5HL_t *heap) } } else { #ifdef H5_HAVE_PARALLEL - H5FD_mpio_tas_allsame( f->shared->lf, TRUE ); /* only p0 writes */ + if (IS_H5FD_MPIO(f)) + H5FD_mpio_tas_allsame( f->shared->lf, TRUE ); /* only p0 writes */ #endif /* H5_HAVE_PARALLEL */ if (H5F_block_write(f, addr, (hsize_t)H5HL_SIZEOF_HDR(f), H5P_DEFAULT, heap->chunk)<0) { @@ -398,7 +400,8 @@ H5HL_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5HL_t *heap) "unable to write heap header to file"); } #ifdef H5_HAVE_PARALLEL - H5FD_mpio_tas_allsame( f->shared->lf, TRUE ); /* only p0 writes */ + if (IS_H5FD_MPIO(f)) + H5FD_mpio_tas_allsame( f->shared->lf, TRUE ); /* only p0 writes */ #endif /* H5_HAVE_PARALLEL */ if (H5F_block_write(f, heap->addr, (hsize_t)(heap->disk_alloc), H5P_DEFAULT, diff --git a/src/H5O.c b/src/H5O.c index afcdb1b..29ff4b9 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -557,7 +557,8 @@ H5O_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5O_t *oh) /* write the object header header */ #ifdef H5_HAVE_PARALLEL - H5FD_mpio_tas_allsame(f->shared->lf, TRUE); /*only p0 will write*/ + if (IS_H5FD_MPIO(f)) + H5FD_mpio_tas_allsame(f->shared->lf, TRUE); /*only p0 will write*/ #endif /* H5_HAVE_PARALLEL */ if (H5F_block_write(f, addr, (hsize_t)H5O_SIZEOF_HDR(f), H5P_DEFAULT, buf) < 0) { @@ -633,6 +634,7 @@ H5O_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5O_t *oh) if (oh->chunk[i].dirty) { assert(H5F_addr_defined(oh->chunk[i].addr)); #ifdef H5_HAVE_PARALLEL + if (IS_H5FD_MPIO(f)) H5FD_mpio_tas_allsame(f->shared->lf, TRUE); /*only p0 write*/ #endif /* H5_HAVE_PARALLEL */ if (H5F_block_write(f, oh->chunk[i].addr, diff --git a/src/H5Smpio.c b/src/H5Smpio.c index c41a206..185bcdc 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -539,7 +539,7 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout, assert (file_space); assert (mem_space); assert (buf); - assert (H5FD_MPIO==f->shared->lf->driver_id); + assert (IS_H5FD_MPIO(f)); /* INCOMPLETE!!! rky 980816 */ /* Currently can only handle H5D_CONTIGUOUS layout */ -- cgit v0.12