From 90e269d55269a75fdfab2cc55eb7fafe6d07711a Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 29 Oct 2003 14:32:36 -0500 Subject: [svn-r7789] Purpose: Bug fix & code cleanups Description: Change our use of MPI derived datatypes to not create datatypes with "0-sized" lengths, which causes the LANL Q machine to hang. Also, get rid of "prefer MPI derived datatypes" environment variable since it has no advantage. Platforms tested: FreeBSD 4.9 (sleipnir) w & w/o parallel h5committest --- release_docs/RELEASE.txt | 4 + src/H5FDfphdf5.c | 145 +++++++++++++-------------------- src/H5FDfphdf5.h | 8 +- src/H5FDmpio.c | 71 +++++----------- src/H5FDmpio.h | 2 +- src/H5FPclient.c | 4 +- src/H5S.c | 7 -- src/H5Smpio.c | 208 +++++++++++------------------------------------ src/H5Sprivate.h | 1 - 9 files changed, 136 insertions(+), 314 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index cce0453..f6c5a4c 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -82,6 +82,10 @@ Bug Fixes since HDF5-1.6.0 release Library ------- + - Fixed problems with MPI datatypes that caused ASCI Q machine to + hang. QAK - 2003/10/28 + - Removed HDF5_MPI_PREFER_DERIVED_TYPES environment variable support, + since it had no benefit. QAK - 2003/10/28 - Single hyperslab selections (which were set with only one call to H5Sselect_hyperslab) that had dimensions that could be "flattened" but were interspersed with dimensions that could not be flattened diff --git a/src/H5FDfphdf5.c b/src/H5FDfphdf5.c index d43c71f..850f344 100644 --- a/src/H5FDfphdf5.c +++ b/src/H5FDfphdf5.c @@ -133,12 +133,6 @@ static char H5FD_mpio_native[] = "native"; #define H5FD_FPHDF5_XFER_FILE_MPI_TYPE_NAME "H5FD_fphdf5_file_mpi_type" #define H5FD_FPHDF5_XFER_FILE_MPI_TYPE_SIZE sizeof(MPI_Datatype) -/* - * Definitions for whether to use MPI types property - */ -#define H5FD_FPHDF5_XFER_USE_VIEW_NAME "H5FD_fphdf5_use_view" -#define H5FD_FPHDF5_XFER_USE_VIEW_SIZE sizeof(unsigned) - /*------------------------------------------------------------------------- * Function: H5FD_fphdf5_init @@ -546,7 +540,7 @@ done: */ herr_t H5FD_fphdf5_setup(hid_t dxpl_id, MPI_Datatype btype, - MPI_Datatype ftype, unsigned use_view) + MPI_Datatype ftype) { H5P_genplist_t *plist; herr_t ret_value = SUCCEED; @@ -569,12 +563,6 @@ H5FD_fphdf5_setup(hid_t dxpl_id, MPI_Datatype btype, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property") - /* Set 'use view' property */ - if (H5P_insert(plist, H5FD_FPHDF5_XFER_USE_VIEW_NAME, - H5FD_FPHDF5_XFER_USE_VIEW_SIZE, &use_view, - NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property") - done: FUNC_LEAVE_NOAPI(ret_value) } @@ -610,10 +598,6 @@ H5FD_fphdf5_teardown(hid_t dxpl_id) if (H5P_remove(dxpl_id, plist, H5FD_FPHDF5_XFER_FILE_MPI_TYPE_NAME) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove MPI-I/O property") - /* Remove 'use view' property */ - if (H5P_remove(dxpl_id, plist, H5FD_FPHDF5_XFER_USE_VIEW_NAME) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove MPI-I/O property") - done: FUNC_LEAVE_NOAPI(ret_value) } @@ -1168,10 +1152,6 @@ H5FD_fphdf5_read(H5FD_t *_file, H5FD_mem_t mem_type, hid_t dxpl_id, int bytes_read; int n; unsigned use_view_this_time = 0; - H5P_genplist_t *plist; -#ifndef NDEBUG - H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ -#endif /* NDEBUG */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5FD_fphdf5_read, FAIL) @@ -1197,30 +1177,27 @@ H5FD_fphdf5_read(H5FD_t *_file, H5FD_mem_t mem_type, hid_t dxpl_id, if ((hsize_t)size_i != size) HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size_t to int") - /* Obtain the data transfer properties */ - if ((plist = H5I_object(dxpl_id)) == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") -#ifndef NDEBUG - xfer_mode = H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); -#endif /* NDEBUG */ - /* Only look for MPI views for raw data transfers */ if(mem_type==H5FD_MEM_DRAW) { + H5P_genplist_t *plist; + H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ + + /* Obtain the data transfer properties */ + if ((plist = H5I_object(dxpl_id)) == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + xfer_mode = H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); + /* * Set up for a fancy xfer using complex types, or single byte block. * We wouldn't need to rely on the use_view field if MPI semantics * allowed us to test that btype == ftype == MPI_BYTE (or even * MPI_TYPE_NULL, which could mean "use MPI_BYTE" by convention). */ - if (H5P_exist_plist(plist, H5FD_FPHDF5_XFER_USE_VIEW_NAME) > 0) - if (H5P_get(plist, H5FD_FPHDF5_XFER_USE_VIEW_NAME, &use_view_this_time) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") - - if (use_view_this_time) { + if(xfer_mode==H5FD_MPIO_COLLECTIVE) { MPI_Datatype file_type; - /* Sanity check that views will only be used by collective I/O */ - assert(xfer_mode==H5FD_MPIO_COLLECTIVE); + /* Remember that views are used */ + use_view_this_time=TRUE; /* Prepare for a full-blown xfer using btype, ftype, and disp */ if (H5P_get(plist, H5FD_FPHDF5_XFER_MEM_MPI_TYPE_NAME, &buf_type) < 0) @@ -1246,9 +1223,6 @@ H5FD_fphdf5_read(H5FD_t *_file, H5FD_mem_t mem_type, hid_t dxpl_id, buf_type, &status)) != MPI_SUCCESS) HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mrc) } else { - /* Sanity check that independent I/O must be occuring */ - assert(xfer_mode==H5FD_MPIO_INDEPENDENT); - /* * Prepare for a simple xfer of a contiguous block of bytes. The * btype, ftype, and disp fields are not used. @@ -1413,7 +1387,7 @@ HDfprintf(stderr, "%s: Couldn't write metadata to SAP (%d)\n", } /* FIXME: Should I check this return value or just pass it on out? */ - ret_value = H5FD_fphdf5_write_real(_file, dxpl_id, addr, size_i, buf); + ret_value = H5FD_fphdf5_write_real(_file, mem_type, plist, addr, size_i, buf); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1433,20 +1407,16 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FD_fphdf5_write_real(H5FD_t *_file, hid_t dxpl_id, haddr_t addr, int size, - const void *buf) +H5FD_fphdf5_write_real(H5FD_t *_file, H5FD_mem_t mem_type, H5P_genplist_t *plist, + haddr_t addr, int size, const void *buf) { H5FD_fphdf5_t *file = (H5FD_fphdf5_t*)_file; MPI_Status status; - MPI_Datatype buf_type; + MPI_Datatype buf_type=MPI_BYTE; MPI_Offset mpi_off; int mrc; int bytes_written; unsigned use_view_this_time = 0; - H5P_genplist_t *plist; -#ifndef NDEBUG - H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ -#endif /* NDEBUG */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5FD_fphdf5_write_real, FAIL) @@ -1454,12 +1424,9 @@ H5FD_fphdf5_write_real(H5FD_t *_file, hid_t dxpl_id, haddr_t addr, int size, /* check args */ assert(file); assert(file->pub.driver_id == H5FD_FPHDF5); + assert(plist); assert(buf); - /* Make certain we have the correct type of property list */ - assert(H5I_get_type(dxpl_id) == H5I_GENPROP_LST); - assert(H5P_isa_class(dxpl_id, H5P_DATASET_XFER) == TRUE); - /* Portably initialize MPI status variable */ HDmemset(&status, 0, sizeof(MPI_Status)); @@ -1467,60 +1434,59 @@ H5FD_fphdf5_write_real(H5FD_t *_file, hid_t dxpl_id, haddr_t addr, int size, if (H5FD_fphdf5_haddr_to_MPIOff(addr, &mpi_off) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off") - /* Obtain the data transfer properties */ - if ((plist = H5I_object(dxpl_id)) == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + /* Only check for fancy transfers with raw data I/O */ + if (mem_type == H5FD_MEM_DRAW) { + H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ - /* - * Set up for a fancy xfer using complex types, or single byte block. - * We wouldn't need to rely on the use_view field if MPI semantics - * allowed us to test that btype == ftype == MPI_BYTE (or even - * MPI_TYPE_NULL, which could mean "use MPI_BYTE" by convention). - */ - if (H5P_exist_plist(plist, H5FD_FPHDF5_XFER_USE_VIEW_NAME) > 0) - if (H5P_get(plist, H5FD_FPHDF5_XFER_USE_VIEW_NAME, &use_view_this_time) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") + /* Obtain the data transfer properties */ + xfer_mode=(H5FD_mpio_xfer_t)H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); + + /* + * Set up for a fancy xfer using complex types, or single byte block. + * We wouldn't need to rely on the use_view field if MPI semantics + * allowed us to test that btype == ftype == MPI_BYTE (or even + * MPI_TYPE_NULL, which could mean "use MPI_BYTE" by convention). + */ + if(xfer_mode==H5FD_MPIO_COLLECTIVE) { + MPI_Datatype file_type; - if (use_view_this_time) { - MPI_Datatype file_type; + /* Remember that views are used */ + use_view_this_time=TRUE; - /* Prepare for a full-blown xfer using btype, ftype, and disp */ - if (H5P_get(plist, H5FD_FPHDF5_XFER_MEM_MPI_TYPE_NAME, &buf_type) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") + /* Prepare for a full-blown xfer using btype, ftype, and disp */ + if (H5P_get(plist, H5FD_FPHDF5_XFER_MEM_MPI_TYPE_NAME, &buf_type) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") - if (H5P_get(plist, H5FD_FPHDF5_XFER_FILE_MPI_TYPE_NAME, &file_type) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") + if (H5P_get(plist, H5FD_FPHDF5_XFER_FILE_MPI_TYPE_NAME, &file_type) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") - /* Set the file view when we are using MPI derived types */ - if ((mrc = MPI_File_set_view(file->f, mpi_off, MPI_BYTE, - file_type, H5FD_mpio_native, - file->info)) != MPI_SUCCESS) - HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mrc) + /* Set the file view when we are using MPI derived types */ + if ((mrc = MPI_File_set_view(file->f, mpi_off, MPI_BYTE, + file_type, H5FD_mpio_native, + file->info)) != MPI_SUCCESS) + HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mrc) - /* - * When using types, use the address as the displacement for - * MPI_File_set_view and reset the address for the read to zero - */ - mpi_off = 0; + /* + * When using types, use the address as the displacement for + * MPI_File_set_view and reset the address for the read to zero + */ + mpi_off = 0; + } + } /* end if */ - /* Write the data. */ + /* Write the data. */ + if(use_view_this_time) { /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if ((mrc = MPI_File_write_at_all(file->f, mpi_off, (void*)buf, size, buf_type, &status)) != MPI_SUCCESS) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mrc) - } else { - /* - * Prepare for a simple xfer of a contiguous block of bytes. The - * btype and ftype. - */ - buf_type = MPI_BYTE; - - /* Write the data. */ + } /* end if */ + else { /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if ((mrc = MPI_File_write_at(file->f, mpi_off, (void*)buf, size, buf_type, &status)) != MPI_SUCCESS) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mrc) - } + } /* end else */ /* Reset the file view when we used MPI derived types */ if (use_view_this_time) @@ -1606,6 +1572,7 @@ H5FD_fphdf5_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) if (H5FP_request_flush_metadata(_file, file->file_id, dxpl_id, &req_id, &status) != SUCCEED) { /* FIXME: This failed */ +H5Eprint(H5E_DEFAULT,stderr); HDfprintf(stderr, "%s:%d: Flush failed (%d)\n", FUNC, __LINE__, status); } diff --git a/src/H5FDfphdf5.h b/src/H5FDfphdf5.h index eeda50a..d77af3c 100644 --- a/src/H5FDfphdf5.h +++ b/src/H5FDfphdf5.h @@ -101,11 +101,14 @@ H5_DLL herr_t H5Pget_fapl_fphdf5(hid_t fapl_id, MPI_Comm *comm, * Private Library Functions *==--------------------------------------------------------------------------== */ +/* Forward declarations for prototype arguments */ +struct H5P_genplist_t; + H5_DLL hid_t H5FD_fphdf5_init(void); H5_DLL MPI_Comm H5FD_fphdf5_communicator(H5FD_t *_file); H5_DLL MPI_Comm H5FD_fphdf5_barrier_communicator(H5FD_t *_file); H5_DLL herr_t H5FD_fphdf5_setup(hid_t dxpl_id, MPI_Datatype btype, - MPI_Datatype ftype, unsigned use_view); + MPI_Datatype ftype); H5_DLL herr_t H5FD_fphdf5_teardown(hid_t dxpl_id); H5_DLL unsigned H5FD_fphdf5_file_id(H5FD_t *_file); H5_DLL int H5FD_fphdf5_mpi_rank(H5FD_t *_file); @@ -114,7 +117,8 @@ H5_DLL hbool_t H5FD_fphdf5_is_sap(H5FD_t *_file); H5_DLL hbool_t H5FD_fphdf5_is_captain(H5FD_t *_file); H5_DLL hbool_t H5FD_is_fphdf5_driver(H5FD_t *_file); -H5_DLL herr_t H5FD_fphdf5_write_real(H5FD_t *_file, hid_t dxpl_id, +H5_DLL herr_t H5FD_fphdf5_write_real(H5FD_t *_file, H5FD_mem_t mem_type, + struct H5P_genplist_t *plist, haddr_t addr, int size, const void *buf); diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index f045e7e..13d5ee7 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -174,9 +174,6 @@ static int interface_initialize_g = 0; /* Definitions for file MPI type property */ #define H5FD_MPIO_XFER_FILE_MPI_TYPE_NAME "H5FD_mpio_file_mpi_type" #define H5FD_MPIO_XFER_FILE_MPI_TYPE_SIZE sizeof(MPI_Datatype) -/* Definitions for whether to use MPI types property */ -#define H5FD_MPIO_XFER_USE_VIEW_NAME "H5FD_mpio_use_view" -#define H5FD_MPIO_XFER_USE_VIEW_SIZE sizeof(unsigned) /*------------------------------------------------------------------------- @@ -641,7 +638,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FD_mpio_setup(hid_t dxpl_id, MPI_Datatype btype, MPI_Datatype ftype, unsigned use_view) +H5FD_mpio_setup(hid_t dxpl_id, MPI_Datatype btype, MPI_Datatype ftype) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* Return value */ @@ -660,10 +657,6 @@ H5FD_mpio_setup(hid_t dxpl_id, MPI_Datatype btype, MPI_Datatype ftype, unsigned if(H5P_insert(plist,H5FD_MPIO_XFER_FILE_MPI_TYPE_NAME,H5FD_MPIO_XFER_FILE_MPI_TYPE_SIZE,&ftype,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property") - /* Set 'use view' property */ - if(H5P_insert(plist,H5FD_MPIO_XFER_USE_VIEW_NAME,H5FD_MPIO_XFER_USE_VIEW_SIZE,&use_view,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property") - done: FUNC_LEAVE_NOAPI(ret_value) } @@ -704,10 +697,6 @@ H5FD_mpio_teardown(hid_t dxpl_id) if(H5P_remove(dxpl_id,plist,H5FD_MPIO_XFER_FILE_MPI_TYPE_NAME)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove MPI-I/O property") - /* Remove 'use view' property */ - if(H5P_remove(dxpl_id,plist,H5FD_MPIO_XFER_USE_VIEW_NAME)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove MPI-I/O property") - done: FUNC_LEAVE_NOAPI(ret_value) } @@ -1476,10 +1465,6 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add MPI_Datatype buf_type=MPI_BYTE; /* MPI description of the selection in memory */ int size_i, bytes_read, n; unsigned use_view_this_time=0; - H5P_genplist_t *plist; /* Property list pointer */ -#ifndef NDEBUG - H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ -#endif /* NDEBUG */ herr_t ret_value=SUCCEED; FUNC_ENTER_NOAPI(H5FD_mpio_read, FAIL) @@ -1511,30 +1496,27 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add (long)mpi_off, size_i ); #endif - /* Obtain the data transfer properties */ - if(NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") -#ifndef NDEBUG - xfer_mode=(H5FD_mpio_xfer_t)H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); -#endif /* NDEBUG */ - /* Only look for MPI views for raw data transfers */ if(type==H5FD_MEM_DRAW) { + H5P_genplist_t *plist; /* Property list pointer */ + H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ + + /* Obtain the data transfer properties */ + if(NULL == (plist = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + xfer_mode=(H5FD_mpio_xfer_t)H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); + /* * Set up for a fancy xfer using complex types, or single byte block. We * wouldn't need to rely on the use_view field if MPI semantics allowed * us to test that btype=ftype=MPI_BYTE (or even MPI_TYPE_NULL, which * could mean "use MPI_BYTE" by convention). */ - if(H5P_exist_plist(plist,H5FD_MPIO_XFER_USE_VIEW_NAME)>0) - if(H5P_get(plist,H5FD_MPIO_XFER_USE_VIEW_NAME,&use_view_this_time)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") - - if (use_view_this_time) { + if(xfer_mode==H5FD_MPIO_COLLECTIVE) { MPI_Datatype file_type; - /* Sanity check that views will only be used by collective I/O */ - assert(xfer_mode==H5FD_MPIO_COLLECTIVE); + /* Remember that views are used */ + use_view_this_time=TRUE; /* prepare for a full-blown xfer using btype, ftype, and disp */ if(H5P_get(plist,H5FD_MPIO_XFER_MEM_MPI_TYPE_NAME,&buf_type)<0) @@ -1554,10 +1536,6 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add */ mpi_off=0; } /* end if */ - else { - /* Sanity check that independent I/O must be occuring */ - assert(xfer_mode==H5FD_MPIO_INDEPENDENT); - } /* end else */ } /* end if */ /* Read the data. */ @@ -1783,9 +1761,6 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, int size_i, bytes_written; unsigned use_view_this_time=0; H5P_genplist_t *plist; /* Property list pointer */ -#ifndef NDEBUG - H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ -#endif /* NDEBUG */ herr_t ret_value=SUCCEED; FUNC_ENTER_NOAPI(H5FD_mpio_write, FAIL) @@ -1820,26 +1795,24 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, /* Obtain the data transfer properties */ if(NULL == (plist = H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") -#ifndef NDEBUG - xfer_mode = H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); -#endif /* NDEBUG */ if(type==H5FD_MEM_DRAW) { + H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ + + /* Obtain the data transfer properties */ + xfer_mode = H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); + /* * Set up for a fancy xfer using complex types, or single byte block. We * wouldn't need to rely on the use_view field if MPI semantics allowed * us to test that btype=ftype=MPI_BYTE (or even MPI_TYPE_NULL, which * could mean "use MPI_BYTE" by convention). */ - if(H5P_exist_plist(plist,H5FD_MPIO_XFER_USE_VIEW_NAME)>0) - if(H5P_get(plist,H5FD_MPIO_XFER_USE_VIEW_NAME,&use_view_this_time)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") - - if (use_view_this_time) { + if(xfer_mode==H5FD_MPIO_COLLECTIVE) { MPI_Datatype file_type; - /* Sanity check that views will only be used by collective I/O */ - assert(xfer_mode==H5FD_MPIO_COLLECTIVE); + /* Remember that views are used */ + use_view_this_time=TRUE; /* prepare for a full-blown xfer using btype, ftype, and disp */ if(H5P_get(plist,H5FD_MPIO_XFER_MEM_MPI_TYPE_NAME,&buf_type)<0) @@ -1859,10 +1832,6 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, */ mpi_off=0; } /* end if */ - else { - /* Sanity check that independent I/O must occur */ - assert(xfer_mode==H5FD_MPIO_INDEPENDENT); - } /* end else */ } /* end if */ else { unsigned block_before_meta_write=0; /* Whether to block before a metadata write */ diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h index ae4cf4b..7bd2545 100644 --- a/src/H5FDmpio.h +++ b/src/H5FDmpio.h @@ -61,7 +61,7 @@ H5_DLL herr_t H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode); H5_DLL herr_t H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode/*out*/); H5_DLL MPI_Comm H5FD_mpio_communicator(H5FD_t *_file); H5_DLL herr_t H5FD_mpio_setup(hid_t dxpl_id, MPI_Datatype btype, - MPI_Datatype ftype, unsigned use_view); + MPI_Datatype ftype); H5_DLL herr_t H5FD_mpio_teardown(hid_t dxpl_id); H5_DLL herr_t H5FD_mpio_wait_for_left_neighbor(H5FD_t *file); H5_DLL herr_t H5FD_mpio_signal_right_neighbor(H5FD_t *file); diff --git a/src/H5FPclient.c b/src/H5FPclient.c index 8468a47..2628fb9 100644 --- a/src/H5FPclient.c +++ b/src/H5FPclient.c @@ -883,8 +883,8 @@ H5FP_dump_to_file(H5FD_t *file, hid_t dxpl_id) if (H5FP_read_metadata(&mdata, (int)sap_read.md_size, (int)H5FP_sap_rank) != FAIL) { - if (H5FD_fphdf5_write_real(file, new_dxpl_id, sap_read.addr, - (int)sap_read.md_size, mdata) == FAIL) { + if (H5FD_fphdf5_write_real(file, H5FD_MEM_DEFAULT, plist, + sap_read.addr, (int)sap_read.md_size, mdata) == FAIL) { HDfree(mdata); HGOTO_ERROR(H5E_FPHDF5, H5E_WRITEERROR, FAIL, "can't write metadata to file"); } diff --git a/src/H5S.c b/src/H5S.c index e1d0327..0f1e905 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -51,7 +51,6 @@ static size_t H5S_nconv_g = 0; /*entries used*/ #ifdef H5_HAVE_PARALLEL /* Global vars whose value can be set from environment variable also */ hbool_t H5S_mpi_opt_types_g = TRUE; -hbool_t H5S_mpi_prefer_derived_types_g = TRUE; #endif /* H5_HAVE_PARALLEL */ /* Declare a free list to manage the H5S_simple_t struct */ @@ -98,12 +97,6 @@ H5S_init_interface(void) if (s && HDisdigit(*s)) H5S_mpi_opt_types_g = (int)HDstrtol (s, NULL, 0); } - { - /* Prefer MPI derived types for collective data transfers? */ - const char *s = HDgetenv ("HDF5_MPI_PREFER_DERIVED_TYPES"); - if (s && HDisdigit(*s)) - H5S_mpi_prefer_derived_types_g = (int)HDstrtol (s, NULL, 0); - } #endif /* H5_HAVE_PARALLEL */ done: diff --git a/src/H5Smpio.c b/src/H5Smpio.c index d147977..92974c3 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -40,44 +40,39 @@ static int interface_initialize_g = 0; static herr_t -H5S_mpio_all_type( const H5S_t *space, size_t elmt_size, hbool_t prefer_derived_types, +H5S_mpio_all_type( const H5S_t *space, size_t elmt_size, /* out: */ MPI_Datatype *new_type, size_t *count, hsize_t *extra_offset, - hbool_t *use_view, hbool_t *is_derived_type ); static herr_t -H5S_mpio_none_type( const H5S_t *space, size_t elmt_size, hbool_t prefer_derived_types, +H5S_mpio_none_type( const H5S_t *space, size_t elmt_size, /* out: */ MPI_Datatype *new_type, size_t *count, hsize_t *extra_offset, - hbool_t *use_view, hbool_t *is_derived_type ); static herr_t -H5S_mpio_hyper_type( const H5S_t *space, size_t elmt_size, hbool_t prefer_derived_types, +H5S_mpio_hyper_type( const H5S_t *space, size_t elmt_size, /* out: */ MPI_Datatype *new_type, size_t *count, hsize_t *extra_offset, - hbool_t *use_view, hbool_t *is_derived_type ); static herr_t -H5S_mpio_hyper_contig_type( const H5S_t *space, size_t elmt_size, hbool_t prefer_derived_types, +H5S_mpio_hyper_contig_type( const H5S_t *space, size_t elmt_size, /* out: */ MPI_Datatype *new_type, size_t *count, hsize_t *extra_offset, - hbool_t *use_view, hbool_t *is_derived_type ); static herr_t -H5S_mpio_space_type( const H5S_t *space, size_t elmt_size, hbool_t prefer_derived_types, +H5S_mpio_space_type( const H5S_t *space, size_t elmt_size, /* out: */ MPI_Datatype *new_type, size_t *count, hsize_t *extra_offset, - hbool_t *use_view, hbool_t *is_derived_type ); static herr_t H5S_mpio_spaces_xfer(H5F_t *f, const H5O_layout_t *layout, size_t elmt_size, @@ -96,7 +91,6 @@ H5S_mpio_spaces_xfer(H5F_t *f, const H5O_layout_t *layout, size_t elmt_size, * *count how many objects of the new_type in selection * (useful if this is the buffer type for xfer) * *extra_offset Number of bytes of offset within dataset - * *use_view 0 if view not needed, 1 if needed * *is_derived_type 0 if MPI primitive type, 1 if derived * * Programmer: rky 980813 @@ -104,27 +98,20 @@ H5S_mpio_spaces_xfer(H5F_t *f, const H5O_layout_t *layout, size_t elmt_size, * Modifications: * * Quincey Koziol, June 18, 2002 - * Added 'extra_offset' and 'use_view' parameters - * - * Quincey Koziol, June 19, 2002 - * Added 'prefer_derived_types' flag to choose whether MPI derived types - * should be created or not. + * Added 'extra_offset' parameter * *------------------------------------------------------------------------- */ static herr_t -H5S_mpio_all_type( const H5S_t *space, size_t elmt_size, hbool_t prefer_derived_types, +H5S_mpio_all_type( const H5S_t *space, size_t elmt_size, /* out: */ MPI_Datatype *new_type, size_t *count, hsize_t *extra_offset, - hbool_t *use_view, hbool_t *is_derived_type ) { hsize_t total_bytes; unsigned u; - int mpi_code; /* MPI return code */ - herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOINIT(H5S_mpio_all_type); @@ -136,33 +123,13 @@ H5S_mpio_all_type( const H5S_t *space, size_t elmt_size, hbool_t prefer_derived_ for (u=0; uextent.u.simple.rank; ++u) total_bytes *= space->extent.u.simple.size[u]; - /* Check if we should prefer creating a derived type */ - if(prefer_derived_types) { - /* fill in the return values */ - H5_CHECK_OVERFLOW(total_bytes, hsize_t, int); - if (MPI_SUCCESS != (mpi_code=MPI_Type_contiguous( (int)total_bytes, MPI_BYTE, new_type ))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code); - if(MPI_SUCCESS != (mpi_code=MPI_Type_commit(new_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code); - *count = 1; - *extra_offset = 0; - *use_view = 1; - *is_derived_type = 1; - } /* end if */ - else { - /* fill in the return values */ - *new_type = MPI_BYTE; - H5_ASSIGN_OVERFLOW(*count, total_bytes, hsize_t, size_t); - *extra_offset = 0; - *use_view = 0; - *is_derived_type = 0; - } /* end else */ + /* fill in the return values */ + *new_type = MPI_BYTE; + H5_ASSIGN_OVERFLOW(*count, total_bytes, hsize_t, size_t); + *extra_offset = 0; + *is_derived_type = 0; -done: -#ifdef H5Smpi_DEBUG - HDfprintf(stdout, "Leave %s total_bytes=%Hu\n", FUNC, total_bytes ); -#endif - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } /* H5S_mpio_all_type() */ @@ -177,7 +144,6 @@ done: * *count how many objects of the new_type in selection * (useful if this is the buffer type for xfer) * *extra_offset Number of bytes of offset within dataset - * *use_view 0 if view not needed, 1 if needed * *is_derived_type 0 if MPI primitive type, 1 if derived * * Programmer: Quincey Koziol, October 29, 2002 @@ -187,45 +153,22 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5S_mpio_none_type( const H5S_t *space, size_t UNUSED elmt_size, hbool_t prefer_derived_types, +H5S_mpio_none_type( const H5S_t UNUSED *space, size_t UNUSED elmt_size, /* out: */ MPI_Datatype *new_type, size_t *count, hsize_t *extra_offset, - hbool_t *use_view, hbool_t *is_derived_type ) { - int mpi_code; /* MPI return code */ - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOINIT(H5S_mpio_none_type); - /* Check args */ - assert(space); - - /* Check if we should prefer creating a derived type */ - if(prefer_derived_types) { - /* fill in the return values */ - if (MPI_SUCCESS != (mpi_code=MPI_Type_contiguous(0, MPI_BYTE, new_type ))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code); - if(MPI_SUCCESS != (mpi_code=MPI_Type_commit(new_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code); - *count = 1; - *extra_offset = 0; - *use_view = 1; - *is_derived_type = 1; - } /* end if */ - else { - /* fill in the return values */ - *new_type = MPI_BYTE; - *count = 0; - *extra_offset = 0; - *use_view = 0; - *is_derived_type = 0; - } /* end else */ + /* fill in the return values */ + *new_type = MPI_BYTE; + *count = 0; + *extra_offset = 0; + *is_derived_type = 0; -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } /* H5S_mpio_none_type() */ @@ -240,7 +183,6 @@ done: * *count how many objects of the new_type in selection * (useful if this is the buffer type for xfer) * *extra_offset Number of bytes of offset within dataset - * *use_view 0 if view not needed, 1 if needed * *is_derived_type 0 if MPI primitive type, 1 if derived * * Programmer: rky 980813 @@ -253,22 +195,17 @@ done: * H5S_MAX_RANK. * * Quincey Koziol, June 18, 2002 - * Added 'extra_offset' and 'use_view' parameters. Also accomodate + * Added 'extra_offset' parameter. Also accomodate * selection offset in MPI type built. * - * Quincey Koziol, June 19, 2002 - * Added 'prefer_derived_types' flag to choose whether MPI derived types - * should be created or not. (Ignored for this routine) - * *------------------------------------------------------------------------- */ static herr_t -H5S_mpio_hyper_type( const H5S_t *space, size_t elmt_size, hbool_t UNUSED prefer_derived_types, +H5S_mpio_hyper_type( const H5S_t *space, size_t elmt_size, /* out: */ MPI_Datatype *new_type, size_t *count, hsize_t *extra_offset, - hbool_t *use_view, hbool_t *is_derived_type ) { struct dim { /* less hassle than malloc/free & ilk */ @@ -549,7 +486,6 @@ H5S_mpio_hyper_type( const H5S_t *space, size_t elmt_size, hbool_t UNUSED prefer /* fill in the remaining return values */ *count = 1; /* only have to move one of these suckers! */ *extra_offset = 0; - *use_view = 1; *is_derived_type = 1; HGOTO_DONE(SUCCEED); @@ -558,7 +494,6 @@ empty: *new_type = MPI_BYTE; *count = 0; *extra_offset = 0; - *use_view = 1; /* Note that this 'use_view' could go either way, but go with '1' for now */ *is_derived_type = 0; done: @@ -581,26 +516,20 @@ done: * *count how many objects of the new_type in selection * (useful if this is the buffer type for xfer) * *extra_offset Number of bytes of offset within dataset - * *use_view 0 if view not needed, 1 if needed * *is_derived_type 0 if MPI primitive type, 1 if derived * * Programmer: Quincey Koziol, 2002/06/17 * * Modifications: * - * Quincey Koziol, June 19, 2002 - * Added 'prefer_derived_types' flag to choose whether MPI derived types - * should be created or not. - * *------------------------------------------------------------------------- */ static herr_t -H5S_mpio_hyper_contig_type( const H5S_t *space, size_t elmt_size, hbool_t prefer_derived_types, +H5S_mpio_hyper_contig_type( const H5S_t *space, size_t elmt_size, /* out: */ MPI_Datatype *new_type, size_t *count, hsize_t *extra_offset, - hbool_t *use_view, hbool_t *is_derived_type ) { hsize_t total_bytes; /* Number of bytes in selection */ @@ -611,8 +540,6 @@ H5S_mpio_hyper_contig_type( const H5S_t *space, size_t elmt_size, hbool_t prefer hssize_t offset[H5O_LAYOUT_NDIMS]; /* Offset in selection */ int ndims; /* Number of dimensions of dataset */ int i; /* Local index */ - int mpi_code; /* MPI return code */ - herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOINIT(H5S_mpio_hyper_contig_type); @@ -625,7 +552,7 @@ H5S_mpio_hyper_contig_type( const H5S_t *space, size_t elmt_size, hbool_t prefer /* Compute the number of bytes in selection */ total_bytes = (hsize_t)elmt_size*nelem; - /* Set up convenient aliased */ + /* Set up convenient alias */ ndims=space->extent.u.simple.rank; /* Initialize row sizes for each dimension */ @@ -643,33 +570,13 @@ H5S_mpio_hyper_contig_type( const H5S_t *space, size_t elmt_size, hbool_t prefer for(i=0,byte_offset=0; iselect.type) { case H5S_SEL_NONE: - if ( H5S_mpio_none_type( space, elmt_size, prefer_derived_types, - /* out: */ new_type, count, extra_offset, use_view, is_derived_type ) <0) + if ( H5S_mpio_none_type( space, elmt_size, + /* out: */ new_type, count, extra_offset, is_derived_type ) <0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert \"all\" selection to MPI type"); break; case H5S_SEL_ALL: - if ( H5S_mpio_all_type( space, elmt_size, prefer_derived_types, - /* out: */ new_type, count, extra_offset, use_view, is_derived_type ) <0) + if ( H5S_mpio_all_type( space, elmt_size, + /* out: */ new_type, count, extra_offset, is_derived_type ) <0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert \"all\" selection to MPI type"); break; @@ -742,15 +642,15 @@ H5S_mpio_space_type( const H5S_t *space, size_t elmt_size, hbool_t prefer_derive case H5S_SEL_HYPERSLABS: if((*space->select.is_contiguous)(space)) { - err = H5S_mpio_hyper_contig_type( space, elmt_size, prefer_derived_types, - /* out: */ new_type, count, extra_offset, use_view, is_derived_type ); + if(H5S_mpio_hyper_contig_type( space, elmt_size, + /* out: */ new_type, count, extra_offset, is_derived_type )<0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert \"all\" selection to MPI type"); } /* end if */ else { - err = H5S_mpio_hyper_type( space, elmt_size, prefer_derived_types, - /* out: */ new_type, count, extra_offset, use_view, is_derived_type ); + if(H5S_mpio_hyper_type( space, elmt_size, + /* out: */ new_type, count, extra_offset, is_derived_type )<0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert \"all\" selection to MPI type"); } /* end else */ - if (err<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert \"all\" selection to MPI type"); break; default: @@ -761,7 +661,7 @@ H5S_mpio_space_type( const H5S_t *space, size_t elmt_size, hbool_t prefer_derive case H5S_COMPLEX: /* not yet implemented */ - ret_value = FAIL; + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "complex data spaces are not supported yet"); break; default: @@ -813,12 +713,7 @@ done: * * QAK - 2002/06/18 * Removed 'dc_plist' parameter, since it was not used. Also, switch to - * getting the 'use_view' and 'extra_offset' settings for each selection. - * - * Quincey Koziol, June 19, 2002 - * Use 'prefer_derived_types' flag (from HDF5_MPI_PREFER_DERIVED_TYPES - * environment variable) to choose whether MPI derived types should be - * preferred or not. + * getting the 'extra_offset' setting for each selection. * *------------------------------------------------------------------------- */ @@ -832,12 +727,9 @@ H5S_mpio_spaces_xfer(H5F_t *f, const H5O_layout_t *layout, size_t elmt_size, size_t mpi_buf_count, mpi_file_count; /* Number of "objects" to transfer */ hsize_t mpi_buf_offset, mpi_file_offset; /* Offset within dataset where selection (ie. MPI type) begins */ MPI_Datatype mpi_buf_type, mpi_file_type; /* MPI types for buffer (memory) and file */ - hbool_t mbt_use_view=0, /* Whether we need to use a view for the buffer (memory) type */ - mft_use_view=0; /* Whether we need to use a view for the file type */ hbool_t mbt_is_derived=0, /* Whether the buffer (memory) type is derived and needs to be free'd */ mft_is_derived=0; /* Whether the file type is derived and needs to be free'd */ hbool_t plist_is_setup=0; /* Whether the dxpl has been customized */ - hbool_t prefer_derived_types=0;/* Whether to prefer MPI derived types or not */ uint8_t *buf=(uint8_t *)_buf; /* Alias for pointer arithmetic */ int mpi_code; /* MPI return code */ herr_t ret_value = SUCCEED; /* Return value */ @@ -854,27 +746,21 @@ H5S_mpio_spaces_xfer(H5F_t *f, const H5O_layout_t *layout, size_t elmt_size, /* Make certain we have the correct type of property list */ assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); - /* Get the preference for MPI derived types */ - /* (Set via the "HDF5_MPI_PREFER_DERIVED_TYPES" environment variable for now) */ - prefer_derived_types= H5S_mpi_prefer_derived_types_g; - /* create the MPI buffer type */ - if (H5S_mpio_space_type( mem_space, elmt_size, prefer_derived_types, + if (H5S_mpio_space_type( mem_space, elmt_size, /* out: */ &mpi_buf_type, &mpi_buf_count, &mpi_buf_offset, - &mbt_use_view, &mbt_is_derived )<0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't create MPI buf type"); /* create the MPI file type */ - if ( H5S_mpio_space_type( file_space, elmt_size, prefer_derived_types, + if ( H5S_mpio_space_type( file_space, elmt_size, /* out: */ &mpi_file_type, &mpi_file_count, &mpi_file_offset, - &mft_use_view, &mft_is_derived )<0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't create MPI file type"); @@ -891,7 +777,7 @@ H5S_mpio_spaces_xfer(H5F_t *f, const H5O_layout_t *layout, size_t elmt_size, * Pass buf type, file type to the file driver. Request an MPI type * transfer (instead of an elementary byteblock transfer). */ - if(H5FD_mpio_setup(dxpl_id, mpi_buf_type, mpi_file_type, (unsigned)(mbt_use_view || mft_use_view))<0) + if(H5FD_mpio_setup(dxpl_id, mpi_buf_type, mpi_file_type)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O properties"); plist_is_setup=1; diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 46d302f..c3089d6 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -255,7 +255,6 @@ H5_DLL herr_t H5S_select_iter_release(H5S_sel_iter_t *sel_iter); /* Global vars whose value comes from environment variable */ /* (Defined in H5S.c) */ H5_DLLVAR hbool_t H5S_mpi_opt_types_g; -H5_DLLVAR hbool_t H5S_mpi_prefer_derived_types_g; #endif /* _H5S_IN_H5S_C */ #endif /* H5_HAVE_PARALLEL */ -- cgit v0.12