diff options
-rw-r--r-- | MANIFEST | 1 | ||||
-rwxr-xr-x | bin/snapshot | 19 | ||||
-rw-r--r-- | src/.distdep | 398 | ||||
-rw-r--r-- | src/H5D.c | 382 | ||||
-rw-r--r-- | src/H5Distore.c | 2 | ||||
-rw-r--r-- | src/H5Fistore.c | 2 | ||||
-rw-r--r-- | src/H5S.c | 334 | ||||
-rw-r--r-- | src/H5Sall.c | 55 | ||||
-rw-r--r-- | src/H5Shyper.c | 61 | ||||
-rw-r--r-- | src/H5Spoint.c | 63 | ||||
-rw-r--r-- | src/H5Sprivate.h | 230 | ||||
-rw-r--r-- | src/Makefile.in | 4 | ||||
-rw-r--r-- | test/.distdep | 86 | ||||
-rw-r--r-- | test/iopipe.c | 2 |
14 files changed, 905 insertions, 734 deletions
@@ -229,7 +229,6 @@ ./src/H5Spoint.c ./src/H5Sprivate.h ./src/H5Spublic.h -./src/H5Ssimp.c ./src/H5Sselect.c ./src/H5T.c ./src/H5Tbit.c diff --git a/bin/snapshot b/bin/snapshot index 1d9c13f..4f03da6 100755 --- a/bin/snapshot +++ b/bin/snapshot @@ -9,6 +9,10 @@ date # checked back into the CVS repository. # +# The path isn't properly initialized on hawkwind -- /usr/local/bin is +# either missing or is after /usr/bin when it should be before. +$ENV{PATH} = "/usr/local/bin:" . $ENV{PATH}; + # Where are the snapshots stored? ARCHIVES=/hdf3/ftp/pub/outgoing/hdf5/snapshots if [ "$1" ]; then @@ -34,27 +38,24 @@ cvs -Q co -d ${COMPARE}/current hdf5 || exit 1 # Compare it with the previous version. Compare only files listed in # the MANIFEST plus the MANIFEST itself. +snapshot=yes if [ -d ${COMPARE}/previous ]; then - if (diff ${COMPARE}/{previous,current}/MANIFEST); then + if (diff -c ${COMPARE}/previous/MANIFEST ${COMPARE}/current/MANIFEST); then for src in `cat ${COMPARE}/current/MANIFEST`; do if (diff -I H5_VERS_RELEASE -I " released on " \ - ${COMPARE}/{previous,current}/$src); then - snapshot=no + ${COMPARE}/previous/$src ${COMPARE}/current/$src); then else snapshot=yes - break + # Don't break because we want to see all the diffs. + #break fi done - else - snapshot=yes fi -else - snapshot=yes fi # Make sure all the serial tests work. if [ "$snapshot" = "yes" ]; then - if (cd ${COMPARE}/current; make _test); then + if (cd ${COMPARE}/current; cp -p Makefile.dist Makefile; make _test); then : else snapshot=no diff --git a/src/.distdep b/src/.distdep index 917a475..062f38a 100644 --- a/src/.distdep +++ b/src/.distdep @@ -497,75 +497,6 @@ H5Ostab.o: \ H5HGpublic.h \ H5Tprivate.h \ H5Tpublic.h -H5Sall.o: \ - H5Sall.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h -H5Shyper.o: \ - H5Shyper.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h -H5Spoint.o: \ - H5Spoint.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h H5Ssimp.o: \ H5Ssimp.c \ H5private.h \ @@ -687,67 +618,6 @@ H5B.o: \ H5MFprivate.h \ H5MFpublic.h \ H5MMprivate.h -H5D.o: \ - H5D.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5Dprivate.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5HLprivate.h \ - H5HLpublic.h \ - H5MFprivate.h \ - H5MFpublic.h -H5Fistore.o: \ - H5Fistore.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5MFprivate.h \ - H5MFpublic.h H5O.o: \ H5O.c \ H5private.h \ @@ -855,25 +725,23 @@ H5Sselect.o: \ H5Tpublic.h \ H5Zprivate.h \ H5Zpublic.h -H5Z.o: \ - H5Z.c \ +H5P.o: \ + H5P.c \ H5private.h \ H5public.h \ H5config.h \ - H5Eprivate.h \ - H5Epublic.h \ + H5Iprivate.h \ H5Ipublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ + H5Dprivate.h \ H5Gprivate.h \ H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ @@ -881,9 +749,25 @@ H5Z.o: \ H5Sprivate.h \ H5Spublic.h \ H5Zprivate.h \ - H5Zpublic.h -H5P.o: \ - H5P.c \ + H5Zpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MMprivate.h +H5Flow.o: \ + H5Flow.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5MMprivate.h \ + H5MMpublic.h +H5A.o: \ + H5A.c \ H5private.h \ H5public.h \ H5config.h \ @@ -909,43 +793,68 @@ H5P.o: \ H5Zpublic.h \ H5Eprivate.h \ H5Epublic.h \ - H5MMprivate.h -H5S.o: \ - H5S.c \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Pprivate.h \ + H5Ppublic.h \ + H5Apkg.h \ + H5Aprivate.h +H5F.o: \ + H5F.c \ H5private.h \ H5public.h \ H5config.h \ - H5Iprivate.h \ + H5Aprivate.h \ + H5Apublic.h \ H5Ipublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Dprivate.h \ + H5Oprivate.h \ + H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ - H5Tprivate.h -H5Flow.o: \ - H5Flow.c \ - H5private.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h \ + H5Iprivate.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MMprivate.h \ + H5MMpublic.h +H5Tconv.o: \ + H5Tconv.c \ + H5Iprivate.h \ + H5Ipublic.h \ H5public.h \ H5config.h \ + H5private.h \ H5Eprivate.h \ H5Epublic.h \ - H5Ipublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Tpkg.h \ + H5HGprivate.h \ + H5HGpublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ - H5MMprivate.h \ - H5MMpublic.h + H5Tprivate.h \ + H5Tpublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h H5.o: \ H5.c \ H5private.h \ @@ -977,21 +886,23 @@ H5.o: \ H5HGpublic.h \ H5Tprivate.h \ H5Tpublic.h -H5A.o: \ - H5A.c \ +H5D.o: \ + H5D.c \ H5private.h \ H5public.h \ H5config.h \ H5Iprivate.h \ H5Ipublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ + H5ACprivate.h \ + H5ACpublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ H5Dprivate.h \ H5Gprivate.h \ H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ H5Oprivate.h \ H5Opublic.h \ H5HGprivate.h \ @@ -1004,19 +915,17 @@ H5A.o: \ H5Zpublic.h \ H5Eprivate.h \ H5Epublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Pprivate.h \ - H5Ppublic.h \ - H5Apkg.h \ - H5Aprivate.h -H5F.o: \ - H5F.c \ + H5HLprivate.h \ + H5HLpublic.h \ + H5MFprivate.h \ + H5MFpublic.h +H5Odtype.o: \ + H5Odtype.c \ H5private.h \ H5public.h \ H5config.h \ - H5Aprivate.h \ - H5Apublic.h \ + H5Eprivate.h \ + H5Epublic.h \ H5Ipublic.h \ H5Gprivate.h \ H5Gpublic.h \ @@ -1025,32 +934,70 @@ H5F.o: \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ - H5Dprivate.h \ + H5MMprivate.h \ + H5MMpublic.h \ H5Oprivate.h \ H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ + H5Tpublic.h +H5S.o: \ + H5S.c \ + H5private.h \ + H5public.h \ + H5config.h \ H5Iprivate.h \ - H5ACprivate.h \ - H5ACpublic.h \ + H5Ipublic.h \ H5Eprivate.h \ H5Epublic.h \ H5MMprivate.h \ - H5MMpublic.h -H5Odtype.o: \ - H5Odtype.c \ + H5MMpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h +H5Sall.o: \ + H5Sall.c \ H5private.h \ H5public.h \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h +H5Shyper.o: \ + H5Shyper.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h \ + H5Sprivate.h \ + H5Spublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ @@ -1058,14 +1005,35 @@ H5Odtype.o: \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ H5Oprivate.h \ H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ H5Tpublic.h +H5Spoint.o: \ + H5Spoint.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h H5T.o: \ H5T.c \ H5private.h \ @@ -1094,26 +1062,58 @@ H5T.o: \ H5Eprivate.h \ H5Epublic.h \ H5MMprivate.h -H5Tconv.o: \ - H5Tconv.c \ - H5Iprivate.h \ - H5Ipublic.h \ +H5Z.o: \ + H5Z.c \ + H5private.h \ H5public.h \ H5config.h \ - H5private.h \ H5Eprivate.h \ H5Epublic.h \ + H5Ipublic.h \ H5MMprivate.h \ H5MMpublic.h \ - H5Tpkg.h \ - H5HGprivate.h \ - H5HGpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ H5Tprivate.h \ H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h +H5Fistore.o: \ + H5Fistore.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Dprivate.h \ + H5Dpublic.h \ + H5Ipublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ - H5Bpublic.h + H5Bpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MFprivate.h \ + H5MFpublic.h @@ -36,12 +36,6 @@ int qak_debug=0; #define PABLO_MASK H5D_mask /* - * Define this to be zero or one depending on whether the I/O pipeline should - * be optimized. - */ -#define H5D_OPTIMIZE_PIPE 1 - -/* * A dataset is the following struct. */ struct H5D_t { @@ -573,20 +567,22 @@ H5Dread (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, NULL == (mem_space = H5I_object(mem_space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } - /* Check for valid selection */ - if(H5S_select_valid(mem_space)!=TRUE) { - HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent"); - } /* end if */ + /* Check for valid selection */ + if(H5S_select_valid(mem_space)!=TRUE) { + HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, + "selection+offset not within extent"); + } } if (H5S_ALL != file_space_id) { if (H5_DATASPACE != H5I_group(file_space_id) || NULL == (file_space = H5I_object(file_space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } - /* Check for valid selection */ - if(H5S_select_valid(file_space)!=TRUE) { - HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent"); - } /* end if */ + /* Check for valid selection */ + if(H5S_select_valid(file_space)!=TRUE) { + HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, + "selection+offset not within extent"); + } } if (H5P_DEFAULT == plist_id) { xfer_parms = &H5D_xfer_dflt; @@ -672,20 +668,22 @@ H5Dwrite (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, NULL == (mem_space = H5I_object(mem_space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } - /* Check for valid selection */ - if(H5S_select_valid(mem_space)!=TRUE) { - HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent"); - } /* end if */ + /* Check for valid selection */ + if (H5S_select_valid(mem_space)!=TRUE) { + HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, + "selection+offset not within extent"); + } } if (H5S_ALL != file_space_id) { if (H5_DATASPACE != H5I_group(file_space_id) || NULL == (file_space = H5I_object(file_space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } - /* Check for valid selection */ - if(H5S_select_valid(file_space)!=TRUE) { - HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent"); - } /* end if */ + /* Check for valid selection */ + if (H5S_select_valid(file_space)!=TRUE) { + HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, + "selection+offset not within extent"); + } } if (H5P_DEFAULT == plist_id) { xfer_parms = &H5D_xfer_dflt; @@ -1238,6 +1236,9 @@ H5D_close(H5D_t *dataset) * Robb Matzke, 9 Jun 1998 * The data space is no longer cached in the dataset struct. * + * Robb Matzke, 11 Aug 1998 + * Added timing calls around all the data space I/O functions. + * *------------------------------------------------------------------------- */ herr_t @@ -1247,20 +1248,20 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, { hsize_t nelmts; /*number of elements */ size_t smine_start; /*strip mine start loc */ - size_t smine_nelmts; /*elements per strip */ + size_t n, smine_nelmts; /*elements per strip */ uint8 *tconv_buf = NULL; /*data type conv buffer */ uint8 *bkg_buf = NULL; /*background buffer */ H5T_conv_t tconv_func = NULL; /*conversion function */ hid_t src_id = -1, dst_id = -1;/*temporary type atoms */ - H5S_conv_t sconv_func={NULL}; /*space conversion funcs*/ + H5S_conv_t *sconv=NULL; /*space conversion funcs*/ H5S_sel_iter_t mem_iter; /* mem selection iteration info*/ - H5S_sel_iter_t bkg_iter; /*background iteration info*/ - H5S_sel_iter_t file_iter; /*file selection iter info*/ + H5S_sel_iter_t bkg_iter; /*background iteration info*/ + H5S_sel_iter_t file_iter; /*file selection iter info*/ H5T_cdata_t *cdata = NULL; /*type conversion data */ herr_t ret_value = FAIL; herr_t status; size_t src_type_size; /*size of source type */ - size_t dst_type_size; /*size of destination type*/ + size_t dst_type_size; /*size of destination type*/ size_t target_size; /*desired buffer size */ size_t request_nelmts; /*requested strip mine */ H5T_bkg_t need_bkg; /*type of background buf*/ @@ -1307,7 +1308,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access not permissible"); } -#endif /*HAVE_PARALLEL*/ +#endif /* * Locate the type conversion function and data space conversion @@ -1317,9 +1318,6 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, * enough value in xfer_parms since turning off data type conversion also * turns off background preservation. */ -#ifdef QAK - printf("%s: check 1.0, nelmts=%d\n",FUNC,(int)nelmts); -#endif /* QAK */ if (nelmts!=H5S_select_npoints (file_space)) { HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes"); @@ -1337,59 +1335,34 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, "unable to register types for conversion"); } } - if (FAIL==H5S_find (&sconv_func, mem_space, file_space)) { + if (NULL==(sconv=H5S_find(mem_space, file_space))) { HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert from file to memory data space"); } -#ifdef QAK - printf("%s: check 1.0\n",FUNC); -#endif /* QAK */ - -#ifdef HAVE_PARALLEL - /* - * Check if collective data transfer requested. - */ - if (xfer_parms->xfer_mode == H5D_XFER_COLLECTIVE){ - /* Supports only no conversion, type or space, for now. */ - if (H5T_conv_noop==tconv_func && - NULL!=sconv_func.read) { - status = (sconv_func.read)(dataset->ent.file, &(dataset->layout), - &(dataset->create_parms->pline), - &(dataset->create_parms->efl), - H5T_get_size (dataset->type), - file_space, mem_space, - xfer_parms->xfer_mode, buf/*out*/); - if (status>=0) goto succeed; - HGOTO_ERROR (H5E_DATASET, H5E_READERROR, FAIL, - "collective read failed"); - } - } -#endif /*HAVE_PARALLEL*/ - /* * If there is no type conversion then try reading directly into the * application's buffer. This saves at least one mem-to-mem copy. */ - if (H5D_OPTIMIZE_PIPE && H5T_conv_noop==tconv_func && - NULL!=sconv_func.read) { - status = (sconv_func.read)(dataset->ent.file, &(dataset->layout), - &(dataset->create_parms->pline), - &(dataset->create_parms->efl), - H5T_get_size (dataset->type), file_space, - mem_space, xfer_parms->xfer_mode, - buf/*out*/); + if (H5T_conv_noop==tconv_func && sconv->read) { + status = (sconv->read)(dataset->ent.file, &(dataset->layout), + &(dataset->create_parms->pline), + &(dataset->create_parms->efl), + H5T_get_size (dataset->type), file_space, + mem_space, xfer_parms->xfer_mode, + buf/*out*/); if (status>=0) goto succeed; +#ifdef HAVE_PARALLEL + /* Supports only no conversion, type or space, for now. */ + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, + "collective read failed"); +#endif #ifdef H5D_DEBUG fprintf (stderr, "H5D: data space conversion could not be optimized " - "for this case (using general method instead)\n"); + "for this case (using general method instead)\n"); #endif H5E_clear (); } -#ifdef QAK - printf("%s: check 2.0\n",FUNC); -#endif /* QAK */ - /* * This is the general case. Figure out the strip mine size. @@ -1402,22 +1375,21 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small"); } - if (FAIL == (sconv_func.finit)(&(dataset->layout), - file_space, &file_iter)) { + if ((sconv->f->init)(&(dataset->layout), file_space, &file_iter)<0) { HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to initialize file selection information"); + "unable to initialize file selection information"); } - if (FAIL == (sconv_func.minit)(&(dataset->layout), mem_space, &mem_iter)) { + if ((sconv->m->init)(&(dataset->layout), mem_space, &mem_iter)<0) { HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to initialize memory selection information"); + "unable to initialize memory selection information"); } - if (FAIL == (sconv_func.binit)(&(dataset->layout), mem_space, &bkg_iter)) { + if ((sconv->m->binit)(&(dataset->layout), mem_space, &bkg_iter)<0) { HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to initialize background selection information"); + "unable to initialize background selection information"); } #ifdef QAK printf("%s: check 3.0, request_nelmts=%d\n",FUNC,(int)request_nelmts); -#endif /* QAK */ +#endif /* * Get a temporary buffer for type conversion unless the app has already @@ -1444,45 +1416,46 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, } } -#ifdef H5D_DEBUG - { - /* Strip mine diagnostics.... */ - /* removed because the algorithm changed significantly - QAK */ - } -#endif - #ifdef QAK printf("%s: check 4.0, nelmts=%d, need_bkg=%d\n", FUNC,(int)nelmts,(int)need_bkg); -#endif /* QAK */ +#endif + /* Start strip mining... */ for (smine_start=0; smine_start<nelmts; smine_start+=smine_nelmts) { /* Go figure out how many elements to read from the file */ - smine_nelmts = (sconv_func.favail)(file_space,&file_iter, - MIN(request_nelmts, - (nelmts-smine_start))); + smine_nelmts = (sconv->f->avail)(file_space,&file_iter, + MIN(request_nelmts, + (nelmts-smine_start))); #ifdef QAK printf("%s: check 5.0, nelmts=%d, smine_start=%d, smine_nelmts=%d\n", FUNC,(int)nelmts,(int)smine_start,(int)smine_nelmts); -#endif /* QAK */ +#endif /* * Gather the data from disk into the data type conversion * buffer. Also gather data from application to background buffer * if necessary. */ - if ((sconv_func.fgath)(dataset->ent.file, &(dataset->layout), - &(dataset->create_parms->pline), - &(dataset->create_parms->efl), - H5T_get_size (dataset->type), file_space, &file_iter, - smine_nelmts, xfer_parms->xfer_mode, - tconv_buf/*out*/)!=smine_nelmts) { +#ifdef H5S_DEBUG + H5_timer_begin(&timer); +#endif + n = (sconv->f->gath)(dataset->ent.file, &(dataset->layout), + &(dataset->create_parms->pline), + &(dataset->create_parms->efl), src_type_size, + file_space, &file_iter, smine_nelmts, + xfer_parms->xfer_mode, tconv_buf/*out*/); +#ifdef H5S_DEBUG + H5_timer_end(&(sconv->stats[1].gath_timer), &timer); + sconv->stats[1].gath_nbytes += n * src_type_size; + sconv->stats[1].gath_ncalls++; +#endif + if (n!=smine_nelmts) { HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file gather failed"); } + #ifdef QAK printf("%s: check 6.0\n",FUNC); -#endif /* QAK */ -#ifdef QAK printf("%s: check 6.5\n",FUNC); { int i; @@ -1497,18 +1470,27 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, printf("\n"); } } -#endif /* QAK */ - if ((H5D_OPTIMIZE_PIPE && H5T_BKG_YES==need_bkg) || - (!H5D_OPTIMIZE_PIPE && need_bkg)) { - if ((sconv_func.mgath)(buf, H5T_get_size (mem_type), mem_space, - &bkg_iter, smine_nelmts, - bkg_buf/*out*/)!=smine_nelmts) { +#endif + + if (H5T_BKG_YES==need_bkg) { +#ifdef H5S_DEBUG + H5_timer_begin(&timer); +#endif + n = (sconv->m->gath)(buf, dst_type_size, mem_space, &bkg_iter, + smine_nelmts, bkg_buf/*out*/); +#ifdef H5S_DEBUG + H5_timer_end(&(sconv->stats[1].bkg_timer), &timer); + sconv->stats[1].bkg_nbytes += n * dst_type_size; + sconv->stats[1].bkg_ncalls++; +#endif + if (n!=smine_nelmts) { HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "mem gather failed"); } } + #ifdef QAK printf("%s: check 7.0\n",FUNC); -#endif /* QAK */ +#endif /* * Perform data type conversion. @@ -1529,14 +1511,25 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, #ifdef QAK printf("%s: check 8.0\n",FUNC); -#endif /* QAK */ +#endif + /* * Scatter the data into memory. */ - if ((sconv_func.mscat)(tconv_buf, H5T_get_size (mem_type), mem_space, - &mem_iter, smine_nelmts, buf/*out*/)<0) { +#ifdef H5S_DEBUG + H5_timer_begin(&timer); +#endif + status = (sconv->m->scat)(tconv_buf, dst_type_size, mem_space, + &mem_iter, smine_nelmts, buf/*out*/); +#ifdef H5S_DEBUG + H5_timer_end(&(sconv->stats[1].scat_timer), &timer); + sconv->stats[1].scat_nbytes += smine_nelmts * dst_type_size; + sconv->stats[1].scat_ncalls++; +#endif + if (status<0) { HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "scatter failed"); } + #ifdef QAK printf("%s: check 9.0\n",FUNC); #endif /* QAK */ @@ -1553,12 +1546,9 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, if (src_id >= 0) H5I_dec_ref(src_id); if (dst_id >= 0) H5I_dec_ref(dst_id); - if (tconv_buf && NULL==xfer_parms->tconv_buf) - H5MM_xfree(tconv_buf); - if (bkg_buf && NULL==xfer_parms->bkg_buf) - H5MM_xfree (bkg_buf); - if (free_this_space) - H5S_close (free_this_space); + if (tconv_buf && NULL==xfer_parms->tconv_buf) H5MM_xfree(tconv_buf); + if (bkg_buf && NULL==xfer_parms->bkg_buf) H5MM_xfree (bkg_buf); + if (free_this_space) H5S_close (free_this_space); FUNC_LEAVE(ret_value); } @@ -1589,12 +1579,12 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, { hsize_t nelmts; /*total number of elmts */ size_t smine_start; /*strip mine start loc */ - size_t smine_nelmts; /*elements per strip */ + size_t n, smine_nelmts; /*elements per strip */ uint8 *tconv_buf = NULL; /*data type conv buffer */ uint8 *bkg_buf = NULL; /*background buffer */ H5T_conv_t tconv_func = NULL; /*conversion function */ hid_t src_id = -1, dst_id = -1;/*temporary type atoms */ - H5S_conv_t sconv_func= {NULL}; /*space conversion funcs*/ + H5S_conv_t *sconv=NULL; /*space conversion funcs*/ H5S_sel_iter_t mem_iter; /*memory selection iteration info*/ H5S_sel_iter_t bkg_iter; /*background iteration info*/ H5S_sel_iter_t file_iter; /*file selection iteration info*/ @@ -1653,7 +1643,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access not permissible"); } -#endif /*HAVE_PARALLEL*/ +#endif /* * Locate the type conversion function and data space conversion @@ -1663,9 +1653,6 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, * enough value in xfer_parms since turning off data type conversion also * turns off background preservation. */ -#ifdef QAK - printf("%s: check 0.5, nelmts=%d\n",FUNC,(int)nelmts); -#endif /* QAK */ if (nelmts!=H5S_select_npoints (file_space)) { HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes"); @@ -1683,60 +1670,33 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, "unable to register types for conversion"); } } - if (FAIL==H5S_find (&sconv_func, mem_space, file_space)) { + if (NULL==(sconv=H5S_find(mem_space, file_space))) { HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert from memory to file data space"); } -#ifdef QAK - printf("%s: check 1.0\n",FUNC); -#endif /* QAK */ - -#ifdef HAVE_PARALLEL - /* - * Check if collective data transfer requested. - */ - if (xfer_parms->xfer_mode == H5D_XFER_COLLECTIVE){ - /* Supports only no conversion, type or space, for now. */ - if (H5T_conv_noop==tconv_func && - NULL!=sconv_func.write) { - status = (sconv_func.write)(dataset->ent.file, - &(dataset->layout), - &(dataset->create_parms->pline), - &(dataset->create_parms->efl), - H5T_get_size (dataset->type), - file_space, mem_space, - xfer_parms->xfer_mode, buf); - if (status>=0) goto succeed; - HGOTO_ERROR (H5E_DATASET, H5E_WRITEERROR, FAIL, - "collective write failed"); - } - } -#endif /*HAVE_PARALLEL*/ - /* * If there is no type conversion then try writing directly from * application buffer to file. */ - if (H5D_OPTIMIZE_PIPE && - H5T_conv_noop==tconv_func && - NULL!=sconv_func.write) { - status = (sconv_func.write)(dataset->ent.file, &(dataset->layout), - &(dataset->create_parms->pline), - &(dataset->create_parms->efl), - H5T_get_size (dataset->type), file_space, - mem_space, xfer_parms->xfer_mode, buf); + if (H5T_conv_noop==tconv_func && sconv->write) { + status = (sconv->write)(dataset->ent.file, &(dataset->layout), + &(dataset->create_parms->pline), + &(dataset->create_parms->efl), + H5T_get_size (dataset->type), file_space, + mem_space, xfer_parms->xfer_mode, buf); if (status>=0) goto succeed; +#ifdef HAVE_PARALLEL + /* Supports only no conversion, type or space, for now. */ + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, + "collective write failed"); +#endif #ifdef H5D_DEBUG fprintf (stderr, "H5D: data space conversion could not be optimized " "for this case (using general method instead)\n"); #endif H5E_clear (); } -#ifdef QAK - printf("%s: check 2.0\n",FUNC); -#endif /* QAK */ - /* * This is the general case. Figure out the strip mine size. @@ -1749,21 +1709,22 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small"); } - if (FAIL==(sconv_func.finit)(&(dataset->layout), file_space, &file_iter)) { + if ((sconv->f->init)(&(dataset->layout), file_space, &file_iter)<0) { HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to initialize file selection information"); + "unable to initialize file selection information"); } - if (FAIL == (sconv_func.minit)(&(dataset->layout), mem_space, &mem_iter)) { + if ((sconv->m->init)(&(dataset->layout), mem_space, &mem_iter)<0) { HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to initialize memory selection information"); + "unable to initialize memory selection information"); } - if (FAIL == (sconv_func.binit)(&(dataset->layout), mem_space, &bkg_iter)) { + if ((sconv->m->binit)(&(dataset->layout), mem_space, &bkg_iter)<0) { HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to initialize memory selection information"); - } + "unable to initialize memory selection information"); + } + #ifdef QAK printf("%s: check 3.0, request_nelmts=%d\n",FUNC,(int)request_nelmts); -#endif /* QAK */ +#endif /* * Get a temporary buffer for type conversion unless the app has already @@ -1790,37 +1751,42 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, } } -#ifdef H5D_DEBUG - { - /* Strip mine diagnostics.... */ - /* removed because the algorithm changed significantly - QAK */ - } -#endif #ifdef QAK printf("%s: check 4.0, nelmts=%d, need_bkg=%d\n", FUNC,(int)nelmts,(int)need_bkg); -#endif /* QAK */ +#endif /* Start strip mining... */ for (smine_start=0; smine_start<nelmts; smine_start+=smine_nelmts) { /* Go figure out how many elements to read from the file */ - smine_nelmts = (sconv_func.favail)(file_space,&file_iter, - MIN(request_nelmts, - (nelmts-smine_start))); + smine_nelmts = (sconv->f->avail)(file_space,&file_iter, + MIN(request_nelmts, + (nelmts-smine_start))); + #ifdef QAK printf("%s: check 5.0, nelmts=%d, smine_start=%d, smine_nelmts=%d\n", FUNC,(int)nelmts,(int)smine_start,(int)smine_nelmts); -#endif /* QAK */ +#endif /* * Gather data from application buffer into the data type conversion * buffer. Also gather data from the file into the background buffer * if necessary. */ - if ((sconv_func.mgath)(buf, H5T_get_size (mem_type), mem_space, - &mem_iter, smine_nelmts, tconv_buf/*out*/)!=smine_nelmts) { +#ifdef H5S_DEBUG + H5_timer_begin(&timer); +#endif + n = (sconv->m->gath)(buf, src_type_size, mem_space, &mem_iter, + smine_nelmts, tconv_buf/*out*/); +#ifdef H5S_DEBUG + H5_timer_end(&(sconv->stats[0].gath_timer), &timer); + sconv->stats[0].gath_nbytes += n * src_type_size; + sconv->stats[0].gath_ncalls++; +#endif + if (n!=smine_nelmts) { HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "mem gather failed"); } + #ifdef QAK { int i; @@ -1836,15 +1802,24 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, } } printf("%s: check 6.0\n",FUNC); -#endif /* QAK */ - if ((H5D_OPTIMIZE_PIPE && H5T_BKG_YES==need_bkg) || - (!H5D_OPTIMIZE_PIPE && need_bkg)) { - if ((sconv_func.fgath)(dataset->ent.file, &(dataset->layout), - &(dataset->create_parms->pline), - &(dataset->create_parms->efl), - H5T_get_size (dataset->type), file_space, - &bkg_iter, smine_nelmts, xfer_parms->xfer_mode, - bkg_buf/*out*/)!=smine_nelmts) { +#endif + + if (H5T_BKG_YES==need_bkg) { +#ifdef H5S_DEBUG + H5_timer_begin(&timer); +#endif + n = (sconv->f->gath)(dataset->ent.file, &(dataset->layout), + &(dataset->create_parms->pline), + &(dataset->create_parms->efl), dst_type_size, + file_space, &bkg_iter, smine_nelmts, + xfer_parms->xfer_mode, + bkg_buf/*out*/); +#ifdef H5S_DEBUG + H5_timer_end(&(sconv->stats[0].bkg_timer), &timer); + sconv->stats[0].bkg_nbytes += n * dst_type_size; + sconv->stats[0].bkg_ncalls++; +#endif + if (n!=smine_nelmts) { HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "file gather failed"); } @@ -1870,12 +1845,20 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* * Scatter the data out to the file. */ - if ((sconv_func.fscat)(dataset->ent.file, &(dataset->layout), - &(dataset->create_parms->pline), - &(dataset->create_parms->efl), - H5T_get_size (dataset->type), file_space, - &file_iter, smine_nelmts, - xfer_parms->xfer_mode, tconv_buf)<0) { +#ifdef H5S_DEBUG + H5_timer_begin(&timer); +#endif + status = (sconv->f->scat)(dataset->ent.file, &(dataset->layout), + &(dataset->create_parms->pline), + &(dataset->create_parms->efl), dst_type_size, + file_space, &file_iter, smine_nelmts, + xfer_parms->xfer_mode, tconv_buf); +#ifdef H5S_DEBUG + H5_timer_end(&(sconv->stats[0].scat_timer), &timer); + sconv->stats[0].scat_nbytes += smine_nelmts * dst_type_size; + sconv->stats[0].scat_ncalls++; +#endif + if (status<0) { HGOTO_ERROR (H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed"); } } @@ -1900,12 +1883,9 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, if (src_id >= 0) H5I_dec_ref(src_id); if (dst_id >= 0) H5I_dec_ref(dst_id); - if (tconv_buf && NULL==xfer_parms->tconv_buf) - H5MM_xfree(tconv_buf); - if (bkg_buf && NULL==xfer_parms->bkg_buf) - H5MM_xfree (bkg_buf); - if (free_this_space) - H5S_close (free_this_space); + if (tconv_buf && NULL==xfer_parms->tconv_buf) H5MM_xfree(tconv_buf); + if (bkg_buf && NULL==xfer_parms->bkg_buf) H5MM_xfree (bkg_buf); + if (free_this_space) H5S_close (free_this_space); FUNC_LEAVE(ret_value); } diff --git a/src/H5Distore.c b/src/H5Distore.c index e77aabc..3c858bd 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -754,6 +754,7 @@ H5F_istore_flush_entry (H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) * even if we can't write the data to disk. */ point_of_no_return = TRUE; + ent->chunk = NULL; } if (H5Z_pipeline(f, ent->pline, 0, &(udata.key.filter_mask), &(udata.key.nbytes), &alloc, &buf)<0) { @@ -1274,6 +1275,7 @@ H5F_istore_unlock (H5F_t *f, const H5O_layout_t *layout, x.offset[i] = offset[i]; x.chunk_size *= layout->dim[i]; } + x.alloc_size = x.chunk_size; x.chunk = chunk; H5F_istore_flush_entry (f, &x, TRUE); } else { diff --git a/src/H5Fistore.c b/src/H5Fistore.c index e77aabc..3c858bd 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -754,6 +754,7 @@ H5F_istore_flush_entry (H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) * even if we can't write the data to disk. */ point_of_no_return = TRUE; + ent->chunk = NULL; } if (H5Z_pipeline(f, ent->pline, 0, &(udata.key.filter_mask), &(udata.key.nbytes), &alloc, &buf)<0) { @@ -1274,6 +1275,7 @@ H5F_istore_unlock (H5F_t *f, const H5O_layout_t *layout, x.offset[i] = offset[i]; x.chunk_size *= layout->dim[i]; } + x.alloc_size = x.chunk_size; x.chunk = chunk; H5F_istore_flush_entry (f, &x, TRUE); } else { @@ -30,6 +30,15 @@ static intn interface_initialize_g = FALSE; static herr_t H5S_init_interface(void); static void H5S_term_interface(void); +/* Tables of file and memory conversion information */ +static const H5S_fconv_t *H5S_fconv_g[H5S_SEL_N]; +static const H5S_mconv_t *H5S_mconv_g[H5S_SEL_N]; + +/* The path table, variable length */ +static H5S_conv_t **H5S_conv_g = NULL; +static size_t H5S_aconv_g = 0; /*entries allocated*/ +static size_t H5S_nconv_g = 0; /*entries used*/ + /*-------------------------------------------------------------------------- NAME @@ -54,6 +63,15 @@ H5S_init_interface(void) H5S_RESERVED_ATOMS, (herr_t (*)(void *)) H5S_close)) != FAIL) { ret_value = H5_add_exit(&H5S_term_interface); } + + /* Register space conversion functions */ + if (H5S_register(H5S_SEL_POINTS, H5S_POINT_FCONV, H5S_POINT_MCONV)<0 || + H5S_register(H5S_SEL_ALL, H5S_ALL_FCONV, H5S_ALL_MCONV) <0 || + H5S_register(H5S_SEL_HYPERSLABS, H5S_HYPER_FCONV, H5S_HYPER_MCONV)<0) { + HRETURN_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, + "unable to register one or more conversion functions"); + } + FUNC_LEAVE(ret_value); } @@ -78,8 +96,139 @@ H5S_init_interface(void) static void H5S_term_interface(void) { + size_t i; + int j, nprints=0; + H5S_conv_t *path=NULL; + char buf[256]; + +#ifdef H5S_DEBUG + /* + * Print statistics about each conversion path. + */ + for (i=0; i<H5S_nconv_g; i++) { + path = H5S_conv_g[i]; + for (j=0; j<2; j++) { + if (0==path->stats[j].gath_ncalls && + 0==path->stats[j].scat_ncalls && + 0==path->stats[j].bkg_ncalls) { + continue; + } + if (0==nprints++) { + fprintf(stderr, "H5S: data space conversion statistics " + "accumulated over life of library:\n"); + fprintf(stderr, " %-16s %10s %10s %8s %8s %8s %10s\n", + "Memory <> File", "Bytes", "Calls", + "User", "System", "Elapsed", "Bandwidth"); + fprintf(stderr, " %-16s %10s %10s %8s %8s %8s %10s\n", + "--------------", "-----", "-----", + "----", "------", "-------", "---------"); + } + + /* Summary */ + sprintf(buf, "%s %c %s", + path->m->name, 0==j?'>':'<', path->f->name); + fprintf(stderr, " %-16s\n", buf); + + /* Gather */ + if (path->stats[j].gath_ncalls) { + H5_bandwidth(buf, (double)(path->stats[j].gath_nbytes), + path->stats[j].gath_timer.etime); + HDfprintf(stderr, + " %16s %10Hu %10Hu %8.2f %8.2f %8.2f %10s\n", + "gather", + path->stats[j].gath_nbytes, + path->stats[j].gath_ncalls, + path->stats[j].gath_timer.utime, + path->stats[j].gath_timer.stime, + path->stats[j].gath_timer.etime, + buf); + } + + /* Scatter */ + if (path->stats[j].scat_ncalls) { + H5_bandwidth(buf, (double)(path->stats[j].scat_nbytes), + path->stats[j].scat_timer.etime); + HDfprintf(stderr, + " %16s %10Hu %10Hu %8.2f %8.2f %8.2f %10s\n", + "scatter", + path->stats[j].scat_nbytes, + path->stats[j].scat_ncalls, + path->stats[j].scat_timer.utime, + path->stats[j].scat_timer.stime, + path->stats[j].scat_timer.etime, + buf); + } + + /* Background */ + if (path->stats[j].bkg_ncalls) { + H5_bandwidth(buf, (double)(path->stats[j].bkg_nbytes), + path->stats[j].bkg_timer.etime); + HDfprintf(stderr, + " %16s %10Hu %10Hu %8.2f %8.2f %8.2f %10s\n", + "background", + path->stats[j].bkg_nbytes, + path->stats[j].bkg_ncalls, + path->stats[j].bkg_timer.utime, + path->stats[j].bkg_timer.stime, + path->stats[j].bkg_timer.etime, + buf); + } + } + } +#endif + + /* Free data types */ H5I_destroy_group(H5_DATASPACE); + + /* Clear/free conversion table */ + HDmemset(H5S_fconv_g, 0, sizeof(H5S_fconv_g)); + HDmemset(H5S_mconv_g, 0, sizeof(H5S_mconv_g)); + H5S_conv_g = H5MM_xfree(H5S_conv_g); + H5S_nconv_g = H5S_aconv_g = 0; +} + + +/*------------------------------------------------------------------------- + * Function: H5S_register + * + * Purpose: Adds information about a data space conversion to the space + * conversion table. A space conversion has two halves: the + * half that copies data points between application memory and + * the type conversion array, and the half that copies points + * between the type conversion array and the file. Both halves + * are required. + * + * Note: The conversion table will contain pointers to the file and + * memory conversion info. The FCONV and MCONV arguments are + * not copied. + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Tuesday, August 11, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5S_register(H5S_sel_type cls, const H5S_fconv_t *fconv, + const H5S_mconv_t *mconv) +{ + FUNC_ENTER(H5S_register, FAIL); + + assert(cls>=0 && cls<H5S_SEL_N); + assert(fconv); + assert(mconv); + + H5S_fconv_g[cls] = fconv; + H5S_mconv_g[cls] = mconv; + + FUNC_LEAVE(SUCCEED); } + /*-------------------------------------------------------------------------- NAME @@ -1246,12 +1395,10 @@ H5S_set_extent_simple (H5S_t *space, int rank, const hsize_t *dims, * Function: H5S_find * * Purpose: Given two data spaces (MEM_SPACE and FILE_SPACE) this - * function locates the data space conversion functions and - * initializes CONV to point to them. The CONV contains - * function pointers for converting in either direction. - * - * Return: Success: Pointer to a data space conversion callback - * list. + * function returns a pointer to the conversion path information, + * creating a new conversion path entry if necessary. + * + * Return: Success: Ptr to a conversion path entry * * Failure: NULL * @@ -1260,15 +1407,29 @@ H5S_set_extent_simple (H5S_t *space, int rank, const hsize_t *dims, * * Modifications: * + * Quincey Koziol + * Instead of returning a point into the data space conversion table we + * copy all the information into a user-supplied CONV buffer and return + * SUCCEED or FAIL. + * + * Robb Matzke, 11 Aug 1998 + * Returns a pointer into the conversion path table. A path entry + * contains pointers to the memory and file half of the conversion (the + * pointers registered in the H5S_fconv_g[] and H5S_mconv_g[] tables) + * along with other data whose scope is the conversion path (like path + * statistics). + * *------------------------------------------------------------------------- */ -herr_t -H5S_find (H5S_conv_t *conv, const H5S_t *mem_space, const H5S_t *file_space) +H5S_conv_t * +H5S_find (const H5S_t *mem_space, const H5S_t *file_space) { - FUNC_ENTER (H5S_find, FAIL); + size_t i; + H5S_conv_t *path; + + FUNC_ENTER (H5S_find, NULL); /* Check args */ - assert (conv); assert (mem_space && (H5S_SIMPLE==mem_space->extent.type || H5S_SCALAR==mem_space->extent.type)); assert (file_space && (H5S_SIMPLE==file_space->extent.type || @@ -1279,124 +1440,61 @@ H5S_find (H5S_conv_t *conv, const H5S_t *mem_space, const H5S_t *file_space) * different number of data points. */ if (H5S_select_npoints (mem_space) != H5S_select_npoints (file_space)) { - HRETURN_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, + HRETURN_ERROR (H5E_DATASPACE, H5E_BADRANGE, NULL, "memory and file data spaces are different sizes"); } -#ifdef OLD_WAY /* - * Initialize pointers. This will eventually be a table lookup based - * on the source and destination data spaces, similar to H5T_find(), but - * for now we only support simple data spaces. + * Is this path already present in the data space conversion path table? + * If so then return a pointer to that entry. */ - if (!conv) { - _conv.init = H5S_simp_init; - _conv.fgath = H5S_simp_fgath; - _conv.mscat = H5S_simp_mscat; - _conv.mgath = H5S_simp_mgath; - _conv.fscat = H5S_simp_fscat; - _conv.read = H5S_simp_read; - _conv.write = H5S_simp_write; - conv = &_conv; + for (i=0; i<H5S_nconv_g; i++) { + if (H5S_conv_g[i]->f->type==file_space->select.type && + H5S_conv_g[i]->m->type==mem_space->select.type) { + HRETURN(H5S_conv_g[i]); + } + } + + /* + * The path wasn't found. Do we have enough information to create a new + * path? + */ + if (NULL==H5S_fconv_g[file_space->select.type] || + NULL==H5S_mconv_g[mem_space->select.type]) { + HRETURN_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, NULL, + "unable to convert between data space selections"); } -#else - /* Set up the function pointers for file transfers */ - switch(file_space->select.type) { - case H5S_SEL_POINTS: -#ifdef QAK - printf("%s: file space has point selection\n",FUNC); -#endif /* QAK */ - conv->finit = H5S_point_init; - conv->favail = H5S_point_favail; - conv->fgath = H5S_point_fgath; - conv->fscat = H5S_point_fscat; - conv->read = NULL; - conv->write = NULL; - break; - - case H5S_SEL_ALL: -#ifdef QAK - printf("%s: file space has all selection\n",FUNC); -#endif /* QAK */ - conv->finit = H5S_all_init; - conv->favail = H5S_all_favail; - conv->fgath = H5S_all_fgath; - conv->fscat = H5S_all_fscat; - conv->read = NULL; - conv->write = NULL; - break; - - case H5S_SEL_HYPERSLABS: -#ifdef QAK - printf("%s: file space has hyperslab selection\n",FUNC); -#endif /* QAK */ - conv->finit = H5S_hyper_init; - conv->favail = H5S_hyper_favail; - conv->fgath = H5S_hyper_fgath; - conv->fscat = H5S_hyper_fscat; - conv->read = NULL; - conv->write = NULL; - break; - - case H5S_SEL_NONE: - default: -#ifdef QAK - printf("%s: file space has unknown selection\n",FUNC); -#endif /* QAK */ - HRETURN_ERROR (H5E_DATASPACE, H5E_BADVALUE, FAIL, - "invalid file dataspace selection type"); - } /* end switch */ - - /* Set up the function pointers for background & memory transfers */ - switch(mem_space->select.type) { - case H5S_SEL_POINTS: -#ifdef QAK - printf("%s: memory space has point selection\n",FUNC); -#endif /* QAK */ - conv->minit = H5S_point_init; - conv->binit = H5S_point_init; - conv->mgath = H5S_point_mgath; - conv->mscat = H5S_point_mscat; - conv->read = NULL; - conv->write = NULL; - break; - case H5S_SEL_ALL: -#ifdef QAK - printf("%s: memory space has all selection\n",FUNC); -#endif /* QAK */ - conv->minit = H5S_all_init; - conv->binit = H5S_all_init; - conv->mgath = H5S_all_mgath; - conv->mscat = H5S_all_mscat; - conv->read = NULL; - conv->write = NULL; - break; + /* + * Extend the table. + */ + if (H5S_nconv_g>=H5S_aconv_g) { + size_t n = MAX(10, 2*H5S_aconv_g); + H5S_conv_t **p = H5MM_realloc(H5S_conv_g, n*sizeof(H5S_conv_g[0])); + if (NULL==p) { + HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + "memory allocation failed for data space conversion " + "path table"); + } + H5S_aconv_g = n; + H5S_conv_g = p; + } - case H5S_SEL_HYPERSLABS: -#ifdef QAK - printf("%s: memory space has hyperslab selection\n",FUNC); -#endif /* QAK */ - conv->minit = H5S_hyper_init; - conv->binit = H5S_hyper_init; - conv->mgath = H5S_hyper_mgath; - conv->mscat = H5S_hyper_mscat; - conv->read = NULL; - conv->write = NULL; - break; + /* + * Create a new path and add it to the table. + */ + if (NULL==(path = H5MM_calloc(sizeof(*path)))) { + HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + "memory allocation failed for data space conversion " + "path"); + } + path->f = H5S_fconv_g[file_space->select.type]; + path->m = H5S_mconv_g[mem_space->select.type]; + H5S_conv_g[H5S_nconv_g++] = path; - case H5S_SEL_NONE: - default: -#ifdef QAK - printf("%s: memory space has unknown selection\n",FUNC); -#endif /* QAK */ - HRETURN_ERROR (H5E_DATASPACE, H5E_BADVALUE, FAIL, - "invalid file dataspace selection type"); - } /* end switch */ -#endif /* OLD_WAY */ - - FUNC_LEAVE (SUCCEED); + FUNC_LEAVE(path); } + /*------------------------------------------------------------------------- * Function: H5S_extend diff --git a/src/H5Sall.c b/src/H5Sall.c index 467ed2e..df7b349 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -17,6 +17,49 @@ #define INTERFACE_INIT NULL static intn interface_initialize_g = FALSE; +static herr_t H5S_all_init (const struct H5O_layout_t *layout, + const H5S_t *space, H5S_sel_iter_t *iter); +static size_t H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *iter, + size_t max); +static size_t H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, + const struct H5O_efl_t *efl, size_t elmt_size, + const H5S_t *file_space, + H5S_sel_iter_t *file_iter, size_t nelmts, + const H5D_transfer_t xfer_mode, + void *buf/*out*/); +static herr_t H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, + const struct H5O_efl_t *efl, size_t elmt_size, + const H5S_t *file_space, + H5S_sel_iter_t *file_iter, size_t nelmts, + const H5D_transfer_t xfer_mode, + const void *buf); +static size_t H5S_all_mgath (const void *_buf, size_t elmt_size, + const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, + size_t nelmts, void *_tconv_buf/*out*/); +static herr_t H5S_all_mscat (const void *_tconv_buf, size_t elmt_size, + const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, + size_t nelmts, void *_buf/*out*/); + +const H5S_fconv_t H5S_ALL_FCONV[1] = {{ + "all", /*name */ + H5S_SEL_ALL, /*selection type */ + H5S_all_init, /*initialize */ + H5S_all_favail, /*available */ + H5S_all_fgath, /*gather */ + H5S_all_fscat, /*scatter */ +}}; + +const H5S_mconv_t H5S_ALL_MCONV[1] = {{ + "all", /*name */ + H5S_SEL_ALL, /*selection type */ + H5S_all_init, /*initialize */ + H5S_all_init, /*initialize background */ + H5S_all_mgath, /*gather */ + H5S_all_mscat, /*scatter */ +}}; + /*------------------------------------------------------------------------- * Function: H5S_all_init * @@ -31,7 +74,7 @@ static intn interface_initialize_g = FALSE; * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5S_all_init (const struct H5O_layout_t __unused__ *layout, const H5S_t *space, H5S_sel_iter_t *sel_iter) { @@ -67,7 +110,7 @@ H5S_all_init (const struct H5O_layout_t __unused__ *layout, * *------------------------------------------------------------------------- */ -size_t +static size_t H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *sel_iter, size_t max) { hsize_t nelmts; @@ -123,7 +166,7 @@ H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *sel_iter, size_t max) * *------------------------------------------------------------------------- */ -size_t +static size_t H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, @@ -213,7 +256,7 @@ H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout, * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, @@ -299,7 +342,7 @@ H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout, * *------------------------------------------------------------------------- */ -size_t +static size_t H5S_all_mgath (const void *_buf, size_t elmt_size, const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, size_t nelmts, void *_tconv_buf/*out*/) @@ -389,7 +432,7 @@ H5S_all_mgath (const void *_buf, size_t elmt_size, * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5S_all_mscat (const void *_tconv_buf, size_t elmt_size, const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, size_t nelmts, void *_buf/*out*/) diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 5c6ddf3..52b8c5f 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -41,11 +41,56 @@ static intn H5S_hyper_bsearch(hssize_t size, H5S_hyper_bound_t *barr, size_t count); static H5S_hyper_region_t * H5S_hyper_get_regions (size_t *num_regions, intn dim, size_t bound_count, - H5S_hyper_bound_t **lo_bounds, H5S_hyper_bound_t **hi_bounds, hssize_t *pos, - hssize_t *offset); + H5S_hyper_bound_t **lo_bounds, + H5S_hyper_bound_t **hi_bounds, hssize_t *pos, + hssize_t *offset); static size_t H5S_hyper_fread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info); static size_t H5S_hyper_fwrite (intn dim, H5S_hyper_fhyper_info_t *fhyper_info); +static herr_t H5S_hyper_init (const struct H5O_layout_t *layout, + const H5S_t *space, H5S_sel_iter_t *iter); +static size_t H5S_hyper_favail (const H5S_t *space, const H5S_sel_iter_t *iter, + size_t max); +static size_t H5S_hyper_fgath (H5F_t *f, const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, + const struct H5O_efl_t *efl, size_t elmt_size, + const H5S_t *file_space, + H5S_sel_iter_t *file_iter, size_t nelmts, + const H5D_transfer_t xfer_mode, + void *buf/*out*/); +static herr_t H5S_hyper_fscat (H5F_t *f, const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, + const struct H5O_efl_t *efl, size_t elmt_size, + const H5S_t *file_space, + H5S_sel_iter_t *file_iter, size_t nelmts, + const H5D_transfer_t xfer_mode, + const void *buf); +static size_t H5S_hyper_mgath (const void *_buf, size_t elmt_size, + const H5S_t *mem_space, + H5S_sel_iter_t *mem_iter, size_t nelmts, + void *_tconv_buf/*out*/); +static herr_t H5S_hyper_mscat (const void *_tconv_buf, size_t elmt_size, + const H5S_t *mem_space, + H5S_sel_iter_t *mem_iter, size_t nelmts, + void *_buf/*out*/); + +const H5S_fconv_t H5S_HYPER_FCONV[1] = {{ + "hslab", /*name */ + H5S_SEL_HYPERSLABS, /*selection type */ + H5S_hyper_init, /*initialize */ + H5S_hyper_favail, /*available */ + H5S_hyper_fgath, /*gather */ + H5S_hyper_fscat, /*scatter */ +}}; + +const H5S_mconv_t H5S_HYPER_MCONV[1] = {{ + "hslab", /*name */ + H5S_SEL_HYPERSLABS, /*selection type */ + H5S_hyper_init, /*initialize */ + H5S_hyper_init, /*initialize background */ + H5S_hyper_mgath, /*gather */ + H5S_hyper_mscat, /*scatter */ +}}; /*------------------------------------------------------------------------- @@ -62,7 +107,7 @@ static size_t H5S_hyper_fwrite (intn dim, * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5S_hyper_init (const struct H5O_layout_t __unused__ *layout, const H5S_t *space, H5S_sel_iter_t *sel_iter) { @@ -100,7 +145,7 @@ H5S_hyper_init (const struct H5O_layout_t __unused__ *layout, * *------------------------------------------------------------------------- */ -size_t +static size_t H5S_hyper_favail (const H5S_t __unused__ *space, const H5S_sel_iter_t *sel_iter, size_t max) { @@ -545,7 +590,7 @@ H5S_hyper_fread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) * *------------------------------------------------------------------------- */ -size_t +static size_t H5S_hyper_fgath (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, size_t elmt_size, @@ -776,7 +821,7 @@ H5S_hyper_fwrite (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5S_hyper_fscat (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, size_t elmt_size, @@ -1031,7 +1076,7 @@ H5S_hyper_mread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) * *------------------------------------------------------------------------- */ -size_t +static size_t H5S_hyper_mgath (const void *_buf, size_t elmt_size, const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, size_t nelmts, void *_tconv_buf/*out*/) @@ -1304,7 +1349,7 @@ H5S_hyper_mwrite (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5S_hyper_mscat (const void *_tconv_buf, size_t elmt_size, const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, size_t nelmts, void *_buf/*out*/) diff --git a/src/H5Spoint.c b/src/H5Spoint.c index cfde236..981e78f 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -18,6 +18,53 @@ #define INTERFACE_INIT NULL static intn interface_initialize_g = FALSE; +static herr_t H5S_point_init (const struct H5O_layout_t *layout, + const H5S_t *space, H5S_sel_iter_t *iter); +static size_t H5S_point_favail (const H5S_t *space, const H5S_sel_iter_t *iter, + size_t max); +static size_t H5S_point_fgath (H5F_t *f, const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, + const struct H5O_efl_t *efl, size_t elmt_size, + const H5S_t *file_space, + H5S_sel_iter_t *file_iter, size_t nelmts, + const H5D_transfer_t xfer_mode, + void *buf/*out*/); +static herr_t H5S_point_fscat (H5F_t *f, const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, + const struct H5O_efl_t *efl, size_t elmt_size, + const H5S_t *file_space, + H5S_sel_iter_t *file_iter, size_t nelmts, + const H5D_transfer_t xfer_mode, + const void *buf); +static size_t H5S_point_mgath (const void *_buf, size_t elmt_size, + const H5S_t *mem_space, + H5S_sel_iter_t *mem_iter, size_t nelmts, + void *_tconv_buf/*out*/); +static herr_t H5S_point_mscat (const void *_tconv_buf, size_t elmt_size, + const H5S_t *mem_space, + H5S_sel_iter_t *mem_iter, size_t nelmts, + void *_buf/*out*/); + +const H5S_fconv_t H5S_POINT_FCONV[1] = {{ + "point", /*name */ + H5S_SEL_POINTS, /*selection type */ + H5S_point_init, /*initialize */ + H5S_point_favail, /*available */ + H5S_point_fgath, /*gather */ + H5S_point_fscat, /*scatter */ +}}; + +const H5S_mconv_t H5S_POINT_MCONV[1] = {{ + "point", /*name */ + H5S_SEL_POINTS, /*selection type */ + H5S_point_init, /*initialize */ + H5S_point_init, /*initialize background */ + H5S_point_mgath, /*gather */ + H5S_point_mscat, /*scatter */ +}}; + + + /*------------------------------------------------------------------------- * Function: H5S_point_init * @@ -32,7 +79,7 @@ static intn interface_initialize_g = FALSE; * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5S_point_init (const struct H5O_layout_t __unused__ *layout, const H5S_t *space, H5S_sel_iter_t *sel_iter) { @@ -54,6 +101,7 @@ H5S_point_init (const struct H5O_layout_t __unused__ *layout, FUNC_LEAVE (SUCCEED); } + /*-------------------------------------------------------------------------- NAME @@ -169,8 +217,9 @@ done: * *------------------------------------------------------------------------- */ -size_t -H5S_point_favail (const H5S_t __unused__ *space, const H5S_sel_iter_t *sel_iter, size_t max) +static size_t +H5S_point_favail (const H5S_t __unused__ *space, + const H5S_sel_iter_t *sel_iter, size_t max) { FUNC_ENTER (H5S_point_favail, FAIL); @@ -213,7 +262,7 @@ H5S_point_favail (const H5S_t __unused__ *space, const H5S_sel_iter_t *sel_iter, * *------------------------------------------------------------------------- */ -size_t +static size_t H5S_point_fgath (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, size_t elmt_size, @@ -322,7 +371,7 @@ H5S_point_fgath (H5F_t *f, const struct H5O_layout_t *layout, * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5S_point_fscat (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, size_t elmt_size, @@ -439,7 +488,7 @@ H5S_point_fscat (H5F_t *f, const struct H5O_layout_t *layout, * *------------------------------------------------------------------------- */ -size_t +static size_t H5S_point_mgath (const void *_buf, size_t elmt_size, const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, size_t nelmts, void *_tconv_buf/*out*/) @@ -517,7 +566,7 @@ H5S_point_mgath (const void *_buf, size_t elmt_size, * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5S_point_mscat (const void *_tconv_buf, size_t elmt_size, const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, size_t nelmts, void *_buf/*out*/) diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index f7f398f..7969822 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -52,10 +52,12 @@ typedef struct { */ /* Enumerated type for the type of selection */ typedef enum { - H5S_SEL_NONE, /* Nothing selected */ - H5S_SEL_POINTS, /* Sequence of points selected */ - H5S_SEL_HYPERSLABS, /* Hyperslab selection defined */ - H5S_SEL_ALL /* Entire extent selected */ + H5S_SEL_ERROR = -1, /* Error */ + H5S_SEL_NONE = 0, /* Nothing selected */ + H5S_SEL_POINTS = 1, /* Sequence of points selected */ + H5S_SEL_HYPERSLABS = 2, /* Hyperslab selection defined */ + H5S_SEL_ALL = 3, /* Entire extent selected */ + H5S_SEL_N = 4 /*THIS MUST BE LAST */ }H5S_sel_type; /* Node in point selection list */ @@ -140,54 +142,75 @@ typedef struct H5S_t { } H5S_t; /* - * Callbacks for data space conversion. + * Data space conversions usually take place in two halves. One half + * transfers data points between memory and a data type conversion array + * where the points are contiguous, and the other half transfers points + * between the type conversion array and the file. */ -typedef struct H5S_tconv_t { +typedef struct H5S_fconv_t { + /* Identification */ + const char *name; + H5S_sel_type type; + /* Initialize file element numbering information */ - herr_t (*finit)(const struct H5O_layout_t *layout, const H5S_t *space, - H5S_sel_iter_t *iter); + herr_t (*init)(const struct H5O_layout_t *layout, const H5S_t *space, + H5S_sel_iter_t *iter); + + /* Determine optimal number of elements to transfer */ + size_t (*avail)(const H5S_t *file_space, const H5S_sel_iter_t *file_iter, + size_t max); + + /* Gather elements from disk to type conversion buffer */ + size_t (*gath)(H5F_t *f, const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, + const struct H5O_efl_t *efl, size_t elmt_size, + const H5S_t *file_space, H5S_sel_iter_t *file_iter, + size_t nelmts, const H5D_transfer_t xfer_mode, + void *tconv_buf/*out*/); + /* Scatter elements from type conversion buffer to disk */ + herr_t (*scat)(H5F_t *f, const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, + const struct H5O_efl_t *efl, size_t elmt_size, + const H5S_t *file_space, H5S_sel_iter_t *file_iter, + size_t nelmts, const H5D_transfer_t xfer_mode, + const void *tconv_buf); +} H5S_fconv_t; + +typedef struct H5S_mconv_t { + /* Identification */ + const char *name; + H5S_sel_type type; + /* Initialize memory element numbering information */ - herr_t (*minit)(const struct H5O_layout_t *layout, const H5S_t *space, - H5S_sel_iter_t *iter); + herr_t (*init)(const struct H5O_layout_t *layout, const H5S_t *space, + H5S_sel_iter_t *iter); /* Initialize background element numbering information */ herr_t (*binit)(const struct H5O_layout_t *layout, const H5S_t *space, H5S_sel_iter_t *iter); - /* - * Figure out the optimal number of elements to transfer to/from the - * file. - */ - size_t (*favail)(const H5S_t *file_space, const H5S_sel_iter_t *file_iter, - size_t max); - - /* Gather elements from disk to type conversion buffer */ - size_t (*fgath)(H5F_t *f, const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_efl_t *efl, size_t elmt_size, - const H5S_t *file_space, H5S_sel_iter_t *file_iter, - size_t nelmts, - const H5D_transfer_t xfer_mode, void *tconv_buf/*out*/); - - /* Scatter elements from type conversion buffer to disk */ - herr_t (*fscat)(H5F_t *f, const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_efl_t *efl, size_t elmt_size, - const H5S_t *file_space, H5S_sel_iter_t *file_iter, - size_t nelmts, - const H5D_transfer_t xfer_mode, const void *tconv_buf); - /* Gather elements from app buffer to type conversion buffer */ - size_t (*mgath)(const void *buf, size_t elmt_size, - const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, - size_t nelmts, void *tconv_buf/*out*/); + size_t (*gath)(const void *buf, size_t elmt_size, + const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, + size_t nelmts, void *tconv_buf/*out*/); /* Scatter elements from type conversion buffer to application buffer */ - herr_t (*mscat)(const void *tconv_buf, size_t elmt_size, - const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, - size_t nelmts, void *buf/*out*/); + herr_t (*scat)(const void *tconv_buf, size_t elmt_size, + const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, + size_t nelmts, void *buf/*out*/); +} H5S_mconv_t; +typedef struct H5S_conv_t { + const H5S_fconv_t *f; + const H5S_mconv_t *m; + + /* + * If there is no data type conversion then it might be possible to + * transfer data points between application memory and the file in one + * step without going through the data type conversion buffer. + */ + /* Read from file to application w/o intermediate scratch buffer */ herr_t (*read)(H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, @@ -201,8 +224,34 @@ typedef struct H5S_tconv_t { const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, const H5S_t *mem_space, const H5D_transfer_t xfer_mode, const void *buf); + +#ifdef H5S_DEBUG + struct { + H5_timer_t scat_timer; /*time spent scattering */ + hsize_t scat_nbytes; /*scatter throughput */ + hsize_t scat_ncalls; /*number of calls */ + H5_timer_t gath_timer; /*time spent gathering */ + hsize_t gath_nbytes; /*gather throughput */ + hsize_t gath_ncalls; /*number of calls */ + H5_timer_t bkg_timer; /*time for background */ + hsize_t bkg_nbytes; /*background throughput */ + hsize_t bkg_ncalls; /*number of calls */ + } stats[2]; /* 0=output, 1=input */ +#endif } H5S_conv_t; +/* Conversion information for the various data space selection types */ +extern const H5S_fconv_t H5S_POINT_FCONV[]; +extern const H5S_mconv_t H5S_POINT_MCONV[]; +extern const H5S_fconv_t H5S_ALL_FCONV[]; +extern const H5S_mconv_t H5S_ALL_MCONV[]; +extern const H5S_fconv_t H5S_HYPER_FCONV[]; +extern const H5S_mconv_t H5S_HYPER_MCONV[]; + +#ifdef LATER_ROBB +#endif + + H5S_t *H5S_create (H5S_class_t type); H5S_t *H5S_copy (const H5S_t *src); herr_t H5S_close_simple (H5S_simple_t *simple); @@ -217,7 +266,7 @@ H5S_t *H5S_read (H5G_entry_t *ent); intn H5S_cmp (const H5S_t *ds1, const H5S_t *ds2); hbool_t H5S_is_simple (const H5S_t *sdim); uintn H5S_nelem (const H5S_t *space); -herr_t H5S_find (H5S_conv_t *conv, const H5S_t *mem_space, const H5S_t *file_space); +H5S_conv_t *H5S_find (const H5S_t *mem_space, const H5S_t *file_space); intn H5S_get_hyperslab (const H5S_t *ds, hssize_t offset[]/*out*/, hsize_t size[]/*out*/, hsize_t stride[]/*out*/); herr_t H5S_release_simple(H5S_simple_t *simple); @@ -233,63 +282,10 @@ herr_t H5S_set_extent_simple (H5S_t *space, int rank, const hsize_t *dims, hbool_t H5S_select_valid (const H5S_t *space); herr_t H5S_debug(H5F_t *f, const void *_mesg, FILE *stream, intn indent, intn fwidth); - -/* Conversion functions for simple data spaces */ -size_t H5S_simp_init (const struct H5O_layout_t *layout, - const H5S_t *mem_space, const H5S_t *file_space, - size_t desired_nelmts); -size_t H5S_simp_fgath (H5F_t *f, const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_efl_t *efl, size_t elmt_size, - const H5S_t *file_space, - size_t start, size_t nelmts, - const H5D_transfer_t xfer_mode, void *tconv_buf/*out*/); -herr_t H5S_simp_mscat (const void *tconv_buf, size_t elmt_size, - const H5S_t *mem_space, - size_t start, size_t nelmts, void *buf/*out*/); -size_t H5S_simp_mgath (const void *buf, size_t elmt_size, - const H5S_t *mem_space, - size_t start, size_t nelmts, void *tconv_buf/*out*/); -herr_t H5S_simp_fscat (H5F_t *f, const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_efl_t *efl, size_t elmt_size, - const H5S_t *file_space, - size_t start, size_t nelmts, - const H5D_transfer_t xfer_mode, const void *tconv_buf); -herr_t H5S_simp_read (H5F_t *f, const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_efl_t *efl, size_t elmt_size, - const H5S_t *file_space, const H5S_t *mem_space, - const H5D_transfer_t xfer_mode, void *buf/*out*/); -herr_t H5S_simp_write (H5F_t *f, const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_efl_t *efl, size_t elmt_size, - const H5S_t *file_space, const H5S_t *mem_space, - const H5D_transfer_t xfer_mode, const void *buf); +herr_t H5S_register(H5S_sel_type cls, const H5S_fconv_t *fconv, + const H5S_mconv_t *mconv); /* Point select functions */ -herr_t H5S_point_init (const struct H5O_layout_t *layout, - const H5S_t *space, H5S_sel_iter_t *iter); -size_t H5S_point_favail (const H5S_t *space, const H5S_sel_iter_t *iter, - size_t max); -size_t H5S_point_fgath (H5F_t *f, const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_efl_t *efl, size_t elmt_size, - const H5S_t *file_space, H5S_sel_iter_t *file_iter, - size_t nelmts, const H5D_transfer_t xfer_mode, - void *buf/*out*/); -herr_t H5S_point_fscat (H5F_t *f, const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_efl_t *efl, size_t elmt_size, - const H5S_t *file_space, H5S_sel_iter_t *file_iter, - size_t nelmts, const H5D_transfer_t xfer_mode, - const void *buf); -size_t H5S_point_mgath (const void *_buf, size_t elmt_size, - const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, - size_t nelmts, void *_tconv_buf/*out*/); -herr_t H5S_point_mscat (const void *_tconv_buf, size_t elmt_size, - const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, - size_t nelmts, void *_buf/*out*/); herr_t H5S_point_add (H5S_t *space, size_t num_elemn, const hssize_t **coord); herr_t H5S_point_release (H5S_t *space); hsize_t H5S_point_npoints (const H5S_t *space); @@ -297,54 +293,10 @@ herr_t H5S_point_copy (H5S_t *dst, const H5S_t *src); hbool_t H5S_point_select_valid (const H5S_t *space); /* "All" select functions */ -herr_t H5S_all_init (const struct H5O_layout_t *layout, - const H5S_t *space, H5S_sel_iter_t *iter); -size_t H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *iter, - size_t max); -size_t H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_efl_t *efl, size_t elmt_size, - const H5S_t *file_space, H5S_sel_iter_t *file_iter, - size_t nelmts, const H5D_transfer_t xfer_mode, - void *buf/*out*/); -herr_t H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_efl_t *efl, size_t elmt_size, - const H5S_t *file_space, H5S_sel_iter_t *file_iter, - size_t nelmts, const H5D_transfer_t xfer_mode, - const void *buf); -size_t H5S_all_mgath (const void *_buf, size_t elmt_size, - const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, - size_t nelmts, void *_tconv_buf/*out*/); -herr_t H5S_all_mscat (const void *_tconv_buf, size_t elmt_size, - const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, - size_t nelmts, void *_buf/*out*/); herr_t H5S_all_release (H5S_t *space); hsize_t H5S_all_npoints (const H5S_t *space); /* Hyperslab selection functions */ -herr_t H5S_hyper_init (const struct H5O_layout_t *layout, - const H5S_t *space, H5S_sel_iter_t *iter); -size_t H5S_hyper_favail (const H5S_t *space, const H5S_sel_iter_t *iter, - size_t max); -size_t H5S_hyper_fgath (H5F_t *f, const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_efl_t *efl, size_t elmt_size, - const H5S_t *file_space, H5S_sel_iter_t *file_iter, - size_t nelmts, const H5D_transfer_t xfer_mode, - void *buf/*out*/); -herr_t H5S_hyper_fscat (H5F_t *f, const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_efl_t *efl, size_t elmt_size, - const H5S_t *file_space, H5S_sel_iter_t *file_iter, - size_t nelmts, const H5D_transfer_t xfer_mode, - const void *buf); -size_t H5S_hyper_mgath (const void *_buf, size_t elmt_size, - const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, - size_t nelmts, void *_tconv_buf/*out*/); -herr_t H5S_hyper_mscat (const void *_tconv_buf, size_t elmt_size, - const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, - size_t nelmts, void *_buf/*out*/); herr_t H5S_hyper_add (H5S_t *space, const hssize_t *start, const hsize_t *size); herr_t H5S_hyper_release (H5S_t *space); diff --git a/src/Makefile.in b/src/Makefile.in index 681e285..57d6bc1 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -19,8 +19,8 @@ LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5D.c H5E.c H5F.c H5Farray.c H5Fcore.c \ H5Fstdio.c H5G.c H5Gent.c H5Gnode.c H5Gstab.c H5HG.c H5HL.c H5I.c H5MF.c \ H5MM.c H5O.c H5Oattr.c H5Ocomp.c H5Ocont.c H5Odtype.c H5Oefl.c \ H5Olayout.c H5Omtime.c H5Oname.c H5Onull.c H5Osdspace.c H5Oshared.c \ - H5Ostab.c H5P.c H5S.c H5Sall.c H5Shyper.c H5Spoint.c H5Ssimp.c \ - H5Sselect.c H5T.c H5Tbit.c H5Tconv.c H5Tinit.c H5TB.c H5V.c H5Z.c + H5Ostab.c H5P.c H5S.c H5Sall.c H5Shyper.c H5Spoint.c H5Sselect.c H5T.c \ + H5Tbit.c H5Tconv.c H5Tinit.c H5TB.c H5V.c H5Z.c LIB_OBJ=$(LIB_SRC:.c=.o) diff --git a/test/.distdep b/test/.distdep index 48594df..7881eb1 100644 --- a/test/.distdep +++ b/test/.distdep @@ -235,27 +235,6 @@ dsets.o: \ ../src/H5Zpublic.h \ ../src/H5Spublic.h \ ../src/H5Tpublic.h -cmpd_dset.o: \ - cmpd_dset.c \ - ../src/hdf5.h \ - ../src/H5public.h \ - ../src/H5config.h \ - ../src/H5Ipublic.h \ - ../src/H5Apublic.h \ - ../src/H5ACpublic.h \ - ../src/H5Bpublic.h \ - ../src/H5Dpublic.h \ - ../src/H5Epublic.h \ - ../src/H5Fpublic.h \ - ../src/H5Gpublic.h \ - ../src/H5HGpublic.h \ - ../src/H5HLpublic.h \ - ../src/H5MFpublic.h \ - ../src/H5MMpublic.h \ - ../src/H5Opublic.h \ - ../src/H5Ppublic.h \ - ../src/H5Zpublic.h \ - ../src/H5Spublic.h extend.o: \ extend.c \ ../src/hdf5.h \ @@ -299,28 +278,6 @@ external.o: \ ../src/H5Zpublic.h \ ../src/H5Spublic.h \ ../src/H5Tpublic.h -iopipe.o: \ - iopipe.c \ - ../src/hdf5.h \ - ../src/H5public.h \ - ../src/H5config.h \ - ../src/H5Ipublic.h \ - ../src/H5Apublic.h \ - ../src/H5ACpublic.h \ - ../src/H5Bpublic.h \ - ../src/H5Dpublic.h \ - ../src/H5Epublic.h \ - ../src/H5Fpublic.h \ - ../src/H5Gpublic.h \ - ../src/H5HGpublic.h \ - ../src/H5HLpublic.h \ - ../src/H5MFpublic.h \ - ../src/H5MMpublic.h \ - ../src/H5Opublic.h \ - ../src/H5Ppublic.h \ - ../src/H5Zpublic.h \ - ../src/H5Spublic.h \ - ../src/H5Tpublic.h gheap.o: \ gheap.c \ ../src/H5private.h \ @@ -494,3 +451,46 @@ chunk.o: \ ../src/H5Zpublic.h \ ../src/H5Spublic.h \ ../src/H5Tpublic.h +cmpd_dset.o: \ + cmpd_dset.c \ + ../src/hdf5.h \ + ../src/H5public.h \ + ../src/H5config.h \ + ../src/H5Ipublic.h \ + ../src/H5Apublic.h \ + ../src/H5ACpublic.h \ + ../src/H5Bpublic.h \ + ../src/H5Dpublic.h \ + ../src/H5Epublic.h \ + ../src/H5Fpublic.h \ + ../src/H5Gpublic.h \ + ../src/H5HGpublic.h \ + ../src/H5HLpublic.h \ + ../src/H5MFpublic.h \ + ../src/H5MMpublic.h \ + ../src/H5Opublic.h \ + ../src/H5Ppublic.h \ + ../src/H5Zpublic.h \ + ../src/H5Spublic.h +iopipe.o: \ + iopipe.c \ + ../src/hdf5.h \ + ../src/H5public.h \ + ../src/H5config.h \ + ../src/H5Ipublic.h \ + ../src/H5Apublic.h \ + ../src/H5ACpublic.h \ + ../src/H5Bpublic.h \ + ../src/H5Dpublic.h \ + ../src/H5Epublic.h \ + ../src/H5Fpublic.h \ + ../src/H5Gpublic.h \ + ../src/H5HGpublic.h \ + ../src/H5HLpublic.h \ + ../src/H5MFpublic.h \ + ../src/H5MMpublic.h \ + ../src/H5Opublic.h \ + ../src/H5Ppublic.h \ + ../src/H5Zpublic.h \ + ../src/H5Spublic.h \ + ../src/H5Tpublic.h diff --git a/test/iopipe.c b/test/iopipe.c index 447f483..95d162d 100644 --- a/test/iopipe.c +++ b/test/iopipe.c @@ -22,7 +22,7 @@ #define HEADING "%-16s" #define PROGRESS '=' -#if 1 +#if 0 /* Normal testing */ #define REQUEST_SIZE_X 4579 #define REQUEST_SIZE_Y 4579 |