From 1000e97d3a6867bce31f0c210e4f8f052659c73e Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Thu, 6 Dec 2018 23:44:18 -0600 Subject: initial API impl. --- fortran/src/CMakeLists.txt | 1 + fortran/src/Makefile.am | 3 ++- fortran/src/hdf5_fortrandll.def.in | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 025fab5..6cc15ea 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -221,6 +221,7 @@ set (f90_F_BASE_SOURCES ${HDF5_F90_SRC_SOURCE_DIR}/H5Rff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Sff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Tff.F90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5VLff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Zff.F90 ) diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index 666f6cb..4009439 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -44,7 +44,7 @@ endif libhdf5_fortran_la_SOURCES=H5f90global.F90 \ H5fortran_types.F90 H5_ff.F90 H5Aff.F90 H5Dff.F90 H5Eff.F90 \ H5Fff.F90 H5Gff.F90 H5Iff.F90 H5Lff.F90 H5Off.F90 H5Pff.F90 H5Rff.F90 H5Sff.F90 \ - H5Tff.F90 H5Zff.F90 H5_gen.F90 H5fortkit.F90 \ + H5Tff.F90 H5VLff.F90 H5Zff.F90 H5_gen.F90 H5fortkit.F90 \ H5f90kit.c H5_f.c H5Af.c H5Df.c H5Ef.c H5Ff.c H5Gf.c \ H5If.c H5Lf.c H5Of.c H5Pf.c H5Rf.c H5Sf.c H5Tf.c H5Zf.c HDF5.F90 @@ -155,6 +155,7 @@ H5Pff.lo: $(srcdir)/H5Pff.F90 H5f90global.lo H5fortkit.lo H5Rff.lo: $(srcdir)/H5Rff.F90 H5f90global.lo H5Sff.lo: $(srcdir)/H5Sff.F90 H5f90global.lo H5Tff.lo: $(srcdir)/H5Tff.F90 H5f90global.lo +H5VLff.lo: $(srcdir)/H5VLff.F90 H5f90global.lo H5Zff.lo: $(srcdir)/H5Zff.F90 H5f90global.lo H5_gen.lo: H5_gen.F90 H5f90global.lo H5Aff.lo H5Dff.lo H5Pff.lo HDF5.lo: $(srcdir)/HDF5.F90 H5f90global.lo H5_ff.lo H5Aff.lo \ diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 2edba5a..a1a2b56 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -446,6 +446,11 @@ H5T_mp_H5TGET_NATIVE_TYPE_F H5T_mp_H5TCONVERT_F H5T_mp_H5TENUM_INSERT_F90 H5T_mp_H5TENUM_INSERT_F03 +; H5VL +H5VL_mp_H5VLUNREGISTER_CONNECTOR_F +;H5VL_mp_H5VLCLOSE_F +;H5VL_mp_H5VLINITIALIZE_F +;H5VL_mp_H5VLTERMINATE_F ; H5Z H5Z_mp_H5ZUNREGISTER_F H5Z_mp_H5ZFILTER_AVAIL_F -- cgit v0.12 From 5267454ebdb883140e53daea5ff8bdf88c1ec3ef Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Fri, 7 Dec 2018 12:00:47 -0600 Subject: Implemented VOL APIs and C constants, no tests --- MANIFEST | 1 + fortran/src/H5Pff.F90 | 5 +- fortran/src/H5_f.c | 88 ++++++++++++++++++++-- fortran/src/H5_ff.F90 | 108 ++++++++++++++++++++++++--- fortran/src/H5f90global.F90 | 176 ++++++++++++++++++++++++++++++++++++++++++-- fortran/src/H5f90proto.h | 2 +- src/H5VLpublic.h | 2 +- 7 files changed, 355 insertions(+), 27 deletions(-) diff --git a/MANIFEST b/MANIFEST index cb22f4d..6443250 100644 --- a/MANIFEST +++ b/MANIFEST @@ -238,6 +238,7 @@ ./fortran/src/H5Sff.F90 ./fortran/src/H5Tf.c ./fortran/src/H5Tff.F90 +./fortran/src/H5VLff.F90 ./fortran/src/H5Zf.c ./fortran/src/H5Zff.F90 ./fortran/src/H5config_f.inc.cmake diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index 455c72e..d6e70b3 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -7929,7 +7929,7 @@ SUBROUTINE h5pget_virtual_filename_f(dcpl_id, index, name, hdferr, name_len) INTERFACE INTEGER(SIZE_T) FUNCTION h5pget_virtual_filename(dcpl_id, index, name, size) BIND(C, NAME='H5Pget_virtual_filename') - IMPORT :: HID_T, SIZE_T, C_PTR, C_CHAR + IMPORT :: HID_T, SIZE_T, C_PTR IMPLICIT NONE INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id INTEGER(SIZE_T), INTENT(IN), VALUE :: index @@ -7997,7 +7997,7 @@ SUBROUTINE h5pget_virtual_dsetname_f(dcpl_id, index, name, hdferr, name_len) INTERFACE INTEGER(SIZE_T) FUNCTION h5pget_virtual_dsetname(dcpl_id, index, name, size) BIND(C, NAME='H5Pget_virtual_dsetname') - IMPORT :: HID_T, SIZE_T, C_PTR, C_CHAR + IMPORT :: HID_T, SIZE_T, C_PTR IMPLICIT NONE INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id INTEGER(SIZE_T), INTENT(IN), VALUE :: index @@ -8018,7 +8018,6 @@ SUBROUTINE h5pget_virtual_dsetname_f(dcpl_id, index, name, hdferr, name_len) ELSE CALL HD5c2fstring(name,c_name,LEN(name)) ENDIF - ENDIF END SUBROUTINE h5pget_virtual_dsetname_f diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 352ffab..018e121 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -335,6 +335,7 @@ h5close_types_c( hid_t_f * types, int_f *lentypes, * h5s_hid_flags - H5S interface flags of type hid_t * h5s_hsize_flags - H5S interface flags of type hsize_t * h5t_flags - H5T interface flags + * h5vl_flags - H5VL interface flags * h5z_flags - H5Z interface flags * OUTPUTS * None @@ -366,7 +367,7 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, int_f *h5g_flags, int_f *h5i_flags, int_f *h5l_flags, int_f *h5o_flags, hid_t_f *h5p_flags, int_f *h5p_flags_int, int_f *h5r_flags, int_f *h5s_flags, hid_t_f *h5s_hid_flags, hsize_t_f *h5s_hsize_flags, - int_f *h5t_flags, int_f *h5z_flags, int_f *h5_generic_flags, + int_f *h5t_flags, int_f *h5vl_flags, int_f *h5z_flags, int_f *h5_generic_flags, haddr_t_f *h5_haddr_generic_flags) /******/ { @@ -498,6 +499,16 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5i_flags[4] = (int_f)H5I_DATASET; h5i_flags[5] = (int_f)H5I_ATTR; h5i_flags[6] = (int_f)H5I_BADID; + h5i_flags[7] = (int_f)H5I_UNINIT; + h5i_flags[8] = (int_f)H5I_VFL; + h5i_flags[9] = (int_f)H5I_VOL; + h5i_flags[10] = (int_f)H5I_GENPROP_CLS; + h5i_flags[11] = (int_f)H5I_GENPROP_LST; + h5i_flags[12] = (int_f)H5I_ERROR_CLASS; + h5i_flags[13] = (int_f)H5I_ERROR_MSG; + h5i_flags[14] = (int_f)H5I_ERROR_STACK; + h5i_flags[15] = (int_f)H5I_NTYPES; + h5i_flags[16] = (int_f)H5I_INVALID_HID; /* * H5L flags */ @@ -660,7 +671,76 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5t_flags[32] = (int_f)H5T_ARRAY; h5t_flags[33] = (int_f)H5T_DIR_ASCEND; h5t_flags[34] = (int_f)H5T_DIR_DESCEND; - +/* + * H5VL flags + */ + h5vl_flags[0] = (int_f)H5VL_ATTR_GET_ACPL; + h5vl_flags[1] = (int_f)H5VL_ATTR_GET_INFO; + h5vl_flags[2] = (int_f)H5VL_ATTR_GET_NAME; + h5vl_flags[3] = (int_f)H5VL_ATTR_GET_SPACE; + h5vl_flags[4] = (int_f)H5VL_ATTR_GET_STORAGE_SIZE; + h5vl_flags[5] = (int_f)H5VL_ATTR_GET_TYPE; + h5vl_flags[6] = (int_f)H5VL_ATTR_DELETE; + h5vl_flags[7] = (int_f)H5VL_ATTR_EXISTS; + h5vl_flags[8] = (int_f)H5VL_ATTR_ITER; + h5vl_flags[8] = (int_f)H5VL_ATTR_RENAME; + h5vl_flags[9] = (int_f)H5VL_DATASET_GET_DAPL; + h5vl_flags[11] = (int_f)H5VL_DATASET_GET_DCPL; + h5vl_flags[12] = (int_f)H5VL_DATASET_GET_OFFSET; + h5vl_flags[13] = (int_f)H5VL_DATASET_GET_SPACE; + h5vl_flags[14] = (int_f)H5VL_DATASET_GET_SPACE_STATUS; + h5vl_flags[15] = (int_f)H5VL_DATASET_GET_STORAGE_SIZE; + h5vl_flags[16] = (int_f)H5VL_DATASET_GET_TYPE; + h5vl_flags[17] = (int_f)H5VL_DATASET_SET_EXTENT; + h5vl_flags[18] = (int_f)H5VL_DATASET_FLUSH; + h5vl_flags[19] = (int_f)H5VL_DATASET_REFRESH; + h5vl_flags[20] = (int_f)H5VL_DATATYPE_GET_BINARY; + h5vl_flags[21] = (int_f)H5VL_DATATYPE_GET_TCPL; + h5vl_flags[22] = (int_f)H5VL_DATATYPE_FLUSH; + h5vl_flags[23] = (int_f)H5VL_DATATYPE_REFRESH; + h5vl_flags[24] = (int_f)H5VL_FILE_GET_FAPL; + h5vl_flags[25] = (int_f)H5VL_FILE_GET_FCPL; + h5vl_flags[26] = (int_f)H5VL_FILE_GET_INTENT; + h5vl_flags[27] = (int_f)H5VL_FILE_GET_NAME; + h5vl_flags[28] = (int_f)H5VL_FILE_GET_OBJ_COUNT; + h5vl_flags[29] = (int_f)H5VL_FILE_GET_OBJ_IDS; + h5vl_flags[30] = (int_f)H5VL_FILE_FLUSH; + h5vl_flags[31] = (int_f)H5VL_FILE_REOPEN; + h5vl_flags[32] = (int_f)H5VL_FILE_MOUNT; + h5vl_flags[33] = (int_f)H5VL_FILE_UNMOUNT; + h5vl_flags[34] = (int_f)H5VL_FILE_IS_ACCESSIBLE; + h5vl_flags[35] = (int_f)H5VL_FILE_CACHE_VOL_CONN; + h5vl_flags[36] = (int_f)H5VL_GROUP_GET_GCPL; + h5vl_flags[37] = (int_f)H5VL_GROUP_GET_INFO; + h5vl_flags[38] = (int_f)H5VL_GROUP_FLUSH; + h5vl_flags[39] = (int_f)H5VL_GROUP_REFRESH; + h5vl_flags[40] = (int_f)H5VL_LINK_CREATE_HARD; + h5vl_flags[41] = (int_f)H5VL_LINK_CREATE_SOFT; + h5vl_flags[42] = (int_f)H5VL_LINK_CREATE_UD; + h5vl_flags[43] = (int_f)H5VL_LINK_GET_INFO; + h5vl_flags[44] = (int_f)H5VL_LINK_GET_NAME; + h5vl_flags[45] = (int_f)H5VL_LINK_GET_VAL; + h5vl_flags[46] = (int_f)H5VL_LINK_DELETE; + h5vl_flags[47] = (int_f)H5VL_LINK_EXISTS; + h5vl_flags[48] = (int_f)H5VL_LINK_ITER; + h5vl_flags[49] = (int_f)H5VL_REF_GET_NAME; + h5vl_flags[50] = (int_f)H5VL_REF_GET_REGION; + h5vl_flags[51] = (int_f)H5VL_REF_GET_TYPE; + h5vl_flags[52] = (int_f)H5VL_ID_GET_NAME; + h5vl_flags[53] = (int_f)H5VL_OBJECT_CHANGE_REF_COUNT; + h5vl_flags[54] = (int_f)H5VL_OBJECT_EXISTS; + h5vl_flags[55] = (int_f)H5VL_OBJECT_VISIT; + h5vl_flags[56] = (int_f)H5VL_REF_CREATE; + h5vl_flags[57] = (int_f)H5VL_OBJECT_FLUSH; + h5vl_flags[58] = (int_f)H5VL_OBJECT_REFRESH; + h5vl_flags[59] = (int_f)H5VL_REQUEST_WAITANY; + h5vl_flags[60] = (int_f)H5VL_REQUEST_WAITSOME; + h5vl_flags[61] = (int_f)H5VL_REQUEST_WAITALL; + h5vl_flags[62] = (int_f)H5VL_OBJECT_BY_SELF; + h5vl_flags[63] = (int_f)H5VL_OBJECT_BY_NAME; + h5vl_flags[64] = (int_f)H5VL_OBJECT_BY_IDX; + h5vl_flags[65] = (int_f)H5VL_OBJECT_BY_ADDR; + h5vl_flags[66] = (int_f)H5VL_OBJECT_BY_REF; /* * H5Z flags */ @@ -684,10 +764,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5z_flags[17] = (int_f)H5Z_SO_FLOAT_ESCALE; h5z_flags[18] = (int_f)H5Z_SO_INT; h5z_flags[19] = (int_f)H5Z_SO_INT_MINBITS_DEFAULT; -/* - * H5A flags - */ - /* * H5 Generic flags introduced in version 1.8 diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index f63e734..fd5d437 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -88,7 +88,7 @@ MODULE H5LIB ! ! H5I flags declaration ! - INTEGER, PARAMETER :: H5I_FLAGS_LEN = 7 + INTEGER, PARAMETER :: H5I_FLAGS_LEN = 17 INTEGER, DIMENSION(1:H5I_FLAGS_LEN) :: H5I_flags ! ! H5L flags declaration @@ -130,6 +130,13 @@ MODULE H5LIB INTEGER, PARAMETER :: H5T_FLAGS_LEN = 35 INTEGER, DIMENSION(1:H5T_FLAGS_LEN) :: H5T_flags ! + ! H5VL flags declaration + ! + + INTEGER, PARAMETER :: H5VL_FLAGS_LEN = 67 + INTEGER, DIMENSION(1:H5VL_FLAGS_LEN) :: H5VL_flags + + ! ! H5Z flags declaration ! INTEGER, PARAMETER :: H5Z_FLAGS_LEN = 20 @@ -204,6 +211,7 @@ CONTAINS i_H5S_hid_flags, & i_H5S_hsize_flags, & i_H5T_flags, & + i_H5VL_flags, & i_H5Z_flags, & i_H5generic_flags, & i_H5generic_haddr_flags) & @@ -215,7 +223,7 @@ CONTAINS H5FD_HID_FLAGS_LEN, H5I_FLAGS_LEN, H5L_FLAGS_LEN, & H5O_FLAGS_LEN, H5P_FLAGS_LEN, H5P_FLAGS_INT_LEN, & H5R_FLAGS_LEN, H5S_FLAGS_LEN, H5S_HID_FLAGS_LEN, H5S_HSIZE_FLAGS_LEN, & - H5T_FLAGS_LEN, H5Z_FLAGS_LEN, H5generic_FLAGS_LEN, H5generic_haddr_FLAGS_LEN + H5T_FLAGS_LEN, H5VL_FLAGS_LEN, H5Z_FLAGS_LEN, H5generic_FLAGS_LEN, H5generic_haddr_FLAGS_LEN IMPLICIT NONE INTEGER , DIMENSION(1:H5D_FLAGS_LEN) :: i_H5D_flags INTEGER(SIZE_T) , DIMENSION(1:H5D_SIZE_FLAGS_LEN) :: i_H5D_size_flags @@ -235,6 +243,7 @@ CONTAINS INTEGER(HID_T) , DIMENSION(1:H5S_HID_FLAGS_LEN) :: i_H5S_hid_flags INTEGER(HSIZE_T), DIMENSION(1:H5S_HSIZE_FLAGS_LEN) :: i_H5S_hsize_flags INTEGER , DIMENSION(1:H5T_FLAGS_LEN) :: i_H5T_flags + INTEGER , DIMENSION(1:H5VL_FLAGS_LEN) :: i_H5VL_flags INTEGER , DIMENSION(1:H5Z_FLAGS_LEN) :: i_H5Z_flags INTEGER , DIMENSION(1:H5generic_FLAGS_LEN) :: i_H5generic_flags INTEGER(HADDR_T), DIMENSION(1:H5generic_haddr_FLAGS_LEN) :: i_H5generic_haddr_flags @@ -318,6 +327,7 @@ CONTAINS H5S_hid_flags, & H5S_hsize_flags, & H5T_flags, & + H5VL_flags, & H5Z_flags, & H5generic_flags,& H5generic_haddr_flags) @@ -443,13 +453,23 @@ CONTAINS ! ! H5I flags declaration ! - H5I_FILE_F = H5I_flags(1) - H5I_GROUP_F = H5I_flags(2) - H5I_DATATYPE_F = H5I_flags(3) - H5I_DATASPACE_F = H5I_flags(4) - H5I_DATASET_F = H5I_flags(5) - H5I_ATTR_F = H5I_flags(6) - H5I_BADID_F = H5I_flags(7) + H5I_FILE_F = H5I_flags(1) + H5I_GROUP_F = H5I_flags(2) + H5I_DATATYPE_F = H5I_flags(3) + H5I_DATASPACE_F = H5I_flags(4) + H5I_DATASET_F = H5I_flags(5) + H5I_ATTR_F = H5I_flags(6) + H5I_BADID_F = H5I_flags(7) + H5I_UNINIT_F = H5I_flags(8) + H5I_VFL_F = H5I_flags(9) + H5I_VOL_F = H5I_flags(10) + H5I_GENPROP_CLS_F = H5I_flags(11) + H5I_GENPROP_LST_F = H5I_flags(12) + H5I_ERROR_CLASS_F = H5I_flags(13) + H5I_ERROR_MSG_F = H5I_flags(14) + H5I_ERROR_STACK_F = H5I_flags(15) + H5I_NTYPES_F = H5I_flags(16) + H5I_INVALID_HID_F = H5I_flags(17) ! ! H5L flags ! @@ -584,6 +604,76 @@ CONTAINS H5T_DIR_ASCEND_F = H5T_flags(34) H5T_DIR_DESCEND_F = H5T_flags(35) ! + ! H5VL flags declaration + ! + H5VL_ATTR_GET_ACPL_F = H5VL_flags(1) + H5VL_ATTR_GET_INFO_F = H5VL_flags(2) + H5VL_ATTR_GET_NAME_F = H5VL_flags(3) + H5VL_ATTR_GET_SPACE_F = H5VL_flags(4) + H5VL_ATTR_GET_STORAGE_SIZE_F = H5VL_flags(5) + H5VL_ATTR_GET_TYPE_F = H5VL_flags(6) + H5VL_ATTR_DELETE_F = H5VL_flags(7) + H5VL_ATTR_EXISTS_F = H5VL_flags(8) + H5VL_ATTR_ITER_F = H5VL_flags(9) + H5VL_ATTR_RENAME_F = H5VL_flags(10) + H5VL_DATASET_GET_DAPL_F = H5VL_flags(11) + H5VL_DATASET_GET_DCPL_F = H5VL_flags(12) + H5VL_DATASET_GET_OFFSET_F = H5VL_flags(13) + H5VL_DATASET_GET_SPACE_F = H5VL_flags(14) + H5VL_DATASET_GET_SPACE_STATUS_F = H5VL_flags(15) + H5VL_DATASET_GET_STORAGE_SIZE_F = H5VL_flags(16) + H5VL_DATASET_GET_TYPE_F = H5VL_flags(17) + H5VL_DATASET_SET_EXTENT_F = H5VL_flags(18) + H5VL_DATASET_FLUSH_F = H5VL_flags(19) + H5VL_DATASET_REFRESH_F = H5VL_flags(20) + H5VL_DATATYPE_GET_BINARY_F = H5VL_flags(21) + H5VL_DATATYPE_GET_TCPL_F = H5VL_flags(22) + H5VL_DATATYPE_FLUSH_F = H5VL_flags(23) + H5VL_DATATYPE_REFRESH_F = H5VL_flags(24) + H5VL_FILE_GET_FAPL_F = H5VL_flags(25) + H5VL_FILE_GET_FCPL_F = H5VL_flags(26) + H5VL_FILE_GET_INTENT_F = H5VL_flags(27) + H5VL_FILE_GET_NAME_F = H5VL_flags(28) + H5VL_FILE_GET_OBJ_COUNT_F = H5VL_flags(29) + H5VL_FILE_GET_OBJ_IDS_F = H5VL_flags(30) + H5VL_FILE_FLUSH_F = H5VL_flags(31) + H5VL_FILE_REOPEN_F = H5VL_flags(32) + H5VL_FILE_MOUNT_F = H5VL_flags(33) + H5VL_FILE_UNMOUNT_F = H5VL_flags(34) + H5VL_FILE_IS_ACCESSIBLE_F = H5VL_flags(35) + H5VL_FILE_CACHE_VOL_CONN_F = H5VL_flags(36) + H5VL_GROUP_GET_GCPL_F = H5VL_flags(37) + H5VL_GROUP_GET_INFO_F = H5VL_flags(38) + H5VL_GROUP_FLUSH_F = H5VL_flags(39) + H5VL_GROUP_REFRESH_F = H5VL_flags(40) + H5VL_LINK_CREATE_HARD_F = H5VL_flags(41) + H5VL_LINK_CREATE_SOFT_F = H5VL_flags(42) + H5VL_LINK_CREATE_UD_F = H5VL_flags(43) + H5VL_LINK_GET_INFO_F = H5VL_flags(44) + H5VL_LINK_GET_NAME_F = H5VL_flags(45) + H5VL_LINK_GET_VAL_F = H5VL_flags(46) + H5VL_LINK_DELETE_F = H5VL_flags(47) + H5VL_LINK_EXISTS_F = H5VL_flags(48) + H5VL_LINK_ITER_F = H5VL_flags(49) + H5VL_REF_GET_NAME_F = H5VL_flags(50) + H5VL_REF_GET_REGION_F = H5VL_flags(51) + H5VL_REF_GET_TYPE_F = H5VL_flags(52) + H5VL_ID_GET_NAME_F = H5VL_flags(53) + H5VL_OBJECT_CHANGE_REF_COUNT_F = H5VL_flags(54) + H5VL_OBJECT_EXISTS_F = H5VL_flags(55) + H5VL_OBJECT_VISIT_F = H5VL_flags(56) + H5VL_REF_CREATE_F = H5VL_flags(57) + H5VL_OBJECT_FLUSH_F = H5VL_flags(58) + H5VL_OBJECT_REFRESH_F = H5VL_flags(59) + H5VL_REQUEST_WAITANY_F = H5VL_flags(60) + H5VL_REQUEST_WAITSOME_F = H5VL_flags(61) + H5VL_REQUEST_WAITALL_F = H5VL_flags(62) + H5VL_OBJECT_BY_SELF_F = H5VL_flags(63) + H5VL_OBJECT_BY_NAME_F = H5VL_flags(64) + H5VL_OBJECT_BY_IDX_F = H5VL_flags(65) + H5VL_OBJECT_BY_ADDR_F = H5VL_flags(66) + H5VL_OBJECT_BY_REF_F = H5VL_flags(67) + ! ! H5Z flags ! H5Z_FILTER_ERROR_F = H5Z_flags(1) diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index 078778a..685026c 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -435,15 +435,36 @@ MODULE H5GLOBAL !DEC$ATTRIBUTES DLLEXPORT :: H5I_DATASET_F !DEC$ATTRIBUTES DLLEXPORT :: H5I_ATTR_F !DEC$ATTRIBUTES DLLEXPORT :: H5I_BADID_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_UNINIT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_VFL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_VOL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_GENPROP_CLS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_GENPROP_LST_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_ERROR_CLASS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_ERROR_MSG_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_ERROR_STACK_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_NTYPES_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_INVALID_HID_F !DEC$endif - INTEGER :: H5I_FILE_F - INTEGER :: H5I_GROUP_F - INTEGER :: H5I_DATATYPE_F - INTEGER :: H5I_DATASPACE_F - INTEGER :: H5I_DATASET_F - INTEGER :: H5I_ATTR_F - INTEGER :: H5I_BADID_F + INTEGER :: H5I_FILE_F + INTEGER :: H5I_GROUP_F + INTEGER :: H5I_DATATYPE_F + INTEGER :: H5I_DATASPACE_F + INTEGER :: H5I_DATASET_F + INTEGER :: H5I_ATTR_F + INTEGER :: H5I_BADID_F + INTEGER :: H5I_UNINIT_F + INTEGER :: H5I_VFL_F + INTEGER :: H5I_VOL_F + INTEGER :: H5I_GENPROP_CLS_F + INTEGER :: H5I_GENPROP_LST_F + INTEGER :: H5I_ERROR_CLASS_F + INTEGER :: H5I_ERROR_MSG_F + INTEGER :: H5I_ERROR_STACK_F + INTEGER :: H5I_NTYPES_F + INTEGER :: H5I_INVALID_HID_F + ! ! H5L flags declaration ! @@ -706,6 +727,147 @@ MODULE H5GLOBAL INTEGER :: H5T_DIR_ASCEND_F INTEGER :: H5T_DIR_DESCEND_F ! + ! H5VL flags declaration + ! + !DEC$if defined(BUILD_HDF5_DLL) + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_GET_ACPL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_GET_INFO_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_GET_NAME_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_GET_SPACE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_GET_STORAGE_SIZE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_GET_TYPE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_DELETE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_EXISTS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_ITER_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_RENAME_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_GET_DAPL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_GET_DCPL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_GET_OFFSET_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_GET_SPACE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_GET_SPACE_STATUS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_GET_STORAGE_SIZE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_GET_TYPE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_SET_EXTENT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_FLUSH_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_REFRESH_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATATYPE_GET_BINARY_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATATYPE_GET_TCPL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATATYPE_FLUSH_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATATYPE_REFRESH_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_GET_FAPL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_GET_FCPL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_GET_INTENT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_GET_NAME_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_GET_OBJ_COUNT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_GET_OBJ_IDS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_FLUSH_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_REOPEN_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_MOUNT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_UNMOUNT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_IS_ACCESSIBLE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_CACHE_VOL_CONN_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_GROUP_GET_GCPL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_GROUP_GET_INFO_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_GROUP_FLUSH_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_GROUP_REFRESH_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_CREATE_HARD_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_CREATE_SOFT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_CREATE_UD_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_GET_INFO_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_GET_NAME_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_GET_VAL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_DELETE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_EXISTS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_ITER_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_REF_GET_NAME_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_REF_GET_REGION_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_REF_GET_TYPE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ID_GET_NAME_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_CHANGE_REF_COUNT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_EXISTS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_VISIT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_REF_CREATE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_FLUSH_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_REFRESH_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_REQUEST_WAITANY_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_REQUEST_WAITSOME_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_REQUEST_WAITALL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_BY_SELF_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_BY_NAME_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_BY_IDX_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_BY_ADDR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_BY_REF_F + !DEC$endif + + INTEGER :: H5VL_ATTR_GET_ACPL_F + INTEGER :: H5VL_ATTR_GET_INFO_F + INTEGER :: H5VL_ATTR_GET_NAME_F + INTEGER :: H5VL_ATTR_GET_SPACE_F + INTEGER :: H5VL_ATTR_GET_STORAGE_SIZE_F + INTEGER :: H5VL_ATTR_GET_TYPE_F + INTEGER :: H5VL_ATTR_DELETE_F + INTEGER :: H5VL_ATTR_EXISTS_F + INTEGER :: H5VL_ATTR_ITER_F + INTEGER :: H5VL_ATTR_RENAME_F + INTEGER :: H5VL_DATASET_GET_DAPL_F + INTEGER :: H5VL_DATASET_GET_DCPL_F + INTEGER :: H5VL_DATASET_GET_OFFSET_F + INTEGER :: H5VL_DATASET_GET_SPACE_F + INTEGER :: H5VL_DATASET_GET_SPACE_STATUS_F + INTEGER :: H5VL_DATASET_GET_STORAGE_SIZE_F + INTEGER :: H5VL_DATASET_GET_TYPE_F + INTEGER :: H5VL_DATASET_SET_EXTENT_F + INTEGER :: H5VL_DATASET_FLUSH_F + INTEGER :: H5VL_DATASET_REFRESH_F + INTEGER :: H5VL_DATATYPE_GET_BINARY_F + INTEGER :: H5VL_DATATYPE_GET_TCPL_F + INTEGER :: H5VL_DATATYPE_FLUSH_F + INTEGER :: H5VL_DATATYPE_REFRESH_F + INTEGER :: H5VL_FILE_GET_FAPL_F + INTEGER :: H5VL_FILE_GET_FCPL_F + INTEGER :: H5VL_FILE_GET_INTENT_F + INTEGER :: H5VL_FILE_GET_NAME_F + INTEGER :: H5VL_FILE_GET_OBJ_COUNT_F + INTEGER :: H5VL_FILE_GET_OBJ_IDS_F + INTEGER :: H5VL_FILE_FLUSH_F + INTEGER :: H5VL_FILE_REOPEN_F + INTEGER :: H5VL_FILE_MOUNT_F + INTEGER :: H5VL_FILE_UNMOUNT_F + INTEGER :: H5VL_FILE_IS_ACCESSIBLE_F + INTEGER :: H5VL_FILE_CACHE_VOL_CONN_F + INTEGER :: H5VL_GROUP_GET_GCPL_F + INTEGER :: H5VL_GROUP_GET_INFO_F + INTEGER :: H5VL_GROUP_FLUSH_F + INTEGER :: H5VL_GROUP_REFRESH_F + INTEGER :: H5VL_LINK_CREATE_HARD_F + INTEGER :: H5VL_LINK_CREATE_SOFT_F + INTEGER :: H5VL_LINK_CREATE_UD_F + INTEGER :: H5VL_LINK_GET_INFO_F + INTEGER :: H5VL_LINK_GET_NAME_F + INTEGER :: H5VL_LINK_GET_VAL_F + INTEGER :: H5VL_LINK_DELETE_F + INTEGER :: H5VL_LINK_EXISTS_F + INTEGER :: H5VL_LINK_ITER_F + INTEGER :: H5VL_REF_GET_NAME_F + INTEGER :: H5VL_REF_GET_REGION_F + INTEGER :: H5VL_REF_GET_TYPE_F + INTEGER :: H5VL_ID_GET_NAME_F + INTEGER :: H5VL_OBJECT_CHANGE_REF_COUNT_F + INTEGER :: H5VL_OBJECT_EXISTS_F + INTEGER :: H5VL_OBJECT_VISIT_F + INTEGER :: H5VL_REF_CREATE_F + INTEGER :: H5VL_OBJECT_FLUSH_F + INTEGER :: H5VL_OBJECT_REFRESH_F + INTEGER :: H5VL_REQUEST_WAITANY_F + INTEGER :: H5VL_REQUEST_WAITSOME_F + INTEGER :: H5VL_REQUEST_WAITALL_F + INTEGER :: H5VL_OBJECT_BY_SELF_F + INTEGER :: H5VL_OBJECT_BY_NAME_F + INTEGER :: H5VL_OBJECT_BY_IDX_F + INTEGER :: H5VL_OBJECT_BY_ADDR_F + INTEGER :: H5VL_OBJECT_BY_REF_F + + ! ! H5Z flags declaration ! !DEC$if defined(BUILD_HDF5_DLL) diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 0884eb6..49ffca3 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -528,7 +528,7 @@ H5_FCDLL int_f h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, int_f *h5g_flags, int_f *h5i_flags, int_f *h5l_flags, int_f *h5o_flags, hid_t_f *h5p_flags, int_f *h5p_flags_int, int_f *h5r_flags, int_f *h5s_flags, hid_t_f *h5s_hid_flags, hsize_t_f *h5s_hsize_flags, - int_f *h5t_flags, int_f *h5z_flags, int_f *h5_generic_flags, + int_f *h5t_flags, int_f *h5vl_flags, int_f *h5z_flags, int_f *h5_generic_flags, haddr_t_f *h5_haddr_generic_flags); H5_FCDLL int_f h5init1_flags_c(int_f *h5lib_flags); H5_FCDLL int_f h5get_libversion_c(int_f *majnum, int_f *minnum, int_f *relnum); diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index b276128..2b055e7 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -360,7 +360,7 @@ typedef int H5VL_class_value_t; /* VOL connector identifier values */ #define H5_VOL_INVALID (-1) /* Invalid ID for VOL connector iD */ -#define H5_VOL_NATIVE 0 /* Native HDF5 file formnat VOL connector */ +#define H5_VOL_NATIVE 0 /* Native HDF5 file format VOL connector */ #define H5_VOL_RESERVED 256 /* VOL connector IDs below this value are reserved for library use */ #define H5_VOL_MAX 65535 /* Maximum VOL connector ID */ -- cgit v0.12 From 96b6f58ac83b39cb7559b39d183d123412b5bc04 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Fri, 7 Dec 2018 12:06:29 -0600 Subject: Implemented VOL APIs and C constants, no tests --- fortran/src/hdf5_fortrandll.def.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index a1a2b56..ebe4fef 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -447,10 +447,14 @@ H5T_mp_H5TCONVERT_F H5T_mp_H5TENUM_INSERT_F90 H5T_mp_H5TENUM_INSERT_F03 ; H5VL +H5VL_mp_H5VLREGISTER_CONNECTOR_BY_NAME_F +H5VL_mp_H5VLREGISTER_CONNECTOR_BY_VALUE_F +H5VL_mp_H5VLIS_CONNECTOR_REGISTERED_F +H5VL_mp_H5VLGET_CONNECTOR_ID_F +H5VL_mp_H5VLGET_CONNECTOR_NAME_F +H5VL_mp_H5VLCLOSE_F H5VL_mp_H5VLUNREGISTER_CONNECTOR_F -;H5VL_mp_H5VLCLOSE_F -;H5VL_mp_H5VLINITIALIZE_F -;H5VL_mp_H5VLTERMINATE_F +H5VL_mp_H5VLCMP_CONNECTOR_CLS_F ; H5Z H5Z_mp_H5ZUNREGISTER_F H5Z_mp_H5ZFILTER_AVAIL_F -- cgit v0.12 From a21f1d8aef624d4d266f6914099c7ec0a2b52c24 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Fri, 7 Dec 2018 15:25:34 -0600 Subject: added missing files --- fortran/src/H5VLff.F90 | 340 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 340 insertions(+) create mode 100644 fortran/src/H5VLff.F90 diff --git a/fortran/src/H5VLff.F90 b/fortran/src/H5VLff.F90 new file mode 100644 index 0000000..1e0dafb --- /dev/null +++ b/fortran/src/H5VLff.F90 @@ -0,0 +1,340 @@ +!****h* ROBODoc/H5VL +! +! NAME +! MODULE H5VL +! +! PURPOSE +! This file contains Fortran interfaces for H5VL functions. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the COPYING file, which can be found at the root of the source code * +! distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * +! If you do not have access to either file, you may request a copy from * +! help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! NOTES +! _____ __ __ _____ ____ _____ _______ _ _ _______ +! |_ _| \/ | __ \ / __ \| __ \__ __|/\ | \ | |__ __| +! **** | | | \ / | |__) | | | | |__) | | | / \ | \| | | | **** +! **** | | | |\/| | ___/| | | | _ / | | / /\ \ | . ` | | | **** +! **** _| |_| | | | | | |__| | | \ \ | |/ ____ \| |\ | | | **** +! |_____|_| |_|_| \____/|_| \_\ |_/_/ \_\_| \_| |_| +! +! If you add a new H5VL function you must add the function name to the +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. +! This is needed for Windows based operating systems. +! +!***** + +MODULE H5VL + + USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_FUNPTR, C_CHAR, C_INT64_T, C_INT + USE H5GLOBAL + USE H5fortkit + + IMPLICIT NONE + +CONTAINS + +! H5VLregister_connector + +! +!****s* H5VL/H5VLregister_connector_by_name_f +! +! NAME +! H5VLregister_connector_by_name_f +! +! PURPOSE +! Registers a new VOL connector as a member of the virtual object +! layer class by name. +! +! INPUTS +! cls - +! OUTPUTS +! vol_id - +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLregister_connector_by_name_f(name, vol_id, hdferr, vipl_id) + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER(HID_T), INTENT(OUT) :: vol_id + INTEGER, INTENT(OUT) :: hdferr + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: vipl_id +!***** + CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name + INTEGER(HID_T) :: vipl_id_default + + + INTERFACE + INTEGER(HID_T) FUNCTION H5VLregister_connector_by_name(name, vipl_id) BIND(C,NAME='H5VLregister_connector_by_name') + IMPORT :: C_CHAR + IMPORT :: HID_T + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name + INTEGER(HID_T), INTENT(IN), VALUE :: vipl_id + END FUNCTION H5VLregister_connector_by_name + END INTERFACE + + vipl_id_default = H5P_DEFAULT_F + IF(PRESENT(vipl_id)) vipl_id_default = vipl_id + + c_name = TRIM(name)//C_NULL_CHAR + vol_id = H5VLregister_connector_by_name(c_name, vipl_id_default) + + hdferr = 0 + IF(vol_id.LT.0) hdferr = H5I_INVALID_HID_F + + END SUBROUTINE H5VLregister_connector_by_name_f + + SUBROUTINE H5VLregister_connector_by_value_f(connector_value, vol_id, hdferr, vipl_id) + IMPLICIT NONE + INTEGER :: connector_value + INTEGER(HID_T), INTENT(OUT) :: vol_id + INTEGER, INTENT(OUT) :: hdferr + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: vipl_id +!***** + INTEGER(HID_T) :: vipl_id_default + + INTERFACE + INTEGER(HID_T) FUNCTION H5VLregister_connector_by_value(connector_value, vipl_id) & + BIND(C,NAME='H5VLregister_connector_by_value') + IMPORT :: HID_T + IMPORT :: C_INT + INTEGER(C_INT) :: connector_value + INTEGER(HID_T), INTENT(IN), VALUE :: vipl_id + END FUNCTION H5VLregister_connector_by_value + END INTERFACE + + + vipl_id_default = H5P_DEFAULT_F + IF(PRESENT(vipl_id)) vipl_id_default = vipl_id + + vol_id = H5VLregister_connector_by_value(INT(connector_value,C_INT), vipl_id_default) + + hdferr = 0 + IF(vol_id.LT.0) hdferr = H5I_INVALID_HID_F + + END SUBROUTINE H5VLregister_connector_by_value_f + +! +!****s* H5VL/H5VLis_connector_registered_f +! +! NAME +! H5VLis_connector_registered_f +! +! PURPOSE +! Tests whether a VOL class has been registered or not. +! +! INPUTS +! cls - +! OUTPUTS +! vol_id - +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLis_connector_registered_f(name, registered, hdferr) + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: name + LOGICAL, INTENT(OUT) :: registered + INTEGER, INTENT(OUT) :: hdferr +!***** + CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name + INTEGER(C_INT) :: registered_c + + INTERFACE + INTEGER(C_INT) FUNCTION H5VLis_connector_registered(name) BIND(C,NAME='H5VLis_connector_registered') + IMPORT :: C_CHAR + IMPORT :: C_INT + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name + END FUNCTION H5VLis_connector_registered + END INTERFACE + + c_name = TRIM(name)//C_NULL_CHAR + registered_c = H5VLis_connector_registered(c_name) + + hdferr = 0 + registered = .FALSE. + IF(registered_c .GT. 0) registered = .TRUE. + IF(registered_c .LT. 0) hdferr = INT(registered_c) + + END SUBROUTINE H5VLis_connector_registered_f + +! +!****s* H5VL/H5VLis_connector_registered_f +! +! NAME +! H5VLis_connector_registered_f +! +! PURPOSE +! Tests whether a VOL class has been registered or not. +! +! INPUTS +! cls - +! OUTPUTS +! vol_id - +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLget_connector_id_f(name, vol_id, hdferr) + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER(HID_T), INTENT(OUT) :: vol_id + INTEGER, INTENT(OUT) :: hdferr +!***** + CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name + + INTERFACE + INTEGER(HID_T) FUNCTION H5VLget_connector_id(name) BIND(C,NAME='H5VLget_connector_id') + IMPORT :: C_CHAR + IMPORT :: HID_T + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name + END FUNCTION H5VLget_connector_id + END INTERFACE + + c_name = TRIM(name)//C_NULL_CHAR + vol_id = H5VLget_connector_id(c_name) + + hdferr = 0 + IF(vol_id.LT.0) hdferr = H5I_INVALID_HID_F + + END SUBROUTINE H5VLget_connector_id_f + + SUBROUTINE H5VLget_connector_name_f(obj_id, name, hdferr, name_len) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: obj_id + CHARACTER(LEN=*), INTENT(OUT) :: name + INTEGER, INTENT(OUT) :: hdferr + INTEGER(SIZE_T), OPTIONAL :: name_len +!***** + CHARACTER(LEN=1,KIND=C_CHAR), DIMENSION(1:LEN(name)+1), TARGET :: c_name + TYPE(C_PTR) :: f_ptr + + INTERFACE + INTEGER(SIZE_T) FUNCTION H5VLget_connector_name(obj_id, name, size) BIND(C,NAME='H5VLget_connector_name') + IMPORT :: HID_T, SIZE_T, C_PTR + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: obj_id + TYPE(C_PTR), VALUE :: name + INTEGER(SIZE_T), INTENT(IN), VALUE :: size + END FUNCTION H5VLget_connector_name + END INTERFACE + + hdferr = 0 + IF(PRESENT(name_len))THEN + name_len = INT(H5VLget_connector_name(obj_id, C_NULL_PTR, 0_SIZE_T), SIZE_T) + IF(name_len.LT.0) hdferr = H5I_INVALID_HID_F + ELSE + f_ptr = C_LOC(c_name(1)(1:1)) + + IF(INT(H5VLget_connector_name(obj_id, f_ptr, INT(LEN(name)+1,SIZE_T)), SIZE_T).LT.0)THEN + hdferr = H5I_INVALID_HID_F + ELSE + CALL HD5c2fstring(name,c_name,LEN(name)) + ENDIF + ENDIF + + END SUBROUTINE H5VLget_connector_name_f + +! +! +!****s* H5VL/H5VLclose_f +! +! NAME +! H5VLclose_f +! +! PURPOSE +! Closes a VOL connector ID. +! +! INPUTS +! plugin_id - A valid identifier of the connectory to unregister. +! +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLclose_f(vol_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: vol_id + INTEGER, INTENT(OUT) :: hdferr +!***** + + INTERFACE + INTEGER FUNCTION H5VLclose(vol_id) BIND(C, NAME='H5VLclose') + IMPORT :: HID_T + INTEGER(HID_T), INTENT(IN), VALUE :: vol_id + END FUNCTION H5VLclose + END INTERFACE + + hdferr = INT(H5VLclose(vol_id)) + + END SUBROUTINE H5VLclose_f + +! +!****s* H5VL/H5VLunregister_connector_f +! +! NAME +! H5VLunregister_connector_f +! +! PURPOSE +! Removes a VOL connector ID from the library. +! +! INPUTS +! plugin_id - A valid identifier of the connector to unregister. +! +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLunregister_connector_f(plugin_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: plugin_id + INTEGER, INTENT(OUT) :: hdferr +!***** + + INTERFACE + INTEGER FUNCTION H5VLunregister_connector(plugin_id) BIND(C, NAME='H5VLunregister_connector') + IMPORT :: HID_T + INTEGER(HID_T), INTENT(IN), VALUE :: plugin_id + END FUNCTION H5VLunregister_connector + END INTERFACE + + hdferr = INT(H5VLunregister_connector(plugin_id)) + + END SUBROUTINE H5VLunregister_connector_f + +! H5VLcmp_connector_cls + + SUBROUTINE H5VLcmp_connector_cls_f(cmp, connector_id1, connector_id2, hdferr) + IMPLICIT NONE + INTEGER, INTENT(OUT), TARGET :: cmp + INTEGER(HID_T), INTENT(IN) :: connector_id1 + INTEGER(HID_T), INTENT(IN) :: connector_id2 + INTEGER, INTENT(OUT) :: hdferr +!***** + + INTEGER(C_INT) :: cmp_c + + INTERFACE + INTEGER FUNCTION H5VLcmp_connector_cls(cmp, connector_id1, connector_id2) BIND(C, NAME='H5VLcmp_connector_cls') + IMPORT :: HID_T + IMPORT :: C_INT + INTEGER(C_INT) :: cmp + INTEGER(HID_T), INTENT(IN), VALUE :: connector_id1 + INTEGER(HID_T), INTENT(IN), VALUE :: connector_id2 + END FUNCTION H5VLcmp_connector_cls + END INTERFACE + + hdferr = INT(H5VLcmp_connector_cls(cmp_c, connector_id1, connector_id2)) + cmp = INT(cmp_c) + + END SUBROUTINE H5VLcmp_connector_cls_f + +END MODULE H5VL -- cgit v0.12 From 7c927a35902d50a03088c56efb9e0ad773500d02 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Mon, 11 Mar 2019 11:32:49 -0500 Subject: added more tests --- fortran/src/H5VLff.F90 | 42 +++++++++++++++++++++---------- fortran/src/H5_f.c | 63 +++++++++++++++++++++++----------------------- fortran/src/H5_ff.F90 | 65 ++++++++++++++++++++++++------------------------ fortran/src/HDF5.F90 | 1 + fortran/test/Makefile.am | 24 ++++++++++++++++++ 5 files changed, 117 insertions(+), 78 deletions(-) diff --git a/fortran/src/H5VLff.F90 b/fortran/src/H5VLff.F90 index 1e0dafb..5185c22 100644 --- a/fortran/src/H5VLff.F90 +++ b/fortran/src/H5VLff.F90 @@ -96,7 +96,7 @@ CONTAINS SUBROUTINE H5VLregister_connector_by_value_f(connector_value, vol_id, hdferr, vipl_id) IMPLICIT NONE - INTEGER :: connector_value + INTEGER, INTENT(IN) :: connector_value INTEGER(HID_T), INTENT(OUT) :: vol_id INTEGER, INTENT(OUT) :: hdferr INTEGER(HID_T), OPTIONAL, INTENT(IN) :: vipl_id @@ -108,7 +108,7 @@ CONTAINS BIND(C,NAME='H5VLregister_connector_by_value') IMPORT :: HID_T IMPORT :: C_INT - INTEGER(C_INT) :: connector_value + INTEGER(C_INT), VALUE :: connector_value INTEGER(HID_T), INTENT(IN), VALUE :: vipl_id END FUNCTION H5VLregister_connector_by_value END INTERFACE @@ -174,7 +174,7 @@ CONTAINS ! H5VLis_connector_registered_f ! ! PURPOSE -! Tests whether a VOL class has been registered or not. +! Retrieves the ID for a registered VOL connector. ! ! INPUTS ! cls - @@ -202,8 +202,10 @@ CONTAINS c_name = TRIM(name)//C_NULL_CHAR vol_id = H5VLget_connector_id(c_name) - hdferr = 0 - IF(vol_id.LT.0) hdferr = H5I_INVALID_HID_F + IF(vol_id.LT.0)THEN + hdferr = -1 + vol_id = H5I_INVALID_HID_F + ENDIF END SUBROUTINE H5VLget_connector_id_f @@ -215,29 +217,34 @@ CONTAINS INTEGER(SIZE_T), OPTIONAL :: name_len !***** CHARACTER(LEN=1,KIND=C_CHAR), DIMENSION(1:LEN(name)+1), TARGET :: c_name + INTEGER(SIZE_T) :: l TYPE(C_PTR) :: f_ptr INTERFACE INTEGER(SIZE_T) FUNCTION H5VLget_connector_name(obj_id, name, size) BIND(C,NAME='H5VLget_connector_name') - IMPORT :: HID_T, SIZE_T, C_PTR + IMPORT :: HID_T, SIZE_T, C_PTR, C_CHAR IMPLICIT NONE INTEGER(HID_T) , INTENT(IN), VALUE :: obj_id - TYPE(C_PTR), VALUE :: name + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: name + ! TYPE(C_PTR), value :: name INTEGER(SIZE_T), INTENT(IN), VALUE :: size END FUNCTION H5VLget_connector_name END INTERFACE hdferr = 0 IF(PRESENT(name_len))THEN - name_len = INT(H5VLget_connector_name(obj_id, C_NULL_PTR, 0_SIZE_T), SIZE_T) + name_len = INT(H5VLget_connector_name(obj_id, c_name, 0_SIZE_T), SIZE_T) IF(name_len.LT.0) hdferr = H5I_INVALID_HID_F ELSE - f_ptr = C_LOC(c_name(1)(1:1)) - - IF(INT(H5VLget_connector_name(obj_id, f_ptr, INT(LEN(name)+1,SIZE_T)), SIZE_T).LT.0)THEN + ! f_ptr = C_LOC(c_name(1)(1:1)) + PRINT*,LEN(name)+1 + l = INT(LEN(name)+1,SIZE_T) + IF(INT(H5VLget_connector_name(obj_id, c_name, l), SIZE_T).LT.0)THEN hdferr = H5I_INVALID_HID_F ELSE + PRINT*,c_name CALL HD5c2fstring(name,c_name,LEN(name)) + PRINT*,"name", name ENDIF ENDIF @@ -310,8 +317,17 @@ CONTAINS END SUBROUTINE H5VLunregister_connector_f -! H5VLcmp_connector_cls - + !--------------------------------------------------------------------------- + ! Function: H5VLcmp_connector_cls_f + ! + ! Purpose: Compares two connector classes (based on their value field) + ! + ! Return: Success: Non-negative, *cmp set to a value like strcmp + ! + ! Failure: Negative, *cmp unset + ! + !--------------------------------------------------------------------------- + SUBROUTINE H5VLcmp_connector_cls_f(cmp, connector_id1, connector_id2, hdferr) IMPLICIT NONE INTEGER, INTENT(OUT), TARGET :: cmp diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index bd8998e..fdf4b9e 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -720,38 +720,37 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5vl_flags[32] = (int_f)H5VL_FILE_MOUNT; h5vl_flags[33] = (int_f)H5VL_FILE_UNMOUNT; h5vl_flags[34] = (int_f)H5VL_FILE_IS_ACCESSIBLE; - h5vl_flags[35] = (int_f)H5VL_FILE_CACHE_VOL_CONN; - h5vl_flags[36] = (int_f)H5VL_GROUP_GET_GCPL; - h5vl_flags[37] = (int_f)H5VL_GROUP_GET_INFO; - h5vl_flags[38] = (int_f)H5VL_GROUP_FLUSH; - h5vl_flags[39] = (int_f)H5VL_GROUP_REFRESH; - h5vl_flags[40] = (int_f)H5VL_LINK_CREATE_HARD; - h5vl_flags[41] = (int_f)H5VL_LINK_CREATE_SOFT; - h5vl_flags[42] = (int_f)H5VL_LINK_CREATE_UD; - h5vl_flags[43] = (int_f)H5VL_LINK_GET_INFO; - h5vl_flags[44] = (int_f)H5VL_LINK_GET_NAME; - h5vl_flags[45] = (int_f)H5VL_LINK_GET_VAL; - h5vl_flags[46] = (int_f)H5VL_LINK_DELETE; - h5vl_flags[47] = (int_f)H5VL_LINK_EXISTS; - h5vl_flags[48] = (int_f)H5VL_LINK_ITER; - h5vl_flags[49] = (int_f)H5VL_REF_GET_NAME; - h5vl_flags[50] = (int_f)H5VL_REF_GET_REGION; - h5vl_flags[51] = (int_f)H5VL_REF_GET_TYPE; - h5vl_flags[52] = (int_f)H5VL_ID_GET_NAME; - h5vl_flags[53] = (int_f)H5VL_OBJECT_CHANGE_REF_COUNT; - h5vl_flags[54] = (int_f)H5VL_OBJECT_EXISTS; - h5vl_flags[55] = (int_f)H5VL_OBJECT_VISIT; - h5vl_flags[56] = (int_f)H5VL_REF_CREATE; - h5vl_flags[57] = (int_f)H5VL_OBJECT_FLUSH; - h5vl_flags[58] = (int_f)H5VL_OBJECT_REFRESH; - h5vl_flags[59] = (int_f)H5VL_REQUEST_WAITANY; - h5vl_flags[60] = (int_f)H5VL_REQUEST_WAITSOME; - h5vl_flags[61] = (int_f)H5VL_REQUEST_WAITALL; - h5vl_flags[62] = (int_f)H5VL_OBJECT_BY_SELF; - h5vl_flags[63] = (int_f)H5VL_OBJECT_BY_NAME; - h5vl_flags[64] = (int_f)H5VL_OBJECT_BY_IDX; - h5vl_flags[65] = (int_f)H5VL_OBJECT_BY_ADDR; - h5vl_flags[66] = (int_f)H5VL_OBJECT_BY_REF; + h5vl_flags[35] = (int_f)H5VL_GROUP_GET_GCPL; + h5vl_flags[36] = (int_f)H5VL_GROUP_GET_INFO; + h5vl_flags[37] = (int_f)H5VL_GROUP_FLUSH; + h5vl_flags[38] = (int_f)H5VL_GROUP_REFRESH; + h5vl_flags[39] = (int_f)H5VL_LINK_CREATE_HARD; + h5vl_flags[40] = (int_f)H5VL_LINK_CREATE_SOFT; + h5vl_flags[41] = (int_f)H5VL_LINK_CREATE_UD; + h5vl_flags[42] = (int_f)H5VL_LINK_GET_INFO; + h5vl_flags[43] = (int_f)H5VL_LINK_GET_NAME; + h5vl_flags[44] = (int_f)H5VL_LINK_GET_VAL; + h5vl_flags[45] = (int_f)H5VL_LINK_DELETE; + h5vl_flags[46] = (int_f)H5VL_LINK_EXISTS; + h5vl_flags[47] = (int_f)H5VL_LINK_ITER; + h5vl_flags[48] = (int_f)H5VL_REF_GET_NAME; + h5vl_flags[49] = (int_f)H5VL_REF_GET_REGION; + h5vl_flags[50] = (int_f)H5VL_REF_GET_TYPE; + h5vl_flags[51] = (int_f)H5VL_ID_GET_NAME; + h5vl_flags[52] = (int_f)H5VL_OBJECT_CHANGE_REF_COUNT; + h5vl_flags[53] = (int_f)H5VL_OBJECT_EXISTS; + h5vl_flags[54] = (int_f)H5VL_OBJECT_VISIT; + h5vl_flags[55] = (int_f)H5VL_REF_CREATE; + h5vl_flags[56] = (int_f)H5VL_OBJECT_FLUSH; + h5vl_flags[57] = (int_f)H5VL_OBJECT_REFRESH; + h5vl_flags[58] = (int_f)H5VL_REQUEST_WAITANY; + h5vl_flags[59] = (int_f)H5VL_REQUEST_WAITSOME; + h5vl_flags[60] = (int_f)H5VL_REQUEST_WAITALL; + h5vl_flags[61] = (int_f)H5VL_OBJECT_BY_SELF; + h5vl_flags[62] = (int_f)H5VL_OBJECT_BY_NAME; + h5vl_flags[63] = (int_f)H5VL_OBJECT_BY_IDX; + h5vl_flags[64] = (int_f)H5VL_OBJECT_BY_ADDR; + h5vl_flags[65] = (int_f)H5VL_OBJECT_BY_REF; /* * H5Z flags */ diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index 2adc6aa..0d82f42 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -133,7 +133,7 @@ MODULE H5LIB ! H5VL flags declaration ! - INTEGER, PARAMETER :: H5VL_FLAGS_LEN = 67 + INTEGER, PARAMETER :: H5VL_FLAGS_LEN = 66 INTEGER, DIMENSION(1:H5VL_FLAGS_LEN) :: H5VL_flags ! @@ -647,38 +647,37 @@ CONTAINS H5VL_FILE_MOUNT_F = H5VL_flags(33) H5VL_FILE_UNMOUNT_F = H5VL_flags(34) H5VL_FILE_IS_ACCESSIBLE_F = H5VL_flags(35) - H5VL_FILE_CACHE_VOL_CONN_F = H5VL_flags(36) - H5VL_GROUP_GET_GCPL_F = H5VL_flags(37) - H5VL_GROUP_GET_INFO_F = H5VL_flags(38) - H5VL_GROUP_FLUSH_F = H5VL_flags(39) - H5VL_GROUP_REFRESH_F = H5VL_flags(40) - H5VL_LINK_CREATE_HARD_F = H5VL_flags(41) - H5VL_LINK_CREATE_SOFT_F = H5VL_flags(42) - H5VL_LINK_CREATE_UD_F = H5VL_flags(43) - H5VL_LINK_GET_INFO_F = H5VL_flags(44) - H5VL_LINK_GET_NAME_F = H5VL_flags(45) - H5VL_LINK_GET_VAL_F = H5VL_flags(46) - H5VL_LINK_DELETE_F = H5VL_flags(47) - H5VL_LINK_EXISTS_F = H5VL_flags(48) - H5VL_LINK_ITER_F = H5VL_flags(49) - H5VL_REF_GET_NAME_F = H5VL_flags(50) - H5VL_REF_GET_REGION_F = H5VL_flags(51) - H5VL_REF_GET_TYPE_F = H5VL_flags(52) - H5VL_ID_GET_NAME_F = H5VL_flags(53) - H5VL_OBJECT_CHANGE_REF_COUNT_F = H5VL_flags(54) - H5VL_OBJECT_EXISTS_F = H5VL_flags(55) - H5VL_OBJECT_VISIT_F = H5VL_flags(56) - H5VL_REF_CREATE_F = H5VL_flags(57) - H5VL_OBJECT_FLUSH_F = H5VL_flags(58) - H5VL_OBJECT_REFRESH_F = H5VL_flags(59) - H5VL_REQUEST_WAITANY_F = H5VL_flags(60) - H5VL_REQUEST_WAITSOME_F = H5VL_flags(61) - H5VL_REQUEST_WAITALL_F = H5VL_flags(62) - H5VL_OBJECT_BY_SELF_F = H5VL_flags(63) - H5VL_OBJECT_BY_NAME_F = H5VL_flags(64) - H5VL_OBJECT_BY_IDX_F = H5VL_flags(65) - H5VL_OBJECT_BY_ADDR_F = H5VL_flags(66) - H5VL_OBJECT_BY_REF_F = H5VL_flags(67) + H5VL_GROUP_GET_GCPL_F = H5VL_flags(36) + H5VL_GROUP_GET_INFO_F = H5VL_flags(37) + H5VL_GROUP_FLUSH_F = H5VL_flags(38) + H5VL_GROUP_REFRESH_F = H5VL_flags(39) + H5VL_LINK_CREATE_HARD_F = H5VL_flags(40) + H5VL_LINK_CREATE_SOFT_F = H5VL_flags(41) + H5VL_LINK_CREATE_UD_F = H5VL_flags(42) + H5VL_LINK_GET_INFO_F = H5VL_flags(43) + H5VL_LINK_GET_NAME_F = H5VL_flags(44) + H5VL_LINK_GET_VAL_F = H5VL_flags(45) + H5VL_LINK_DELETE_F = H5VL_flags(46) + H5VL_LINK_EXISTS_F = H5VL_flags(47) + H5VL_LINK_ITER_F = H5VL_flags(48) + H5VL_REF_GET_NAME_F = H5VL_flags(49) + H5VL_REF_GET_REGION_F = H5VL_flags(50) + H5VL_REF_GET_TYPE_F = H5VL_flags(51) + H5VL_ID_GET_NAME_F = H5VL_flags(52) + H5VL_OBJECT_CHANGE_REF_COUNT_F = H5VL_flags(53) + H5VL_OBJECT_EXISTS_F = H5VL_flags(54) + H5VL_OBJECT_VISIT_F = H5VL_flags(55) + H5VL_REF_CREATE_F = H5VL_flags(56) + H5VL_OBJECT_FLUSH_F = H5VL_flags(57) + H5VL_OBJECT_REFRESH_F = H5VL_flags(58) + H5VL_REQUEST_WAITANY_F = H5VL_flags(59) + H5VL_REQUEST_WAITSOME_F = H5VL_flags(60) + H5VL_REQUEST_WAITALL_F = H5VL_flags(61) + H5VL_OBJECT_BY_SELF_F = H5VL_flags(62) + H5VL_OBJECT_BY_NAME_F = H5VL_flags(63) + H5VL_OBJECT_BY_IDX_F = H5VL_flags(64) + H5VL_OBJECT_BY_ADDR_F = H5VL_flags(65) + H5VL_OBJECT_BY_REF_F = H5VL_flags(66) ! ! H5Z flags ! diff --git a/fortran/src/HDF5.F90 b/fortran/src/HDF5.F90 index 0370224..fe38b7d 100644 --- a/fortran/src/HDF5.F90 +++ b/fortran/src/HDF5.F90 @@ -38,6 +38,7 @@ MODULE HDF5 USE H5O USE H5P USE H5R + USE H5VL USE H5Z USE H5_gen USE H5LIB diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index 8613cf9..ef6cd7e 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -30,14 +30,35 @@ noinst_LTLIBRARIES=libh5test_fortran.la # want to build a shared C library and a static Fortran library. If so, # pass the -static flag to the library linker. if FORTRAN_SHARED_CONDITIONAL + TEST_SCRIPT = test_vol_connector.sh + SCRIPT_DEPEND = vol_connector$(EXEEXT) else AM_LDFLAGS+=-static endif +check_SCRIPTS = $(TEST_SCRIPT) + # Our main targets, the tests themselves TEST_PROG=fortranlib_test fflush1 fflush2 fortranlib_test_1_8 fortranlib_test_F03 check_PROGRAMS=$(TEST_PROG) +if FORTRAN_SHARED_CONDITIONAL + check_PROGRAMS+= vol_connector +endif + +if FORTRAN_SHARED_CONDITIONAL + # The libh5test library provides common support code for the tests. + # The filter_plugin* libraries are for use in filter_plugin.c. + # Build them as shared libraries if that option was enabled in configure. + noinst_LTLIBRARIES += libnull_vol_connector.la + + # VOL plugin test libraries + # + # null_vol_connector is used for testing basic VOL plugin functionality. + libnull_vol_connector_la_SOURCES=null_vol_connector.c + libnull_vol_connector_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere +endif + libh5test_fortran_la_SOURCES = tf_gen.F90 tf.F90 t.c @@ -50,6 +71,7 @@ fortranlib_test_1_8_SOURCES = tH5O.F90 tH5A_1_8.F90 tH5G_1_8.F90 tH5MISC_1_8.F90 fortranlib_test_F03_SOURCES = tH5E_F03.F90 tH5F_F03.F90 tH5L_F03.F90 \ tH5O_F03.F90 tH5P_F03.F90 tH5T_F03.F90 tHDF5_F03.F90 fortranlib_test_F03.F90 +vol_connector_SOURCES=vol_connector.F90 fflush1_SOURCES=fflush1.F90 fflush2_SOURCES=fflush2.F90 @@ -95,6 +117,8 @@ H5_test_buildiface_SOURCES = H5_test_buildiface.F90 H5_test_buildiface_LDADD = +DISTCLEANFILES=test_vol_connector.sh # TODO:CHECK IF WORKS MSB + # fflush2 depends on files created by fflush1 fflush2.chkexe_: fflush1.chkexe_ -- cgit v0.12 From 6682f51a1157dc9e88bd34528fff999aee50ca2a Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Mon, 11 Mar 2019 11:34:10 -0500 Subject: add tests --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index 30fe725..e40e3c6 100644 --- a/configure.ac +++ b/configure.ac @@ -3551,6 +3551,7 @@ AC_CONFIG_FILES([src/libhdf5.settings fortran/src/Makefile fortran/src/H5fort_type_defines.h fortran/test/Makefile + fortran/test/test_vol_connector.sh fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/run-fortran-ex.sh -- cgit v0.12 From fc769f425f3b5574eb12522bf4c7bc94f4a236ff Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Wed, 24 Apr 2019 13:59:26 -0500 Subject: added missing files --- fortran/test/null_vol_connector.c | 148 +++++++++++++++++++++++++++ fortran/test/null_vol_connector.h | 25 +++++ fortran/test/test_vol_connector.sh.in | 84 +++++++++++++++ fortran/test/vol_connector.F90 | 187 ++++++++++++++++++++++++++++++++++ 4 files changed, 444 insertions(+) create mode 100644 fortran/test/null_vol_connector.c create mode 100644 fortran/test/null_vol_connector.h create mode 100644 fortran/test/test_vol_connector.sh.in create mode 100644 fortran/test/vol_connector.F90 diff --git a/fortran/test/null_vol_connector.c b/fortran/test/null_vol_connector.c new file mode 100644 index 0000000..00a22b8 --- /dev/null +++ b/fortran/test/null_vol_connector.c @@ -0,0 +1,148 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Purpose: A simple virtual object layer (VOL) connector with almost no + * functionality that is used for testing basic plugin handling + * (registration, etc.). + */ + +#include +#include "H5PLextern.h" + +#include "null_vol_connector.h" + +static void *H5VL_file_create(const char *name); +static herr_t H5VL_file_close(void *file); + +/* The VOL class struct */ +static const H5VL_class_t null_vol_g = { + 0, /* version */ + NULL_VOL_CONNECTOR_VALUE, /* value */ + NULL_VOL_CONNECTOR_NAME, /* name */ + 0, /* capability flags */ + NULL, /* initialize */ + NULL, /* terminate */ + (size_t)0, /* info size */ + NULL, /* info copy */ + NULL, /* info compare */ + NULL, /* info free */ + NULL, /* info to str */ + NULL, /* str to info */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* wrap_object */ + NULL, /* free_wrap_ctx */ + { /* attribute_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* read */ + NULL, /* write */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* dataset_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* read */ + NULL, /* write */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* datatype_cls */ + NULL, /* commit */ + NULL, /* open */ + NULL, /* get_size */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* file_cls */ + H5VL_file_create, /* create */ + NULL, /* open */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + H5VL_file_close /* close */ + }, + { /* group_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* link_cls */ + NULL, /* create */ + NULL, /* copy */ + NULL, /* move */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, + { /* object_cls */ + NULL, /* open */ + NULL, /* copy */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, + { /* request_cls */ + NULL, /* wait */ + NULL, /* notify */ + NULL, /* cancel */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* free */ + }, + NULL /* optional */ +}; + +typedef struct H5VL_t { + void *under_object; +} H5VL_t; + +/* These two functions are necessary to load this plugin using + * the HDF5 library. + */ + +H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_VOL;} +const void *H5PLget_plugin_info(void) {return &null_vol_g;} + +static void * +H5VL_file_create(const char *name) +{ + hid_t under_fapl; + H5VL_t *file; + + file = (H5VL_t *)calloc(1, sizeof(H5VL_t)); + + file->under_object = fopen(name, "w"); + + return (void *)file; +} + +static herr_t +H5VL_file_close(void *file) +{ + H5VL_t *f = (H5VL_t *)file; + + fclose(f->under_object); + free(f); + + return 1; +} + diff --git a/fortran/test/null_vol_connector.h b/fortran/test/null_vol_connector.h new file mode 100644 index 0000000..11c8826 --- /dev/null +++ b/fortran/test/null_vol_connector.h @@ -0,0 +1,25 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Purpose: A simple virtual object layer (VOL) connector with almost no + * functionality that is used for testing basic plugin handling + * (registration, etc.). + */ + +#ifndef _null_vol_connector_H +#define _null_vol_connector_H + +#define NULL_VOL_CONNECTOR_VALUE ((H5VL_class_value_t)160) +#define NULL_VOL_CONNECTOR_NAME "null_vol_connector" + +#endif /* _null_vol_connector_H */ + diff --git a/fortran/test/test_vol_connector.sh.in b/fortran/test/test_vol_connector.sh.in new file mode 100644 index 0000000..ee27f3b --- /dev/null +++ b/fortran/test/test_vol_connector.sh.in @@ -0,0 +1,84 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# +# This shell script is for testing VOL connector plugins. +# +srcdir=@srcdir@ +TOP_BUILDDIR=@top_builddir@ + +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +nerrors=0 +verbose=yes +exit_code=$EXIT_SUCCESS + +TEST_NAME=vol_connector +TEST_BIN=`pwd`/$TEST_NAME +FROM_DIR=`pwd`/.libs +case $(uname) in + CYGWIN* ) + NULL_VOL_PLUGIN="$FROM_DIR/cygnull_vol_connector*" + ;; + *) + NULL_VOL_PLUGIN="$FROM_DIR/libnull_vol_connector*" + ;; +esac +TEMP_PLUGIN_DIR=null_vol_plugin_dir +CP="cp -p -r" # Use -p to preserve mode,ownership, timestamps +RM="rm -rf" + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# Main Body +# Create test directory if necessary. +test -d $TEMP_PLUGIN_DIR || mkdir -p $TEMP_PLUGIN_DIR +if [ $? != 0 ]; then + echo "Failed to create VOL connector plugin test directory ($TEMP_PLUGIN_DIR)" + exit $EXIT_FAILURE +fi + +# Copy plugin for the tests. +$CP $NULL_VOL_PLUGIN $TEMP_PLUGIN_DIR +if [ $? != 0 ]; then + echo "Failed to copy NULL VOL plugin ($NULL_VOL_PLUGIN) to test directory." + exit $EXIT_FAILURE +fi + +# setup plugin path +ENVCMD="env HDF5_PLUGIN_PATH=${TEMP_PLUGIN_DIR}" + +# Run the test +$ENVCMD $TEST_BIN +if [ $? != 0 ]; then + nerrors=`expr $nerrors + 1` +fi + +# print results +if test $nerrors -ne 0 ; then + echo "$nerrors errors encountered" + exit_code=$EXIT_FAILURE +else + echo "All VOL plugin tests passed." + exit_code=$EXIT_SUCCESS +fi + +# Clean up temporary files/directories and leave +#$RM $TEMP_PLUGIN_DIR + +exit $exit_code diff --git a/fortran/test/vol_connector.F90 b/fortran/test/vol_connector.F90 new file mode 100644 index 0000000..8d3653c --- /dev/null +++ b/fortran/test/vol_connector.F90 @@ -0,0 +1,187 @@ +!****h* root/fortran/test/vol_connector.F90 +! +! NAME +! vol_connector.F90 +! +! FUNCTION +! +! Tests basic Fortran VOL plugin operations (registration, etc.). +! Uses the null VOL connector (built with the testing code) +! which is loaded as a dynamic plugin. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the COPYING file, which can be found at the root of the source code * +! distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * +! If you do not have access to either file, you may request a copy from * +! help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +!***** + +MODULE VOL_TMOD + + USE HDF5 + USE THDF5_F03 + IMPLICIT NONE + + + INTEGER, PARAMETER :: NULL_VOL_CONNECTOR_VALUE = 160 + CHARACTER(LEN=18), PARAMETER :: NULL_VOL_CONNECTOR_NAME = "null_vol_connector" + +CONTAINS + + !------------------------------------------------------------------------- + ! Function: test_registration_by_name() + ! + ! Purpose: Tests if we can load, register, and close a VOL + ! connector by name. + ! + !------------------------------------------------------------------------- + ! + + SUBROUTINE test_registration_by_name(total_error) + + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + INTEGER :: error = 0 + + LOGICAL :: is_registered = .FALSE. + INTEGER(hid_t) :: vol_id = 0, vol_id_out = 1 + CHARACTER(LEN=64) :: name + INTEGER(SIZE_T) :: name_len + INTEGER :: cmp = -1 + CHARACTER(LEN=12) :: filename = "h5null.posix" + INTEGER(HID_T) :: file_id + + ! The null VOL connector should not be registered at the start of the test + CALL H5VLis_connector_registered_f( NULL_VOL_CONNECTOR_NAME, is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + + ! Register the connector by name + CALL H5VLregister_connector_by_name_f(NULL_VOL_CONNECTOR_NAME, vol_id, error) + CALL check("H5VLregister_connector_by_name_f",error,total_error) + + ! The connector should be registered now + CALL H5VLis_connector_registered_f(NULL_VOL_CONNECTOR_NAME, is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error) + + CALL H5VLget_connector_id_f(NULL_VOL_CONNECTOR_NAME, vol_id_out, error) + CALL check("H5VLget_connector_id_f",error,total_error) + + CALL H5VLcmp_connector_cls_f( cmp, vol_id_out, vol_id, error) + CALL check("H5VLcmp_connector_cls_f",error, total_error) + CALL VERIFY("H5VLcmp_connector_cls_f", cmp, 0, total_error) + + CALL H5VLclose_f(vol_id_out, error) + + ! Unregister the connector + CALL H5VLunregister_connector_f(vol_id, error) + CALL check("H5VLunregister_connector_f", error, total_error) + + ! The connector should not be registered now + CALL H5VLis_connector_registered_f( NULL_VOL_CONNECTOR_NAME, is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + + END SUBROUTINE test_registration_by_name + + !------------------------------------------------------------------------- + ! Function: test_registration_by_value() + ! + ! Purpose: Tests if we can load, register, and close a VOL + ! connector by value. + ! + !------------------------------------------------------------------------- + + SUBROUTINE test_registration_by_value(total_error) + + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + INTEGER :: error = 0 + + LOGICAL :: is_registered = .FALSE. + INTEGER(hid_t) :: vol_id = 0 + + + ! The null VOL connector should not be registered at the start of the test + CALL H5VLis_connector_registered_f( NULL_VOL_CONNECTOR_NAME, is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + + ! Register the connector by value + CALL H5VLregister_connector_by_value_f(NULL_VOL_CONNECTOR_VALUE, vol_id, error) + CALL check("H5VLregister_connector_by_value_f", error, total_error) + + ! The connector should be registered now + CALL H5VLis_connector_registered_f(NULL_VOL_CONNECTOR_NAME, is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error) + + ! Unregister the connector + CALL H5VLunregister_connector_f(vol_id, error) + CALL check("H5VLunregister_connector_f", error, total_error) + + ! The connector should not be registered now + CALL H5VLis_connector_registered_f( NULL_VOL_CONNECTOR_NAME, is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + + END SUBROUTINE test_registration_by_value + +END MODULE VOL_TMOD + + +PROGRAM vol_connector + + USE HDF5 + USE THDF5_F03 + USE VOL_TMOD + + IMPLICIT NONE + INTEGER :: total_error = 0 + INTEGER :: error + INTEGER :: ret_total_error + LOGICAL :: cleanup, status + + CALL h5open_f(error) + + cleanup = .TRUE. + CALL h5_env_nocleanup_f(status) + IF(status) cleanup=.FALSE. + + WRITE(*,'(18X,A)') '==============================' + WRITE(*,'(24X,A)') 'FORTRAN VOL tests' + WRITE(*,'(18X,A)') '==============================' + + WRITE(*,'(A)') "Testing VOL connector plugin functionality." + ret_total_error = 0 + CALL test_registration_by_name(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing VOL registration by name', total_error) + + ret_total_error = 0 + CALL test_registration_by_value(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing VOL registration by value', total_error) + + WRITE(*, fmt = '(/18X,A)') '============================================' + WRITE(*, fmt = '(19X, A)', advance='NO') ' FORTRAN VOL tests completed with ' + WRITE(*, fmt = '(I4)', advance='NO') total_error + WRITE(*, fmt = '(A)' ) ' error(s) ! ' + WRITE(*,'(18X,A)') '============================================' + + CALL h5close_f(error) + + ! if errors detected, exit with non-zero code. + IF (total_error .NE. 0) CALL h5_exit_f(1) + +END PROGRAM vol_connector -- cgit v0.12 From 1d6641ee3af65bdbe5e0f1f8fa56be8ea52dd5d7 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Wed, 24 Apr 2019 15:17:10 -0500 Subject: added connector_name test --- fortran/src/H5VLff.F90 | 2 +- fortran/test/vol_connector.F90 | 12 ++++++++++-- test/vol_plugin.c | 8 ++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/fortran/src/H5VLff.F90 b/fortran/src/H5VLff.F90 index 5185c22..e3469fb 100644 --- a/fortran/src/H5VLff.F90 +++ b/fortran/src/H5VLff.F90 @@ -242,7 +242,7 @@ CONTAINS IF(INT(H5VLget_connector_name(obj_id, c_name, l), SIZE_T).LT.0)THEN hdferr = H5I_INVALID_HID_F ELSE - PRINT*,c_name + PRINT*,"C_NAME", c_name CALL HD5c2fstring(name,c_name,LEN(name)) PRINT*,"name", name ENDIF diff --git a/fortran/test/vol_connector.F90 b/fortran/test/vol_connector.F90 index 8d3653c..7810c97 100644 --- a/fortran/test/vol_connector.F90 +++ b/fortran/test/vol_connector.F90 @@ -58,8 +58,8 @@ CONTAINS CHARACTER(LEN=64) :: name INTEGER(SIZE_T) :: name_len INTEGER :: cmp = -1 - CHARACTER(LEN=12) :: filename = "h5null.posix" - INTEGER(HID_T) :: file_id +! CHARACTER(LEN=12) :: filename = "h5null.posix" +! INTEGER(HID_T) :: file_id ! The null VOL connector should not be registered at the start of the test CALL H5VLis_connector_registered_f( NULL_VOL_CONNECTOR_NAME, is_registered, error) @@ -78,6 +78,14 @@ CONTAINS CALL H5VLget_connector_id_f(NULL_VOL_CONNECTOR_NAME, vol_id_out, error) CALL check("H5VLget_connector_id_f",error,total_error) + PRINT*,vol_id_out + + CALL H5VLget_connector_name_f(vol_id_out, name, error, name_len) + CALL check("H5VLget_connector_name_f",error,total_error) + + ! CALL H5VLget_connector_name_f(vol_id_out, name, error) + ! CALL check("H5VLget_connector_name_f",error,total_error) + CALL H5VLcmp_connector_cls_f( cmp, vol_id_out, vol_id, error) CALL check("H5VLcmp_connector_cls_f",error, total_error) CALL VERIFY("H5VLcmp_connector_cls_f", cmp, 0, total_error) diff --git a/test/vol_plugin.c b/test/vol_plugin.c index 236a67e..73918ff 100644 --- a/test/vol_plugin.c +++ b/test/vol_plugin.c @@ -219,6 +219,8 @@ test_getters(void) htri_t is_registered = FAIL; hid_t vol_id = H5I_INVALID_HID; hid_t vol_id_out = H5I_INVALID_HID; + char name[64]; + size_t size = 0; TESTING("VOL getters"); @@ -238,6 +240,12 @@ test_getters(void) if(vol_id != vol_id_out) FAIL_PUTS_ERROR("VOL connector IDs don't match"); + if((vol_id_out = H5VLget_connector_name(vol_id_out, name, size)) < 0) + TEST_ERROR; + + printf("%s %ld \n", name, size); + + /* Unregister the connector */ if(H5VLunregister_connector(vol_id) < 0) TEST_ERROR; -- cgit v0.12 From bdf882ae392e56b7bf4c3e47ea26a0e19a0125f3 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Sun, 5 May 2019 00:41:19 -0500 Subject: Code improvement Description: Fixed potential division by zero occurrences and changed an assert to if statement. Platforms tested: Linux/64 (jelly) Linux/64 (platypus) Darwin (osx1011test) --- src/H5Aint.c | 6 +++++- src/H5Dchunk.c | 9 ++++++--- src/H5Dcompact.c | 7 ++++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/H5Aint.c b/src/H5Aint.c index d8ba92a..ebd6860 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2396,9 +2396,13 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, /* Check for expanding references */ if(cpy_info->expand_ref) { size_t ref_count; + size_t dst_dt_size; /* Destination datatype size */ + /* Determine size of the destination datatype */ + if(0 == (dst_dt_size = H5T_get_size(attr_dst->shared->dt))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to determine datatype size") /* Determine # of reference elements to copy */ - ref_count = attr_dst->shared->data_size / H5T_get_size(attr_dst->shared->dt); + ref_count = attr_dst->shared->data_size / dst_dt_size; /* Copy objects referenced in source buffer to destination file and set destination elements */ if(H5O_copy_expand_ref(file_src, attr_dst->shared->data, file_dst, attr_dst->shared->data, ref_count, H5T_get_ref_type(attr_dst->shared->dt), cpy_info) < 0) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 93b4427..0b38b0f 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -705,15 +705,18 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, /* Compute the # of chunks in dataset dimensions */ for(u = 0, layout->nchunks = 1, layout->max_nchunks = 1; u < ndims; u++) { - /* Sanity check */ - HDassert(layout->dim[u] > 0); - /* Round up to the next integer # of chunks, to accommodate partial chunks */ layout->chunks[u] = ((curr_dims[u] + layout->dim[u]) - 1) / layout->dim[u]; if(H5S_UNLIMITED == max_dims[u]) layout->max_chunks[u] = H5S_UNLIMITED; else + { + /* Sanity check */ + if(layout->dim[u] == 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dimension size must be > 0, dim = %u ", u) + layout->max_chunks[u] = ((max_dims[u] + layout->dim[u]) - 1) / layout->dim[u]; + } /* Accumulate the # of chunks */ layout->nchunks *= layout->chunks[u]; diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index df61856..29401f8 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -559,9 +559,14 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds /* Check for expanding references */ if(cpy_info->expand_ref) { size_t ref_count; + size_t src_dt_size; /* Source datatype size */ + + /* Determine largest datatype size */ + if(0 == (src_dt_size = H5T_get_size(dt_src))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size") /* Determine # of reference elements to copy */ - ref_count = storage_src->size / H5T_get_size(dt_src); + ref_count = storage_src->size / src_dt_size; /* Copy objects referenced in source buffer to destination file and set destination elements */ if(H5O_copy_expand_ref(f_src, storage_src->buf, f_dst, -- cgit v0.12 From 32c4900e89d845f0490bdbabddd2aab9c42165de Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 16 May 2019 15:05:12 -0500 Subject: removed VOLL NULL connector and replaced it with native VOL --- MANIFEST | 2 +- fortran/src/H5VLff.F90 | 61 +++++++------------------------------- fortran/src/hdf5_fortrandll.def.in | 1 - fortran/test/Makefile.am | 23 +------------- fortran/test/null_vol_connector.c | 2 ++ fortran/test/vol_connector.F90 | 49 +++++++++++++----------------- test/vol_plugin.c | 5 ++++ 7 files changed, 39 insertions(+), 104 deletions(-) diff --git a/MANIFEST b/MANIFEST index 9750c49..a50859a 100644 --- a/MANIFEST +++ b/MANIFEST @@ -265,8 +265,8 @@ ./fortran/src/h5fc.in ./fortran/src/hdf5_fortrandll.def.in - ./fortran/test/Makefile.am +./fortran/test/vol_connector.F90 ./fortran/test/fflush1.F90 ./fortran/test/fflush2.F90 ./fortran/test/fortranlib_test.F90 diff --git a/fortran/src/H5VLff.F90 b/fortran/src/H5VLff.F90 index e3469fb..0c5e8fd 100644 --- a/fortran/src/H5VLff.F90 +++ b/fortran/src/H5VLff.F90 @@ -4,7 +4,7 @@ ! MODULE H5VL ! ! PURPOSE -! This file contains Fortran interfaces for H5VL functions. +! This file contains Fortran interfaces for H5VL (VOL) functions. ! ! COPYRIGHT ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -57,9 +57,9 @@ CONTAINS ! layer class by name. ! ! INPUTS -! cls - +! name - Connector name ! OUTPUTS -! vol_id - +! vol_id - VOL id ! hdferr - Returns 0 if successful and -1 if fails ! SOURCE @@ -72,10 +72,10 @@ CONTAINS !***** CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name INTEGER(HID_T) :: vipl_id_default - INTERFACE - INTEGER(HID_T) FUNCTION H5VLregister_connector_by_name(name, vipl_id) BIND(C,NAME='H5VLregister_connector_by_name') + INTEGER(HID_T) FUNCTION H5VLregister_connector_by_name(name, vipl_id) & + BIND(C,NAME='H5VLregister_connector_by_name') IMPORT :: C_CHAR IMPORT :: HID_T CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name @@ -113,7 +113,6 @@ CONTAINS END FUNCTION H5VLregister_connector_by_value END INTERFACE - vipl_id_default = H5P_DEFAULT_F IF(PRESENT(vipl_id)) vipl_id_default = vipl_id @@ -134,9 +133,9 @@ CONTAINS ! Tests whether a VOL class has been registered or not. ! ! INPUTS -! cls - +! name - Connector name ! OUTPUTS -! vol_id - +! registered - state of VOL class registration ! hdferr - Returns 0 if successful and -1 if fails ! SOURCE @@ -177,9 +176,9 @@ CONTAINS ! Retrieves the ID for a registered VOL connector. ! ! INPUTS -! cls - +! name - Connector name ! OUTPUTS -! vol_id - +! vol_id - Connector id ! hdferr - Returns 0 if successful and -1 if fails ! SOURCE @@ -236,15 +235,11 @@ CONTAINS name_len = INT(H5VLget_connector_name(obj_id, c_name, 0_SIZE_T), SIZE_T) IF(name_len.LT.0) hdferr = H5I_INVALID_HID_F ELSE - ! f_ptr = C_LOC(c_name(1)(1:1)) - PRINT*,LEN(name)+1 l = INT(LEN(name)+1,SIZE_T) IF(INT(H5VLget_connector_name(obj_id, c_name, l), SIZE_T).LT.0)THEN hdferr = H5I_INVALID_HID_F ELSE - PRINT*,"C_NAME", c_name CALL HD5c2fstring(name,c_name,LEN(name)) - PRINT*,"name", name ENDIF ENDIF @@ -261,7 +256,7 @@ CONTAINS ! Closes a VOL connector ID. ! ! INPUTS -! plugin_id - A valid identifier of the connectory to unregister. +! vol_id - A valid identifier of the connectory to unregister. ! ! OUTPUTS ! hdferr - Returns 0 if successful and -1 if fails @@ -317,40 +312,4 @@ CONTAINS END SUBROUTINE H5VLunregister_connector_f - !--------------------------------------------------------------------------- - ! Function: H5VLcmp_connector_cls_f - ! - ! Purpose: Compares two connector classes (based on their value field) - ! - ! Return: Success: Non-negative, *cmp set to a value like strcmp - ! - ! Failure: Negative, *cmp unset - ! - !--------------------------------------------------------------------------- - - SUBROUTINE H5VLcmp_connector_cls_f(cmp, connector_id1, connector_id2, hdferr) - IMPLICIT NONE - INTEGER, INTENT(OUT), TARGET :: cmp - INTEGER(HID_T), INTENT(IN) :: connector_id1 - INTEGER(HID_T), INTENT(IN) :: connector_id2 - INTEGER, INTENT(OUT) :: hdferr -!***** - - INTEGER(C_INT) :: cmp_c - - INTERFACE - INTEGER FUNCTION H5VLcmp_connector_cls(cmp, connector_id1, connector_id2) BIND(C, NAME='H5VLcmp_connector_cls') - IMPORT :: HID_T - IMPORT :: C_INT - INTEGER(C_INT) :: cmp - INTEGER(HID_T), INTENT(IN), VALUE :: connector_id1 - INTEGER(HID_T), INTENT(IN), VALUE :: connector_id2 - END FUNCTION H5VLcmp_connector_cls - END INTERFACE - - hdferr = INT(H5VLcmp_connector_cls(cmp_c, connector_id1, connector_id2)) - cmp = INT(cmp_c) - - END SUBROUTINE H5VLcmp_connector_cls_f - END MODULE H5VL diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 390c2b7..e143b45 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -460,7 +460,6 @@ H5VL_mp_H5VLGET_CONNECTOR_ID_F H5VL_mp_H5VLGET_CONNECTOR_NAME_F H5VL_mp_H5VLCLOSE_F H5VL_mp_H5VLUNREGISTER_CONNECTOR_F -H5VL_mp_H5VLCMP_CONNECTOR_CLS_F ; H5Z H5Z_mp_H5ZUNREGISTER_F H5Z_mp_H5ZFILTER_AVAIL_F diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index ef6cd7e..9e03996 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -30,8 +30,6 @@ noinst_LTLIBRARIES=libh5test_fortran.la # want to build a shared C library and a static Fortran library. If so, # pass the -static flag to the library linker. if FORTRAN_SHARED_CONDITIONAL - TEST_SCRIPT = test_vol_connector.sh - SCRIPT_DEPEND = vol_connector$(EXEEXT) else AM_LDFLAGS+=-static endif @@ -39,26 +37,9 @@ endif check_SCRIPTS = $(TEST_SCRIPT) # Our main targets, the tests themselves -TEST_PROG=fortranlib_test fflush1 fflush2 fortranlib_test_1_8 fortranlib_test_F03 +TEST_PROG=fortranlib_test fflush1 fflush2 fortranlib_test_1_8 fortranlib_test_F03 vol_connector check_PROGRAMS=$(TEST_PROG) -if FORTRAN_SHARED_CONDITIONAL - check_PROGRAMS+= vol_connector -endif - -if FORTRAN_SHARED_CONDITIONAL - # The libh5test library provides common support code for the tests. - # The filter_plugin* libraries are for use in filter_plugin.c. - # Build them as shared libraries if that option was enabled in configure. - noinst_LTLIBRARIES += libnull_vol_connector.la - - # VOL plugin test libraries - # - # null_vol_connector is used for testing basic VOL plugin functionality. - libnull_vol_connector_la_SOURCES=null_vol_connector.c - libnull_vol_connector_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere -endif - libh5test_fortran_la_SOURCES = tf_gen.F90 tf.F90 t.c @@ -117,8 +98,6 @@ H5_test_buildiface_SOURCES = H5_test_buildiface.F90 H5_test_buildiface_LDADD = -DISTCLEANFILES=test_vol_connector.sh # TODO:CHECK IF WORKS MSB - # fflush2 depends on files created by fflush1 fflush2.chkexe_: fflush1.chkexe_ diff --git a/fortran/test/null_vol_connector.c b/fortran/test/null_vol_connector.c index 00a22b8..e30a659 100644 --- a/fortran/test/null_vol_connector.c +++ b/fortran/test/null_vol_connector.c @@ -127,6 +127,8 @@ H5VL_file_create(const char *name) { hid_t under_fapl; H5VL_t *file; + + printf(" H5VL_file_create \n"); file = (H5VL_t *)calloc(1, sizeof(H5VL_t)); diff --git a/fortran/test/vol_connector.F90 b/fortran/test/vol_connector.F90 index 7810c97..7f19d79 100644 --- a/fortran/test/vol_connector.F90 +++ b/fortran/test/vol_connector.F90 @@ -31,9 +31,8 @@ MODULE VOL_TMOD USE THDF5_F03 IMPLICIT NONE - - INTEGER, PARAMETER :: NULL_VOL_CONNECTOR_VALUE = 160 - CHARACTER(LEN=18), PARAMETER :: NULL_VOL_CONNECTOR_NAME = "null_vol_connector" + INTEGER, PARAMETER :: NATIVE_VOL_CONNECTOR_VALUE = 0 + CHARACTER(LEN=6), PARAMETER :: NATIVE_VOL_CONNECTOR_NAME = "native" CONTAINS @@ -57,50 +56,47 @@ CONTAINS INTEGER(hid_t) :: vol_id = 0, vol_id_out = 1 CHARACTER(LEN=64) :: name INTEGER(SIZE_T) :: name_len + INTEGER(hid_t) :: file_id INTEGER :: cmp = -1 -! CHARACTER(LEN=12) :: filename = "h5null.posix" -! INTEGER(HID_T) :: file_id ! The null VOL connector should not be registered at the start of the test - CALL H5VLis_connector_registered_f( NULL_VOL_CONNECTOR_NAME, is_registered, error) + CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) CALL check("H5VLis_connector_registered_f",error,total_error) CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) ! Register the connector by name - CALL H5VLregister_connector_by_name_f(NULL_VOL_CONNECTOR_NAME, vol_id, error) + CALL H5VLregister_connector_by_name_f(NATIVE_VOL_CONNECTOR_NAME, vol_id, error) CALL check("H5VLregister_connector_by_name_f",error,total_error) ! The connector should be registered now - CALL H5VLis_connector_registered_f(NULL_VOL_CONNECTOR_NAME, is_registered, error) + CALL H5VLis_connector_registered_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error) CALL check("H5VLis_connector_registered_f",error,total_error) CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error) - CALL H5VLget_connector_id_f(NULL_VOL_CONNECTOR_NAME, vol_id_out, error) + CALL H5VLget_connector_id_f(NATIVE_VOL_CONNECTOR_NAME, vol_id_out, error) CALL check("H5VLget_connector_id_f",error,total_error) - PRINT*,vol_id_out + CALL H5Fcreate_f("voltest.h5",H5F_ACC_TRUNC_F, file_id, error) + CALL check("H5F_create_f",error,total_error) - CALL H5VLget_connector_name_f(vol_id_out, name, error, name_len) + CALL H5VLget_connector_name_f(file_id, name, error, name_len) CALL check("H5VLget_connector_name_f",error,total_error) + CALL VERIFY("H5VLget_connector_name_f", INT(name_len), LEN_TRIM(NATIVE_VOL_CONNECTOR_NAME), total_error) - ! CALL H5VLget_connector_name_f(vol_id_out, name, error) - ! CALL check("H5VLget_connector_name_f",error,total_error) + CALL H5VLget_connector_name_f(file_id, name, error) + CALL check("H5VLget_connector_name_f",error,total_error) + CALL VERIFY("H5VLget_connector_name_f", name, NATIVE_VOL_CONNECTOR_NAME, total_error) - CALL H5VLcmp_connector_cls_f( cmp, vol_id_out, vol_id, error) - CALL check("H5VLcmp_connector_cls_f",error, total_error) - CALL VERIFY("H5VLcmp_connector_cls_f", cmp, 0, total_error) + CALL H5Fclose_f(file_id, error) + CALL check("H5Fclose_f",error,total_error) CALL H5VLclose_f(vol_id_out, error) + CALL check("H5VLclose_f",error, total_error) ! Unregister the connector CALL H5VLunregister_connector_f(vol_id, error) CALL check("H5VLunregister_connector_f", error, total_error) - ! The connector should not be registered now - CALL H5VLis_connector_registered_f( NULL_VOL_CONNECTOR_NAME, is_registered, error) - CALL check("H5VLis_connector_registered_f",error,total_error) - CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) - END SUBROUTINE test_registration_by_name !------------------------------------------------------------------------- @@ -123,16 +119,16 @@ CONTAINS ! The null VOL connector should not be registered at the start of the test - CALL H5VLis_connector_registered_f( NULL_VOL_CONNECTOR_NAME, is_registered, error) + CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) CALL check("H5VLis_connector_registered_f",error,total_error) CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) ! Register the connector by value - CALL H5VLregister_connector_by_value_f(NULL_VOL_CONNECTOR_VALUE, vol_id, error) + CALL H5VLregister_connector_by_value_f(NATIVE_VOL_CONNECTOR_VALUE, vol_id, error) CALL check("H5VLregister_connector_by_value_f", error, total_error) ! The connector should be registered now - CALL H5VLis_connector_registered_f(NULL_VOL_CONNECTOR_NAME, is_registered, error) + CALL H5VLis_connector_registered_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error) CALL check("H5VLis_connector_registered_f",error,total_error) CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error) @@ -140,11 +136,6 @@ CONTAINS CALL H5VLunregister_connector_f(vol_id, error) CALL check("H5VLunregister_connector_f", error, total_error) - ! The connector should not be registered now - CALL H5VLis_connector_registered_f( NULL_VOL_CONNECTOR_NAME, is_registered, error) - CALL check("H5VLis_connector_registered_f",error,total_error) - CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) - END SUBROUTINE test_registration_by_value END MODULE VOL_TMOD diff --git a/test/vol_plugin.c b/test/vol_plugin.c index 73918ff..51b8e1e 100644 --- a/test/vol_plugin.c +++ b/test/vol_plugin.c @@ -114,6 +114,11 @@ test_registration_by_name(void) if(FALSE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector was not registered"); + hid_t acc_tpl = H5Pcreate(H5P_FILE_ACCESS); + H5Pset_vol(acc_tpl, vol_id, NULL); + + H5Pclose(acc_tpl); + /* Unregister the connector */ if(H5VLunregister_connector(vol_id) < 0) TEST_ERROR; -- cgit v0.12 From 1f505e5ab27ec3132e974a72438e44b2dc42156e Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 16 May 2019 15:20:32 -0500 Subject: removed H5VL constants --- configure.ac | 1 - fortran/src/H5_f.c | 73 +---------------- fortran/src/H5_ff.F90 | 80 +----------------- fortran/src/H5f90global.F90 | 141 -------------------------------- fortran/src/H5f90proto.h | 2 +- fortran/test/null_vol_connector.c | 150 ---------------------------------- fortran/test/null_vol_connector.h | 25 ------ fortran/test/test_vol_connector.sh.in | 84 ------------------- test/vol_plugin.c | 13 --- 9 files changed, 3 insertions(+), 566 deletions(-) delete mode 100644 fortran/test/null_vol_connector.c delete mode 100644 fortran/test/null_vol_connector.h delete mode 100644 fortran/test/test_vol_connector.sh.in diff --git a/configure.ac b/configure.ac index 8c080ed..0d0e0df 100644 --- a/configure.ac +++ b/configure.ac @@ -3553,7 +3553,6 @@ AC_CONFIG_FILES([src/libhdf5.settings fortran/src/Makefile fortran/src/H5fort_type_defines.h fortran/test/Makefile - fortran/test/test_vol_connector.sh fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/run-fortran-ex.sh diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index fdf4b9e..2d1c6e7 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -335,7 +335,6 @@ h5close_types_c( hid_t_f * types, int_f *lentypes, * h5s_hid_flags - H5S interface flags of type hid_t * h5s_hsize_flags - H5S interface flags of type hsize_t * h5t_flags - H5T interface flags - * h5vl_flags - H5VL interface flags * h5z_flags - H5Z interface flags * OUTPUTS * None @@ -367,7 +366,7 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, int_f *h5g_flags, int_f *h5i_flags, int_f *h5l_flags, int_f *h5o_flags, hid_t_f *h5p_flags, int_f *h5p_flags_int, int_f *h5r_flags, int_f *h5s_flags, hid_t_f *h5s_hid_flags, hsize_t_f *h5s_hsize_flags, - int_f *h5t_flags, int_f *h5vl_flags, int_f *h5z_flags, int_f *h5_generic_flags, + int_f *h5t_flags, int_f *h5z_flags, int_f *h5_generic_flags, haddr_t_f *h5_haddr_generic_flags) /******/ { @@ -643,7 +642,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5s_flags[15] = (int_f)H5S_SEL_POINTS; h5s_flags[16] = (int_f)H5S_SEL_HYPERSLABS; h5s_flags[17] = (int_f)H5S_SEL_ALL; - /* * H5T flags */ @@ -683,75 +681,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5t_flags[33] = (int_f)H5T_DIR_ASCEND; h5t_flags[34] = (int_f)H5T_DIR_DESCEND; /* - * H5VL flags - */ - h5vl_flags[0] = (int_f)H5VL_ATTR_GET_ACPL; - h5vl_flags[1] = (int_f)H5VL_ATTR_GET_INFO; - h5vl_flags[2] = (int_f)H5VL_ATTR_GET_NAME; - h5vl_flags[3] = (int_f)H5VL_ATTR_GET_SPACE; - h5vl_flags[4] = (int_f)H5VL_ATTR_GET_STORAGE_SIZE; - h5vl_flags[5] = (int_f)H5VL_ATTR_GET_TYPE; - h5vl_flags[6] = (int_f)H5VL_ATTR_DELETE; - h5vl_flags[7] = (int_f)H5VL_ATTR_EXISTS; - h5vl_flags[8] = (int_f)H5VL_ATTR_ITER; - h5vl_flags[8] = (int_f)H5VL_ATTR_RENAME; - h5vl_flags[9] = (int_f)H5VL_DATASET_GET_DAPL; - h5vl_flags[11] = (int_f)H5VL_DATASET_GET_DCPL; - h5vl_flags[12] = (int_f)H5VL_DATASET_GET_OFFSET; - h5vl_flags[13] = (int_f)H5VL_DATASET_GET_SPACE; - h5vl_flags[14] = (int_f)H5VL_DATASET_GET_SPACE_STATUS; - h5vl_flags[15] = (int_f)H5VL_DATASET_GET_STORAGE_SIZE; - h5vl_flags[16] = (int_f)H5VL_DATASET_GET_TYPE; - h5vl_flags[17] = (int_f)H5VL_DATASET_SET_EXTENT; - h5vl_flags[18] = (int_f)H5VL_DATASET_FLUSH; - h5vl_flags[19] = (int_f)H5VL_DATASET_REFRESH; - h5vl_flags[20] = (int_f)H5VL_DATATYPE_GET_BINARY; - h5vl_flags[21] = (int_f)H5VL_DATATYPE_GET_TCPL; - h5vl_flags[22] = (int_f)H5VL_DATATYPE_FLUSH; - h5vl_flags[23] = (int_f)H5VL_DATATYPE_REFRESH; - h5vl_flags[24] = (int_f)H5VL_FILE_GET_FAPL; - h5vl_flags[25] = (int_f)H5VL_FILE_GET_FCPL; - h5vl_flags[26] = (int_f)H5VL_FILE_GET_INTENT; - h5vl_flags[27] = (int_f)H5VL_FILE_GET_NAME; - h5vl_flags[28] = (int_f)H5VL_FILE_GET_OBJ_COUNT; - h5vl_flags[29] = (int_f)H5VL_FILE_GET_OBJ_IDS; - h5vl_flags[30] = (int_f)H5VL_FILE_FLUSH; - h5vl_flags[31] = (int_f)H5VL_FILE_REOPEN; - h5vl_flags[32] = (int_f)H5VL_FILE_MOUNT; - h5vl_flags[33] = (int_f)H5VL_FILE_UNMOUNT; - h5vl_flags[34] = (int_f)H5VL_FILE_IS_ACCESSIBLE; - h5vl_flags[35] = (int_f)H5VL_GROUP_GET_GCPL; - h5vl_flags[36] = (int_f)H5VL_GROUP_GET_INFO; - h5vl_flags[37] = (int_f)H5VL_GROUP_FLUSH; - h5vl_flags[38] = (int_f)H5VL_GROUP_REFRESH; - h5vl_flags[39] = (int_f)H5VL_LINK_CREATE_HARD; - h5vl_flags[40] = (int_f)H5VL_LINK_CREATE_SOFT; - h5vl_flags[41] = (int_f)H5VL_LINK_CREATE_UD; - h5vl_flags[42] = (int_f)H5VL_LINK_GET_INFO; - h5vl_flags[43] = (int_f)H5VL_LINK_GET_NAME; - h5vl_flags[44] = (int_f)H5VL_LINK_GET_VAL; - h5vl_flags[45] = (int_f)H5VL_LINK_DELETE; - h5vl_flags[46] = (int_f)H5VL_LINK_EXISTS; - h5vl_flags[47] = (int_f)H5VL_LINK_ITER; - h5vl_flags[48] = (int_f)H5VL_REF_GET_NAME; - h5vl_flags[49] = (int_f)H5VL_REF_GET_REGION; - h5vl_flags[50] = (int_f)H5VL_REF_GET_TYPE; - h5vl_flags[51] = (int_f)H5VL_ID_GET_NAME; - h5vl_flags[52] = (int_f)H5VL_OBJECT_CHANGE_REF_COUNT; - h5vl_flags[53] = (int_f)H5VL_OBJECT_EXISTS; - h5vl_flags[54] = (int_f)H5VL_OBJECT_VISIT; - h5vl_flags[55] = (int_f)H5VL_REF_CREATE; - h5vl_flags[56] = (int_f)H5VL_OBJECT_FLUSH; - h5vl_flags[57] = (int_f)H5VL_OBJECT_REFRESH; - h5vl_flags[58] = (int_f)H5VL_REQUEST_WAITANY; - h5vl_flags[59] = (int_f)H5VL_REQUEST_WAITSOME; - h5vl_flags[60] = (int_f)H5VL_REQUEST_WAITALL; - h5vl_flags[61] = (int_f)H5VL_OBJECT_BY_SELF; - h5vl_flags[62] = (int_f)H5VL_OBJECT_BY_NAME; - h5vl_flags[63] = (int_f)H5VL_OBJECT_BY_IDX; - h5vl_flags[64] = (int_f)H5VL_OBJECT_BY_ADDR; - h5vl_flags[65] = (int_f)H5VL_OBJECT_BY_REF; -/* * H5Z flags */ h5z_flags[0] = (int_f)H5Z_FILTER_ERROR; diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index 0d82f42..443be79 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -129,12 +129,6 @@ MODULE H5LIB ! INTEGER, PARAMETER :: H5T_FLAGS_LEN = 35 INTEGER, DIMENSION(1:H5T_FLAGS_LEN) :: H5T_flags - ! - ! H5VL flags declaration - ! - - INTEGER, PARAMETER :: H5VL_FLAGS_LEN = 66 - INTEGER, DIMENSION(1:H5VL_FLAGS_LEN) :: H5VL_flags ! ! H5Z flags declaration @@ -211,7 +205,6 @@ CONTAINS i_H5S_hid_flags, & i_H5S_hsize_flags, & i_H5T_flags, & - i_H5VL_flags, & i_H5Z_flags, & i_H5generic_flags, & i_H5generic_haddr_flags) & @@ -223,7 +216,7 @@ CONTAINS H5FD_HID_FLAGS_LEN, H5I_FLAGS_LEN, H5L_FLAGS_LEN, & H5O_FLAGS_LEN, H5P_FLAGS_LEN, H5P_FLAGS_INT_LEN, & H5R_FLAGS_LEN, H5S_FLAGS_LEN, H5S_HID_FLAGS_LEN, H5S_HSIZE_FLAGS_LEN, & - H5T_FLAGS_LEN, H5VL_FLAGS_LEN, H5Z_FLAGS_LEN, H5generic_FLAGS_LEN, H5generic_haddr_FLAGS_LEN + H5T_FLAGS_LEN, H5Z_FLAGS_LEN, H5generic_FLAGS_LEN, H5generic_haddr_FLAGS_LEN IMPLICIT NONE INTEGER , DIMENSION(1:H5D_FLAGS_LEN) :: i_H5D_flags INTEGER(SIZE_T) , DIMENSION(1:H5D_SIZE_FLAGS_LEN) :: i_H5D_size_flags @@ -243,7 +236,6 @@ CONTAINS INTEGER(HID_T) , DIMENSION(1:H5S_HID_FLAGS_LEN) :: i_H5S_hid_flags INTEGER(HSIZE_T), DIMENSION(1:H5S_HSIZE_FLAGS_LEN) :: i_H5S_hsize_flags INTEGER , DIMENSION(1:H5T_FLAGS_LEN) :: i_H5T_flags - INTEGER , DIMENSION(1:H5VL_FLAGS_LEN) :: i_H5VL_flags INTEGER , DIMENSION(1:H5Z_FLAGS_LEN) :: i_H5Z_flags INTEGER , DIMENSION(1:H5generic_FLAGS_LEN) :: i_H5generic_flags INTEGER(HADDR_T), DIMENSION(1:H5generic_haddr_FLAGS_LEN) :: i_H5generic_haddr_flags @@ -327,7 +319,6 @@ CONTAINS H5S_hid_flags, & H5S_hsize_flags, & H5T_flags, & - H5VL_flags, & H5Z_flags, & H5generic_flags,& H5generic_haddr_flags) @@ -610,75 +601,6 @@ CONTAINS H5T_DIR_ASCEND_F = H5T_flags(34) H5T_DIR_DESCEND_F = H5T_flags(35) ! - ! H5VL flags declaration - ! - H5VL_ATTR_GET_ACPL_F = H5VL_flags(1) - H5VL_ATTR_GET_INFO_F = H5VL_flags(2) - H5VL_ATTR_GET_NAME_F = H5VL_flags(3) - H5VL_ATTR_GET_SPACE_F = H5VL_flags(4) - H5VL_ATTR_GET_STORAGE_SIZE_F = H5VL_flags(5) - H5VL_ATTR_GET_TYPE_F = H5VL_flags(6) - H5VL_ATTR_DELETE_F = H5VL_flags(7) - H5VL_ATTR_EXISTS_F = H5VL_flags(8) - H5VL_ATTR_ITER_F = H5VL_flags(9) - H5VL_ATTR_RENAME_F = H5VL_flags(10) - H5VL_DATASET_GET_DAPL_F = H5VL_flags(11) - H5VL_DATASET_GET_DCPL_F = H5VL_flags(12) - H5VL_DATASET_GET_OFFSET_F = H5VL_flags(13) - H5VL_DATASET_GET_SPACE_F = H5VL_flags(14) - H5VL_DATASET_GET_SPACE_STATUS_F = H5VL_flags(15) - H5VL_DATASET_GET_STORAGE_SIZE_F = H5VL_flags(16) - H5VL_DATASET_GET_TYPE_F = H5VL_flags(17) - H5VL_DATASET_SET_EXTENT_F = H5VL_flags(18) - H5VL_DATASET_FLUSH_F = H5VL_flags(19) - H5VL_DATASET_REFRESH_F = H5VL_flags(20) - H5VL_DATATYPE_GET_BINARY_F = H5VL_flags(21) - H5VL_DATATYPE_GET_TCPL_F = H5VL_flags(22) - H5VL_DATATYPE_FLUSH_F = H5VL_flags(23) - H5VL_DATATYPE_REFRESH_F = H5VL_flags(24) - H5VL_FILE_GET_FAPL_F = H5VL_flags(25) - H5VL_FILE_GET_FCPL_F = H5VL_flags(26) - H5VL_FILE_GET_INTENT_F = H5VL_flags(27) - H5VL_FILE_GET_NAME_F = H5VL_flags(28) - H5VL_FILE_GET_OBJ_COUNT_F = H5VL_flags(29) - H5VL_FILE_GET_OBJ_IDS_F = H5VL_flags(30) - H5VL_FILE_FLUSH_F = H5VL_flags(31) - H5VL_FILE_REOPEN_F = H5VL_flags(32) - H5VL_FILE_MOUNT_F = H5VL_flags(33) - H5VL_FILE_UNMOUNT_F = H5VL_flags(34) - H5VL_FILE_IS_ACCESSIBLE_F = H5VL_flags(35) - H5VL_GROUP_GET_GCPL_F = H5VL_flags(36) - H5VL_GROUP_GET_INFO_F = H5VL_flags(37) - H5VL_GROUP_FLUSH_F = H5VL_flags(38) - H5VL_GROUP_REFRESH_F = H5VL_flags(39) - H5VL_LINK_CREATE_HARD_F = H5VL_flags(40) - H5VL_LINK_CREATE_SOFT_F = H5VL_flags(41) - H5VL_LINK_CREATE_UD_F = H5VL_flags(42) - H5VL_LINK_GET_INFO_F = H5VL_flags(43) - H5VL_LINK_GET_NAME_F = H5VL_flags(44) - H5VL_LINK_GET_VAL_F = H5VL_flags(45) - H5VL_LINK_DELETE_F = H5VL_flags(46) - H5VL_LINK_EXISTS_F = H5VL_flags(47) - H5VL_LINK_ITER_F = H5VL_flags(48) - H5VL_REF_GET_NAME_F = H5VL_flags(49) - H5VL_REF_GET_REGION_F = H5VL_flags(50) - H5VL_REF_GET_TYPE_F = H5VL_flags(51) - H5VL_ID_GET_NAME_F = H5VL_flags(52) - H5VL_OBJECT_CHANGE_REF_COUNT_F = H5VL_flags(53) - H5VL_OBJECT_EXISTS_F = H5VL_flags(54) - H5VL_OBJECT_VISIT_F = H5VL_flags(55) - H5VL_REF_CREATE_F = H5VL_flags(56) - H5VL_OBJECT_FLUSH_F = H5VL_flags(57) - H5VL_OBJECT_REFRESH_F = H5VL_flags(58) - H5VL_REQUEST_WAITANY_F = H5VL_flags(59) - H5VL_REQUEST_WAITSOME_F = H5VL_flags(60) - H5VL_REQUEST_WAITALL_F = H5VL_flags(61) - H5VL_OBJECT_BY_SELF_F = H5VL_flags(62) - H5VL_OBJECT_BY_NAME_F = H5VL_flags(63) - H5VL_OBJECT_BY_IDX_F = H5VL_flags(64) - H5VL_OBJECT_BY_ADDR_F = H5VL_flags(65) - H5VL_OBJECT_BY_REF_F = H5VL_flags(66) - ! ! H5Z flags ! H5Z_FILTER_ERROR_F = H5Z_flags(1) diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index 0a8a153..02e3bc3 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -740,147 +740,6 @@ MODULE H5GLOBAL INTEGER :: H5T_DIR_ASCEND_F INTEGER :: H5T_DIR_DESCEND_F ! - ! H5VL flags declaration - ! - !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_GET_ACPL_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_GET_INFO_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_GET_NAME_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_GET_SPACE_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_GET_STORAGE_SIZE_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_GET_TYPE_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_DELETE_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_EXISTS_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_ITER_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ATTR_RENAME_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_GET_DAPL_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_GET_DCPL_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_GET_OFFSET_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_GET_SPACE_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_GET_SPACE_STATUS_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_GET_STORAGE_SIZE_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_GET_TYPE_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_SET_EXTENT_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_FLUSH_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATASET_REFRESH_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATATYPE_GET_BINARY_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATATYPE_GET_TCPL_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATATYPE_FLUSH_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_DATATYPE_REFRESH_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_GET_FAPL_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_GET_FCPL_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_GET_INTENT_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_GET_NAME_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_GET_OBJ_COUNT_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_GET_OBJ_IDS_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_FLUSH_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_REOPEN_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_MOUNT_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_UNMOUNT_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_IS_ACCESSIBLE_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_FILE_CACHE_VOL_CONN_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_GROUP_GET_GCPL_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_GROUP_GET_INFO_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_GROUP_FLUSH_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_GROUP_REFRESH_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_CREATE_HARD_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_CREATE_SOFT_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_CREATE_UD_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_GET_INFO_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_GET_NAME_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_GET_VAL_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_DELETE_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_EXISTS_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_LINK_ITER_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_REF_GET_NAME_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_REF_GET_REGION_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_REF_GET_TYPE_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_ID_GET_NAME_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_CHANGE_REF_COUNT_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_EXISTS_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_VISIT_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_REF_CREATE_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_FLUSH_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_REFRESH_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_REQUEST_WAITANY_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_REQUEST_WAITSOME_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_REQUEST_WAITALL_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_BY_SELF_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_BY_NAME_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_BY_IDX_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_BY_ADDR_F - !DEC$ATTRIBUTES DLLEXPORT :: H5VL_OBJECT_BY_REF_F - !DEC$endif - - INTEGER :: H5VL_ATTR_GET_ACPL_F - INTEGER :: H5VL_ATTR_GET_INFO_F - INTEGER :: H5VL_ATTR_GET_NAME_F - INTEGER :: H5VL_ATTR_GET_SPACE_F - INTEGER :: H5VL_ATTR_GET_STORAGE_SIZE_F - INTEGER :: H5VL_ATTR_GET_TYPE_F - INTEGER :: H5VL_ATTR_DELETE_F - INTEGER :: H5VL_ATTR_EXISTS_F - INTEGER :: H5VL_ATTR_ITER_F - INTEGER :: H5VL_ATTR_RENAME_F - INTEGER :: H5VL_DATASET_GET_DAPL_F - INTEGER :: H5VL_DATASET_GET_DCPL_F - INTEGER :: H5VL_DATASET_GET_OFFSET_F - INTEGER :: H5VL_DATASET_GET_SPACE_F - INTEGER :: H5VL_DATASET_GET_SPACE_STATUS_F - INTEGER :: H5VL_DATASET_GET_STORAGE_SIZE_F - INTEGER :: H5VL_DATASET_GET_TYPE_F - INTEGER :: H5VL_DATASET_SET_EXTENT_F - INTEGER :: H5VL_DATASET_FLUSH_F - INTEGER :: H5VL_DATASET_REFRESH_F - INTEGER :: H5VL_DATATYPE_GET_BINARY_F - INTEGER :: H5VL_DATATYPE_GET_TCPL_F - INTEGER :: H5VL_DATATYPE_FLUSH_F - INTEGER :: H5VL_DATATYPE_REFRESH_F - INTEGER :: H5VL_FILE_GET_FAPL_F - INTEGER :: H5VL_FILE_GET_FCPL_F - INTEGER :: H5VL_FILE_GET_INTENT_F - INTEGER :: H5VL_FILE_GET_NAME_F - INTEGER :: H5VL_FILE_GET_OBJ_COUNT_F - INTEGER :: H5VL_FILE_GET_OBJ_IDS_F - INTEGER :: H5VL_FILE_FLUSH_F - INTEGER :: H5VL_FILE_REOPEN_F - INTEGER :: H5VL_FILE_MOUNT_F - INTEGER :: H5VL_FILE_UNMOUNT_F - INTEGER :: H5VL_FILE_IS_ACCESSIBLE_F - INTEGER :: H5VL_FILE_CACHE_VOL_CONN_F - INTEGER :: H5VL_GROUP_GET_GCPL_F - INTEGER :: H5VL_GROUP_GET_INFO_F - INTEGER :: H5VL_GROUP_FLUSH_F - INTEGER :: H5VL_GROUP_REFRESH_F - INTEGER :: H5VL_LINK_CREATE_HARD_F - INTEGER :: H5VL_LINK_CREATE_SOFT_F - INTEGER :: H5VL_LINK_CREATE_UD_F - INTEGER :: H5VL_LINK_GET_INFO_F - INTEGER :: H5VL_LINK_GET_NAME_F - INTEGER :: H5VL_LINK_GET_VAL_F - INTEGER :: H5VL_LINK_DELETE_F - INTEGER :: H5VL_LINK_EXISTS_F - INTEGER :: H5VL_LINK_ITER_F - INTEGER :: H5VL_REF_GET_NAME_F - INTEGER :: H5VL_REF_GET_REGION_F - INTEGER :: H5VL_REF_GET_TYPE_F - INTEGER :: H5VL_ID_GET_NAME_F - INTEGER :: H5VL_OBJECT_CHANGE_REF_COUNT_F - INTEGER :: H5VL_OBJECT_EXISTS_F - INTEGER :: H5VL_OBJECT_VISIT_F - INTEGER :: H5VL_REF_CREATE_F - INTEGER :: H5VL_OBJECT_FLUSH_F - INTEGER :: H5VL_OBJECT_REFRESH_F - INTEGER :: H5VL_REQUEST_WAITANY_F - INTEGER :: H5VL_REQUEST_WAITSOME_F - INTEGER :: H5VL_REQUEST_WAITALL_F - INTEGER :: H5VL_OBJECT_BY_SELF_F - INTEGER :: H5VL_OBJECT_BY_NAME_F - INTEGER :: H5VL_OBJECT_BY_IDX_F - INTEGER :: H5VL_OBJECT_BY_ADDR_F - INTEGER :: H5VL_OBJECT_BY_REF_F - - ! ! H5Z flags declaration ! !DEC$if defined(BUILD_HDF5_DLL) diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 7945857..b357715 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -526,7 +526,7 @@ H5_FCDLL int_f h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, int_f *h5g_flags, int_f *h5i_flags, int_f *h5l_flags, int_f *h5o_flags, hid_t_f *h5p_flags, int_f *h5p_flags_int, int_f *h5r_flags, int_f *h5s_flags, hid_t_f *h5s_hid_flags, hsize_t_f *h5s_hsize_flags, - int_f *h5t_flags, int_f *h5vl_flags, int_f *h5z_flags, int_f *h5_generic_flags, + int_f *h5t_flags, int_f *h5z_flags, int_f *h5_generic_flags, haddr_t_f *h5_haddr_generic_flags); H5_FCDLL int_f h5init1_flags_c(int_f *h5lib_flags); H5_FCDLL int_f h5get_libversion_c(int_f *majnum, int_f *minnum, int_f *relnum); diff --git a/fortran/test/null_vol_connector.c b/fortran/test/null_vol_connector.c deleted file mode 100644 index e30a659..0000000 --- a/fortran/test/null_vol_connector.c +++ /dev/null @@ -1,150 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* Purpose: A simple virtual object layer (VOL) connector with almost no - * functionality that is used for testing basic plugin handling - * (registration, etc.). - */ - -#include -#include "H5PLextern.h" - -#include "null_vol_connector.h" - -static void *H5VL_file_create(const char *name); -static herr_t H5VL_file_close(void *file); - -/* The VOL class struct */ -static const H5VL_class_t null_vol_g = { - 0, /* version */ - NULL_VOL_CONNECTOR_VALUE, /* value */ - NULL_VOL_CONNECTOR_NAME, /* name */ - 0, /* capability flags */ - NULL, /* initialize */ - NULL, /* terminate */ - (size_t)0, /* info size */ - NULL, /* info copy */ - NULL, /* info compare */ - NULL, /* info free */ - NULL, /* info to str */ - NULL, /* str to info */ - NULL, /* get_object */ - NULL, /* get_wrap_ctx */ - NULL, /* wrap_object */ - NULL, /* free_wrap_ctx */ - { /* attribute_cls */ - NULL, /* create */ - NULL, /* open */ - NULL, /* read */ - NULL, /* write */ - NULL, /* get */ - NULL, /* specific */ - NULL, /* optional */ - NULL /* close */ - }, - { /* dataset_cls */ - NULL, /* create */ - NULL, /* open */ - NULL, /* read */ - NULL, /* write */ - NULL, /* get */ - NULL, /* specific */ - NULL, /* optional */ - NULL /* close */ - }, - { /* datatype_cls */ - NULL, /* commit */ - NULL, /* open */ - NULL, /* get_size */ - NULL, /* specific */ - NULL, /* optional */ - NULL /* close */ - }, - { /* file_cls */ - H5VL_file_create, /* create */ - NULL, /* open */ - NULL, /* get */ - NULL, /* specific */ - NULL, /* optional */ - H5VL_file_close /* close */ - }, - { /* group_cls */ - NULL, /* create */ - NULL, /* open */ - NULL, /* get */ - NULL, /* specific */ - NULL, /* optional */ - NULL /* close */ - }, - { /* link_cls */ - NULL, /* create */ - NULL, /* copy */ - NULL, /* move */ - NULL, /* get */ - NULL, /* specific */ - NULL /* optional */ - }, - { /* object_cls */ - NULL, /* open */ - NULL, /* copy */ - NULL, /* get */ - NULL, /* specific */ - NULL /* optional */ - }, - { /* request_cls */ - NULL, /* wait */ - NULL, /* notify */ - NULL, /* cancel */ - NULL, /* specific */ - NULL, /* optional */ - NULL /* free */ - }, - NULL /* optional */ -}; - -typedef struct H5VL_t { - void *under_object; -} H5VL_t; - -/* These two functions are necessary to load this plugin using - * the HDF5 library. - */ - -H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_VOL;} -const void *H5PLget_plugin_info(void) {return &null_vol_g;} - -static void * -H5VL_file_create(const char *name) -{ - hid_t under_fapl; - H5VL_t *file; - - printf(" H5VL_file_create \n"); - - file = (H5VL_t *)calloc(1, sizeof(H5VL_t)); - - file->under_object = fopen(name, "w"); - - return (void *)file; -} - -static herr_t -H5VL_file_close(void *file) -{ - H5VL_t *f = (H5VL_t *)file; - - fclose(f->under_object); - free(f); - - return 1; -} - diff --git a/fortran/test/null_vol_connector.h b/fortran/test/null_vol_connector.h deleted file mode 100644 index 11c8826..0000000 --- a/fortran/test/null_vol_connector.h +++ /dev/null @@ -1,25 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* Purpose: A simple virtual object layer (VOL) connector with almost no - * functionality that is used for testing basic plugin handling - * (registration, etc.). - */ - -#ifndef _null_vol_connector_H -#define _null_vol_connector_H - -#define NULL_VOL_CONNECTOR_VALUE ((H5VL_class_value_t)160) -#define NULL_VOL_CONNECTOR_NAME "null_vol_connector" - -#endif /* _null_vol_connector_H */ - diff --git a/fortran/test/test_vol_connector.sh.in b/fortran/test/test_vol_connector.sh.in deleted file mode 100644 index ee27f3b..0000000 --- a/fortran/test/test_vol_connector.sh.in +++ /dev/null @@ -1,84 +0,0 @@ -#! /bin/sh -# -# Copyright by The HDF Group. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the COPYING file, which can be found at the root of the source code -# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. -# -# This shell script is for testing VOL connector plugins. -# -srcdir=@srcdir@ -TOP_BUILDDIR=@top_builddir@ - -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -nerrors=0 -verbose=yes -exit_code=$EXIT_SUCCESS - -TEST_NAME=vol_connector -TEST_BIN=`pwd`/$TEST_NAME -FROM_DIR=`pwd`/.libs -case $(uname) in - CYGWIN* ) - NULL_VOL_PLUGIN="$FROM_DIR/cygnull_vol_connector*" - ;; - *) - NULL_VOL_PLUGIN="$FROM_DIR/libnull_vol_connector*" - ;; -esac -TEMP_PLUGIN_DIR=null_vol_plugin_dir -CP="cp -p -r" # Use -p to preserve mode,ownership, timestamps -RM="rm -rf" - -# Print a line-line message left justified in a field of 70 characters -# beginning with the word "Testing". -# -TESTING() { - SPACES=" " - echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' -} - -# Main Body -# Create test directory if necessary. -test -d $TEMP_PLUGIN_DIR || mkdir -p $TEMP_PLUGIN_DIR -if [ $? != 0 ]; then - echo "Failed to create VOL connector plugin test directory ($TEMP_PLUGIN_DIR)" - exit $EXIT_FAILURE -fi - -# Copy plugin for the tests. -$CP $NULL_VOL_PLUGIN $TEMP_PLUGIN_DIR -if [ $? != 0 ]; then - echo "Failed to copy NULL VOL plugin ($NULL_VOL_PLUGIN) to test directory." - exit $EXIT_FAILURE -fi - -# setup plugin path -ENVCMD="env HDF5_PLUGIN_PATH=${TEMP_PLUGIN_DIR}" - -# Run the test -$ENVCMD $TEST_BIN -if [ $? != 0 ]; then - nerrors=`expr $nerrors + 1` -fi - -# print results -if test $nerrors -ne 0 ; then - echo "$nerrors errors encountered" - exit_code=$EXIT_FAILURE -else - echo "All VOL plugin tests passed." - exit_code=$EXIT_SUCCESS -fi - -# Clean up temporary files/directories and leave -#$RM $TEMP_PLUGIN_DIR - -exit $exit_code diff --git a/test/vol_plugin.c b/test/vol_plugin.c index 51b8e1e..236a67e 100644 --- a/test/vol_plugin.c +++ b/test/vol_plugin.c @@ -114,11 +114,6 @@ test_registration_by_name(void) if(FALSE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector was not registered"); - hid_t acc_tpl = H5Pcreate(H5P_FILE_ACCESS); - H5Pset_vol(acc_tpl, vol_id, NULL); - - H5Pclose(acc_tpl); - /* Unregister the connector */ if(H5VLunregister_connector(vol_id) < 0) TEST_ERROR; @@ -224,8 +219,6 @@ test_getters(void) htri_t is_registered = FAIL; hid_t vol_id = H5I_INVALID_HID; hid_t vol_id_out = H5I_INVALID_HID; - char name[64]; - size_t size = 0; TESTING("VOL getters"); @@ -245,12 +238,6 @@ test_getters(void) if(vol_id != vol_id_out) FAIL_PUTS_ERROR("VOL connector IDs don't match"); - if((vol_id_out = H5VLget_connector_name(vol_id_out, name, size)) < 0) - TEST_ERROR; - - printf("%s %ld \n", name, size); - - /* Unregister the connector */ if(H5VLunregister_connector(vol_id) < 0) TEST_ERROR; -- cgit v0.12 From 5e3dfa8bbec30f3c3f15e958323ec59b2432c6d3 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 16 May 2019 15:33:16 -0500 Subject: added test for vol_connector --- fortran/test/CMakeLists.txt | 61 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index b862fcd..719a9f3 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -569,4 +569,65 @@ if (BUILD_SHARED_LIBS) add_dependencies (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () +#-- Adding test for vol_connector +add_executable (vol_connector vol_connector.F90) +target_include_directories (vol_connector + PRIVATE + ${CMAKE_Fortran_MODULE_DIRECTORY}/static +) +target_compile_options(vol_connector + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> +) +target_link_libraries (vol_connector + PRIVATE + ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> +) +#set_property(TARGET vol_connector APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +#) +#set_property(TARGET vol_connector APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +#) +if(MSVC) + set_property(TARGET vol_connector PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") +endif() +set_target_properties (vol_connector PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static +) +add_dependencies (vol_connector ${HDF5_F90_TEST_LIB_TARGET}) + +if (BUILD_SHARED_LIBS) + add_executable (vol_connector-shared vol_connector.F90) + target_include_directories (vol_connector-shared + PRIVATE + ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ) + target_compile_options(vol_connector-shared + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (vol_connector-shared + PRIVATE + ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> + ) +# set_property(TARGET vol_connector-shared APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET vol_connector-shared APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET vol_connector-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") + endif() + set_target_properties (vol_connector-shared PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ) + add_dependencies (vol_connector-shared ${HDF5_F90_TEST_LIBSH_TARGET}) +endif () + include (CMakeTests.cmake) -- cgit v0.12 From 4673a34825fc246a62bbe9c7647792f2cb52921f Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 16 May 2019 16:22:05 -0500 Subject: added vol connector --- fortran/test/CMakeTests.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index 5fa10f4..306a3f8 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -130,6 +130,10 @@ set_tests_properties (FORTRAN_fflush1 PROPERTIES DEPENDS FORTRAN_testhdf5-clear- add_test (NAME FORTRAN_fflush2 COMMAND $) set_tests_properties (FORTRAN_fflush2 PROPERTIES DEPENDS FORTRAN_fflush1) +#-- Adding test for vol_connector +add_test (NAME FORTRAN_vol_connector COMMAND $) +set_tests_properties (FORTRAN_vol_connector PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects) + if (BUILD_SHARED_LIBS) add_test ( NAME FORTRAN_testhdf5-shared-clear-objects @@ -239,4 +243,8 @@ if (BUILD_SHARED_LIBS) #-- Adding test for fflush2 add_test (NAME FORTRAN_fflush2-shared COMMAND $) set_tests_properties (FORTRAN_fflush2-shared PROPERTIES DEPENDS FORTRAN_fflush1-shared) + + #-- Adding test for vol_connector + add_test (NAME FORTRAN_vol_connector-shared COMMAND $) + set_tests_properties (FORTRAN_vol_connector-shared PROPERTIES DEPENDS FORTRAN_vol_connector-shared) endif () -- cgit v0.12 From 2c7924311198802b688e2270041cfbd472b8e0b2 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Wed, 22 May 2019 14:09:17 -0500 Subject: added H5Pset_vol --- fortran/src/H5Pff.F90 | 85 +++++++++++++++++++++++++++++++++ fortran/src/hdf5_fortrandll.def.in | 2 + fortran/test/vol_connector.F90 | 97 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 184 insertions(+) diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index 31dfbdc..8ad3573 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -8114,5 +8114,90 @@ END SUBROUTINE h5pget_virtual_dsetname_f END SUBROUTINE h5pset_dset_no_attrs_hint_f +!****s* H5P/H5Pset_vol_f +! +! NAME +! H5Pset_vol_f +! +! PURPOSE +! Set the file VOL connector (VOL_ID) for a file access +! property list (PLIST_ID) +! INPUTS +! plist_id - access property list identifier. +! new_vol_id - VOL connector id. +! new_vol_info - VOL connector info. +! +! OUTPUTS +! hdferr - error code: +! 0 on success and -1 on failure +! +! AUTHOR +! M.S. Breitenfeld +! May 2019 +! +! Fortran Interface: + SUBROUTINE h5pset_vol_f(plist_id, new_vol_id, new_vol_info, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: plist_id + INTEGER(HID_T) , INTENT(IN) :: new_vol_id + TYPE(C_PTR) , INTENT(IN) :: new_vol_info + INTEGER , INTENT(OUT) :: hdferr +!***** + + INTERFACE + INTEGER FUNCTION h5pset_vol(plist_id, new_vol_id, new_vol_info) BIND(C, NAME='H5Pset_vol') + IMPORT :: HID_T, C_PTR + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: plist_id + INTEGER(HID_T), INTENT(IN), VALUE :: new_vol_id + TYPE(C_PTR) , INTENT(IN), VALUE :: new_vol_info + END FUNCTION h5pset_vol + END INTERFACE + + hdferr = INT(h5pset_vol(plist_id, new_vol_id, new_vol_info)) + + END SUBROUTINE h5pset_vol_f + +!****s* H5P/H5Pget_vol_id_f +! +! NAME +! H5Pget_vol_id_f +! +! PURPOSE +! Get the file VOL connector (VOL_ID) for a file access +! property list (PLIST_ID) +! INPUTS +! plist_id - access property list identifier. +! +! OUTPUTS +! vol_id - VOL connector id. +! hdferr - error code: +! 0 on success and -1 on failure +! +! AUTHOR +! M.S. Breitenfeld +! May 2019 +! +! Fortran Interface: + SUBROUTINE h5pget_vol_id_f(plist_id, vol_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: plist_id + INTEGER(HID_T) , INTENT(OUT) :: vol_id + INTEGER , INTENT(OUT) :: hdferr +!***** + + INTERFACE + INTEGER FUNCTION h5pget_vol_id(plist_id, vol_id) BIND(C, NAME='H5Pget_vol_id') + IMPORT :: HID_T, C_PTR + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: plist_id + INTEGER(HID_T), INTENT(OUT) :: vol_id + END FUNCTION h5pget_vol_id + END INTERFACE + + hdferr = INT(h5pget_vol_id(plist_id, vol_id)) + + END SUBROUTINE h5pget_vol_id_f + END MODULE H5P diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index e143b45..e31a582 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -335,6 +335,8 @@ H5P_mp_H5PGET_VIRTUAL_FILENAME_F H5P_mp_H5PGET_VIRTUAL_DSETNAME_F H5P_mp_H5PGET_DSET_NO_ATTRS_HINT_F H5P_mp_H5PSET_DSET_NO_ATTRS_HINT_F +H5P_mp_H5PSET_VOL_F +H5P_mp_H5PGET_VOL_ID_F ; Parallel @H5_NOPAREXP@H5P_mp_H5PSET_FAPL_MPIO_F @H5_NOPAREXP@H5P_mp_H5PGET_FAPL_MPIO_F diff --git a/fortran/test/vol_connector.F90 b/fortran/test/vol_connector.F90 index 7f19d79..c2ee6dd 100644 --- a/fortran/test/vol_connector.F90 +++ b/fortran/test/vol_connector.F90 @@ -138,6 +138,99 @@ CONTAINS END SUBROUTINE test_registration_by_value + + !------------------------------------------------------------------------- + ! Function: test_registration_by_name() + ! + ! Purpose: Tests if we can load, register, and close a VOL + ! connector by name. + ! + !------------------------------------------------------------------------- + ! + + SUBROUTINE test_registration_by_fapl(total_error) + + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + INTEGER :: error = 0 + + LOGICAL :: is_registered = .FALSE. + INTEGER(hid_t) :: vol_id = 0, vol_id_out = 1 + CHARACTER(LEN=64) :: name + INTEGER(SIZE_T) :: name_len + INTEGER(hid_t) :: file_id + INTEGER :: cmp = -1 + INTEGER(hid_t) :: fapl_id + TYPE(C_PTR) :: f_ptr + INTEGER(hid_t), TARGET :: under_fapl + + CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + + + ! The null VOL connector should not be registered at the start of the test + CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + + CALL H5VLregister_connector_by_name_f(NATIVE_VOL_CONNECTOR_NAME, vol_id, error) + CALL check("H5VLregister_connector_by_name_f",error,total_error) + + ! The connector should be registered now + CALL H5VLis_connector_registered_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error) + + ! Register the connector + CALL H5Pcreate_f(H5P_FILE_ACCESS_F, fapl_id, error) + CALL check("H5Pcreate_f",error,total_error) + + f_ptr = C_NULL_PTR + CALL H5Pset_vol_f(fapl_id, vol_id, f_ptr, error) + CALL check("H5Pset_vol_f",error,total_error) + + CALL H5Pget_vol_id_f(fapl_id, vol_id_out, error) + CALL check("H5Pget_vol_id_f",error,total_error) + CALL VERIFY("H5Pget_vol_id_f", vol_id_out, vol_id, total_error) +#if 0 + CALL H5Pcreate_f(H5P_FILE_ACCESS_F, under_fapl, error) + CALL check("H5Pcreate_f",error,total_error) + f_ptr = C_LOC(under_fapl) + CALL H5Pset_vol_f(fapl_id, vol_id, f_ptr, error) + CALL check("H5Pset_vol_f",error,total_error) + + CALL H5Pget_vol_id_f(fapl_id, vol_id_out, error) + CALL check("H5Pget_vol_id_f",error,total_error) + CALL VERIFY("H5Pget_vol_id_f", vol_id_out, vol_id, total_error) +#endif + CALL H5VLget_connector_id_f(NATIVE_VOL_CONNECTOR_NAME, vol_id_out, error) + CALL check("H5VLget_connector_id_f",error,total_error) + CALL VERIFY("H5VLget_connector_id_f", vol_id_out, vol_id, total_error) + + CALL H5Fcreate_f("voltest.h5",H5F_ACC_TRUNC_F, file_id, error, H5P_DEFAULT_F, fapl_id) + CALL check("H5F_create_f",error,total_error) + + CALL H5VLclose_f(vol_id_out, error) + CALL check("H5VLclose_f",error, total_error) + + CALL H5VLclose_f(vol_id, error) + CALL check("H5VLclose_f",error, total_error) + + ! Unregister the connector + CALL H5VLunregister_connector_f(vol_id, error) + CALL check("H5VLunregister_connector_f", error, total_error) + + CALL H5Fclose_f(file_id, error) + CALL check("H5Fclose_f",error,total_error) + + CALL H5Pclose_f(fapl_id, error) + CALL check("H5Pclose_f",error,total_error) + + END SUBROUTINE test_registration_by_fapl + + END MODULE VOL_TMOD @@ -172,6 +265,10 @@ PROGRAM vol_connector CALL test_registration_by_value(ret_total_error) CALL write_test_status(ret_total_error, ' Testing VOL registration by value', total_error) + ret_total_error = 0 + CALL test_registration_by_fapl(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing VOL registration by fapl', total_error) + WRITE(*, fmt = '(/18X,A)') '============================================' WRITE(*, fmt = '(19X, A)', advance='NO') ' FORTRAN VOL tests completed with ' WRITE(*, fmt = '(I4)', advance='NO') total_error -- cgit v0.12 From 0afb76228e16e63d72a7dbacdbb894d34fe29722 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 24 May 2019 13:39:45 -0700 Subject: Added code that disallows unregistering the native VOL connector. --- src/H5VL.c | 81 ++++++++++++++++++++++++++++++++++++-------------------------- test/vol.c | 24 ++++++++++++++----- 2 files changed, 65 insertions(+), 40 deletions(-) diff --git a/src/H5VL.c b/src/H5VL.c index fd45bf8..d4c0ff2 100644 --- a/src/H5VL.c +++ b/src/H5VL.c @@ -33,6 +33,8 @@ #include "H5Iprivate.h" /* IDs */ #include "H5VLpkg.h" /* Virtual Object Layer */ +/* VOL connectors */ +#include "H5VLnative.h" /* Native VOL connector */ /****************/ /* Local Macros */ @@ -321,6 +323,7 @@ done: herr_t H5VLunregister_connector(hid_t vol_id) { + hid_t native_id = H5I_INVALID_HID; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -328,13 +331,23 @@ H5VLunregister_connector(hid_t vol_id) /* Check arguments */ if(NULL == H5I_object_verify(vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* For the time being, we disallow unregistering the native VOL connector */ + if(H5I_INVALID_HID == (native_id = H5VL__get_connector_id(H5VL_NATIVE_NAME, FALSE))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to find the native VOL connector ID") + if(vol_id == native_id) + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "unregistering the native VOL connector is not allowed") /* The H5VL_class_t struct will be freed by this function */ - if (H5I_dec_app_ref(vol_id) < 0) + if(H5I_dec_app_ref(vol_id) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL connector") done: + if(native_id != H5I_INVALID_HID) + if(H5I_dec_ref(native_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement count on native_id") + FUNC_LEAVE_API(ret_value) } /* end H5VLunregister_connector() */ @@ -344,8 +357,8 @@ done: * * Purpose: Compares two connector classes (based on their value field) * - * Note: This routine is _only_ for HDF5 VOL connector authors! It is - * _not_ part of the public API for HDF5 application developers. + * Note: This routine is _only_ for HDF5 VOL connector authors! It is + * _not_ part of the public API for HDF5 application developers. * * Return: Success: Non-negative, *cmp set to a value like strcmp * @@ -381,11 +394,11 @@ done: * Function: H5VLwrap_register * * Purpose: Wrap an internal object with a "wrap context" and register an - * hid_t for the resulting object. + * hid_t for the resulting object. * - * Note: This routine is mainly targeted toward wrapping objects for - * iteration routine callbacks (i.e. the callbacks from H5Aiterate*, - * H5Literate* / H5Lvisit*, and H5Ovisit* ). + * Note: This routine is mainly targeted toward wrapping objects for + * iteration routine callbacks (i.e. the callbacks from H5Aiterate*, + * H5Literate* / H5Lvisit*, and H5Ovisit* ). * * Return: Success: Non-negative hid_t for the object. * Failure: Negative (H5I_INVALID_HID) @@ -420,10 +433,10 @@ done: * Function: H5VLobject * * Purpose: Retrieve the object pointer associated with an hid_t for a. - * VOL object. + * VOL object. * - * Note: This routine is mainly targeted toward unwrapping objects for - * testing. + * Note: This routine is mainly targeted toward unwrapping objects for + * testing. * * Return: Success: Object pointer * Failure: NULL @@ -451,16 +464,16 @@ done: * Function: H5VLretrieve_lib_state * * Purpose: Retrieves a copy of the internal state of the HDF5 library, - * so that it can be restored later. + * so that it can be restored later. * - * Note: This routine is _only_ for HDF5 VOL connector authors! It is - * _not_ part of the public API for HDF5 application developers. + * Note: This routine is _only_ for HDF5 VOL connector authors! It is + * _not_ part of the public API for HDF5 application developers. * * Return: Success: Non-negative, *state set * Failure: Negative, *state unset * - * Programmer: Quincey Koziol - * Thursday, January 10, 2019 + * Programmer: Quincey Koziol + * Thursday, January 10, 2019 * *--------------------------------------------------------------------------- */ @@ -491,14 +504,14 @@ done: * * Purpose: Restores the internal state of the HDF5 library. * - * Note: This routine is _only_ for HDF5 VOL connector authors! It is - * _not_ part of the public API for HDF5 application developers. + * Note: This routine is _only_ for HDF5 VOL connector authors! It is + * _not_ part of the public API for HDF5 application developers. * * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, January 10, 2019 + * Programmer: Quincey Koziol + * Thursday, January 10, 2019 * *--------------------------------------------------------------------------- */ @@ -528,20 +541,20 @@ done: * Function: H5VLreset_lib_state * * Purpose: Resets the internal state of the HDF5 library, undoing the - * affects of H5VLrestore_lib_state. + * affects of H5VLrestore_lib_state. * - * Note: This routine is _only_ for HDF5 VOL connector authors! It is - * _not_ part of the public API for HDF5 application developers. + * Note: This routine is _only_ for HDF5 VOL connector authors! It is + * _not_ part of the public API for HDF5 application developers. * - * Note: This routine must be called as a "pair" with - * H5VLrestore_lib_state. It can be called before / after / - * independently of H5VLfree_lib_state. + * Note: This routine must be called as a "pair" with + * H5VLrestore_lib_state. It can be called before / after / + * independently of H5VLfree_lib_state. * * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Saturday, February 23, 2019 + * Programmer: Quincey Koziol + * Saturday, February 23, 2019 * *--------------------------------------------------------------------------- */ @@ -568,17 +581,17 @@ done: * * Purpose: Free a retrieved library state. * - * Note: This routine is _only_ for HDF5 VOL connector authors! It is - * _not_ part of the public API for HDF5 application developers. + * Note: This routine is _only_ for HDF5 VOL connector authors! It is + * _not_ part of the public API for HDF5 application developers. * - * Note: This routine must be called as a "pair" with - * H5VLretrieve_lib_state. + * Note: This routine must be called as a "pair" with + * H5VLretrieve_lib_state. * * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, January 10, 2019 + * Programmer: Quincey Koziol + * Thursday, January 10, 2019 * *--------------------------------------------------------------------------- */ diff --git a/test/vol.c b/test/vol.c index 3f6afaa..e5b8243 100644 --- a/test/vol.c +++ b/test/vol.c @@ -148,8 +148,11 @@ static const H5VL_class_t fake_vol_g = { static herr_t test_vol_registration(void) { - htri_t is_registered; - hid_t vol_id = -1, vol_id2 = -1; + hid_t native_id = H5I_INVALID_HID; + herr_t ret = SUCCEED; + htri_t is_registered = FAIL; + hid_t vol_id = H5I_INVALID_HID; + hid_t vol_id2 = H5I_INVALID_HID; TESTING("VOL registration"); @@ -157,7 +160,7 @@ test_vol_registration(void) if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) FAIL_STACK_ERROR; if (is_registered > 0) - FAIL_PUTS_ERROR("native VOL connector is inappropriately registered"); + FAIL_PUTS_ERROR("VOL connector is inappropriately registered"); /* Load a VOL interface */ if ((vol_id = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0) @@ -167,7 +170,7 @@ test_vol_registration(void) if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) FAIL_STACK_ERROR; if (0 == is_registered) - FAIL_PUTS_ERROR("native VOL connector is un-registered"); + FAIL_PUTS_ERROR("VOL connector is un-registered"); /* Re-register a VOL connector */ if ((vol_id2 = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0) @@ -177,7 +180,7 @@ test_vol_registration(void) if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) FAIL_STACK_ERROR; if (0 == is_registered) - FAIL_PUTS_ERROR("native VOL connector is un-registered"); + FAIL_PUTS_ERROR("VOL connector is un-registered"); /* Unregister the second test/fake VOL ID */ if (H5VLunregister_connector(vol_id2) < 0) @@ -187,12 +190,21 @@ test_vol_registration(void) if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) FAIL_STACK_ERROR; if (0 == is_registered) - FAIL_PUTS_ERROR("native VOL connector is un-registered"); + FAIL_PUTS_ERROR("VOL connector is un-registered"); /* Unregister the original test/fake VOL ID */ if (H5VLunregister_connector(vol_id) < 0) FAIL_STACK_ERROR; + /* Try to unregister the native VOL connector (should fail) */ + if (H5I_INVALID_HID == (native_id = H5VLget_connector_id(H5VL_NATIVE_NAME))) + FAIL_STACK_ERROR; + H5E_BEGIN_TRY { + ret = H5VLunregister_connector(native_id); + } H5E_END_TRY; + if (FAIL != ret) + FAIL_PUTS_ERROR("should not be able to unregister the native VOL connector"); + PASSED(); return SUCCEED; -- cgit v0.12 From 748da4d3e2757ad7b5e7fddcd3cfd2132e90a696 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 30 May 2019 15:56:02 -0500 Subject: Java formatting of args --- java/src/jni/h5Imp.c | 2 +- java/src/jni/h5dImp.c | 2 +- java/src/jni/h5eImp.c | 68 +++++++++++++++++++++++++-------------------------- java/src/jni/h5fImp.c | 48 ++++++++++++++++++------------------ java/src/jni/h5gImp.c | 20 +++++++-------- java/src/jni/h5lImp.c | 2 +- java/src/jni/h5rImp.c | 2 +- java/src/jni/h5sImp.c | 14 +++++------ java/src/jni/h5util.c | 6 ++--- 9 files changed, 82 insertions(+), 82 deletions(-) diff --git a/java/src/jni/h5Imp.c b/java/src/jni/h5Imp.c index 99c91fd..f0dd691 100644 --- a/java/src/jni/h5Imp.c +++ b/java/src/jni/h5Imp.c @@ -127,7 +127,7 @@ done: if (libversionArray) UNPIN_INT_ARRAY(ENVONLY, libversion, libversionArray, (status < 0) ? JNI_ABORT : 0); - return (jint)status; + return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5get_1libversion */ /* diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index d46773a..5500847 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -1838,7 +1838,7 @@ Java_hdf_hdf5lib_H5_H5Dfill { jboolean isCopy1; jboolean isCopy2; - herr_t status; + herr_t status = FAIL; jbyte *fillP = NULL; jbyte *buffP = NULL; diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c index 4ab00df..937323e 100644 --- a/java/src/jni/h5eImp.c +++ b/java/src/jni/h5eImp.c @@ -62,11 +62,11 @@ static herr_t H5E_walk_cb(int nindx, const H5E_error2_t *info, void *cb_data); */ JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2 - (JNIEnv *env, jclass cls, jlong stk_id) + (JNIEnv *env, jclass clss, jlong stk_id) { unsigned int is_stack = 0; - UNUSED(cls); + UNUSED(clss); if (stk_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eauto_is_v2: invalid stack ID"); @@ -85,14 +85,14 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Eregister_1class - (JNIEnv *env, jclass cls, jstring cls_name, jstring lib_name, jstring version) + (JNIEnv *env, jclass clss, jstring cls_name, jstring lib_name, jstring version) { const char* the_cls_name = NULL; const char* the_lib_name = NULL; const char* the_version = NULL; hid_t ret_val = H5I_INVALID_HID; - UNUSED(cls); + UNUSED(clss); if (NULL == cls_name) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Eregister_class: class name is NULL"); @@ -126,9 +126,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eunregister_1class - (JNIEnv *env, jclass cls, jlong cls_id) + (JNIEnv *env, jclass clss, jlong cls_id) { - UNUSED(cls); + UNUSED(clss); if (cls_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eunregister_class: invalid error class ID"); @@ -147,9 +147,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eclose_1msg - (JNIEnv *env, jclass cls, jlong err_id) + (JNIEnv *env, jclass clss, jlong err_id) { - UNUSED(cls); + UNUSED(clss); if (err_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eclose_msg: invalid error message ID"); @@ -168,13 +168,13 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Ecreate_1msg - (JNIEnv *env, jclass cls, jlong err_id, jint msg_type, jstring err_msg) + (JNIEnv *env, jclass clss, jlong err_id, jint msg_type, jstring err_msg) { H5E_type_t error_msg_type = (H5E_type_t)msg_type; const char *the_err_msg = NULL; hid_t ret_val = H5I_INVALID_HID; - UNUSED(cls); + UNUSED(clss); if (err_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Ecreate_msg: invalid error class ID"); @@ -200,11 +200,11 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Ecreate_1stack - (JNIEnv *env, jclass cls) + (JNIEnv *env, jclass clss) { hid_t ret_val = H5I_INVALID_HID; - UNUSED(cls); + UNUSED(clss); if ((ret_val = H5Ecreate_stack()) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -220,11 +220,11 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Eget_1current_1stack - (JNIEnv *env, jclass cls) + (JNIEnv *env, jclass clss) { hid_t ret_val = H5I_INVALID_HID; - UNUSED(cls); + UNUSED(clss); if ((ret_val = H5Eget_current_stack()) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -240,9 +240,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eclose_1stack - (JNIEnv *env, jclass cls, jlong stk_id) + (JNIEnv *env, jclass clss, jlong stk_id) { - UNUSED(cls); + UNUSED(clss); if (stk_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eclose_stack: invalid error stack ID"); @@ -261,11 +261,11 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eprint2 - (JNIEnv *env, jclass cls, jlong stk_id, jobject stream_obj) + (JNIEnv *env, jclass clss, jlong stk_id, jobject stream_obj) { herr_t ret_val = FAIL; - UNUSED(cls); + UNUSED(clss); if (stk_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eprint2: invalid error stack ID"); @@ -290,13 +290,13 @@ done: */ JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Eget_1class_1name - (JNIEnv *env, jclass cls, jlong cls_id) + (JNIEnv *env, jclass clss, jlong cls_id) { jstring str = NULL; ssize_t buf_size; char *namePtr = NULL; - UNUSED(cls); + UNUSED(clss); if (cls_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_class_name: invalid error class ID"); @@ -332,9 +332,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eset_1current_1stack - (JNIEnv *env, jclass cls, jlong stk_id) + (JNIEnv *env, jclass clss, jlong stk_id) { - UNUSED(cls); + UNUSED(clss); if (stk_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eset_current_stack: invalid error stack ID"); @@ -353,9 +353,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Epop - (JNIEnv *env, jclass cls, jlong stk_id, jlong count) + (JNIEnv *env, jclass clss, jlong stk_id, jlong count) { - UNUSED(cls); + UNUSED(clss); if (stk_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epop: invalid error stack ID"); @@ -374,7 +374,7 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Epush2 - (JNIEnv *env, jclass cls, jlong stk_id, jstring filename, jstring funcname, + (JNIEnv *env, jclass clss, jlong stk_id, jstring filename, jstring funcname, jint linenumber, jlong class_id, jlong major_id, jlong minor_id, jstring err_desc) { const char *fName = NULL; @@ -382,7 +382,7 @@ Java_hdf_hdf5lib_H5_H5Epush2 const char *errMsg = NULL; herr_t ret_val = FAIL; - UNUSED(cls); + UNUSED(clss); if (stk_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush2: invalid error stack ID"); @@ -423,9 +423,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eclear2 - (JNIEnv *env, jclass cls, jlong stk_id) + (JNIEnv *env, jclass clss, jlong stk_id) { - UNUSED(cls); + UNUSED(clss); if (stk_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eclear2: invalid error stack ID"); @@ -444,7 +444,7 @@ done: */ JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Eget_1msg - (JNIEnv *env, jclass cls, jlong msg_id, jintArray error_msg_type_list) + (JNIEnv *env, jclass clss, jlong msg_id, jintArray error_msg_type_list) { H5E_type_t error_msg_type; jstring str = NULL; @@ -452,7 +452,7 @@ Java_hdf_hdf5lib_H5_H5Eget_1msg jint *theArray = NULL; char *namePtr = NULL; - UNUSED(cls); + UNUSED(clss); if (msg_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_msg: invalid error message ID"); @@ -496,11 +496,11 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Eget_1num - (JNIEnv *env, jclass cls, jlong stk_id) + (JNIEnv *env, jclass clss, jlong stk_id) { ssize_t ret_val = -1; - UNUSED(cls); + UNUSED(clss); if (stk_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_num: invalid error stack ID"); @@ -587,11 +587,11 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ewalk2 - (JNIEnv *env, jclass cls, jlong stk_id, jlong direction, jobject callback_op, jobject op_data) + (JNIEnv *env, jclass clss, jlong stk_id, jlong direction, jobject callback_op, jobject op_data) { cb_wrapper wrapper = { callback_op, op_data }; - UNUSED(cls); + UNUSED(clss); ENVPTR->GetJavaVM(ENVONLY, &jvm); CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c index 80567d9..4fd6807 100644 --- a/java/src/jni/h5fImp.c +++ b/java/src/jni/h5fImp.c @@ -118,13 +118,13 @@ done: */ JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Fget_1name - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass clss, jlong file_id) { jstring str = NULL; ssize_t buf_size; char *namePtr = NULL; - UNUSED(cls); + UNUSED(clss); /* Get the length of the name */ if ((buf_size = H5Fget_name((hid_t)file_id, NULL, 0)) < 0) @@ -378,11 +378,11 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1freespace - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass clss, jlong file_id) { hssize_t ret_val = -1; - UNUSED(cls); + UNUSED(clss); if ((ret_val = H5Fget_freespace((hid_t)file_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -418,7 +418,7 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids - (JNIEnv *env, jclass cls, jlong file_id, jint types, jlong maxObjs, + (JNIEnv *env, jclass clss, jlong file_id, jint types, jlong maxObjs, jlongArray obj_id_list) { jboolean isCopy; @@ -428,7 +428,7 @@ Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids jlong *obj_id_listP = NULL; hid_t *id_list = NULL; - UNUSED(cls); + UNUSED(clss); if (NULL == obj_id_list) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fget_obj_ids: obj_id_list is NULL"); @@ -466,11 +466,11 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1obj_1count - (JNIEnv *env, jclass cls, jlong file_id, jint types) + (JNIEnv *env, jclass clss, jlong file_id, jint types) { ssize_t ret_val = -1; - UNUSED(cls); + UNUSED(clss); if ((ret_val = H5Fget_obj_count((hid_t)file_id, (unsigned int)types)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -506,11 +506,11 @@ done: */ JNIEXPORT jdouble JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass clss, jlong file_id) { double rate = 0.0; - UNUSED(cls); + UNUSED(clss); if (H5Fget_mdc_hit_rate((hid_t)file_id, &rate) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -526,7 +526,7 @@ done: */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size - (JNIEnv *env, jclass cls, jlong file_id, jlongArray metadata_cache) + (JNIEnv *env, jclass clss, jlong file_id, jlongArray metadata_cache) { jboolean isCopy; size_t max_size = 0, min_clean_size = 0, cur_size = 0; @@ -534,7 +534,7 @@ Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size jsize size = 0; int cur_num_entries = -1; - UNUSED(cls); + UNUSED(clss); if (NULL == metadata_cache) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fget_mdc_size: metadata cache array is NULL"); @@ -612,9 +612,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass clss, jlong file_id) { - UNUSED(cls); + UNUSED(clss); if (H5Freset_mdc_hit_rate_stats((hid_t)file_id) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -630,9 +630,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass clss, jlong file_id) { - UNUSED(cls); + UNUSED(clss); if (H5Fclear_elink_file_cache((hid_t)file_id) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -648,9 +648,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass clss, jlong file_id) { - UNUSED(cls); + UNUSED(clss); if (H5Fstart_swmr_write((hid_t)file_id) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -666,9 +666,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass clss, jlong file_id) { - UNUSED(cls); + UNUSED(clss); if (H5Fstart_mdc_logging((hid_t)file_id) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -684,9 +684,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass clss, jlong file_id) { - UNUSED(cls); + UNUSED(clss); if (H5Fstop_mdc_logging((hid_t)file_id) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -702,7 +702,7 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status - (JNIEnv *env, jclass cls, jlong file_id, jbooleanArray mdc_logging_status) + (JNIEnv *env, jclass clss, jlong file_id, jbooleanArray mdc_logging_status) { jboolean *mdc_logging_status_ptr = NULL; jboolean isCopy; @@ -710,7 +710,7 @@ Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status hbool_t is_currently_logging; jsize size; - UNUSED(cls); + UNUSED(clss); if (NULL == mdc_logging_status) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fget_mdc_logging_status: mdc_logging_status is NULL"); diff --git a/java/src/jni/h5gImp.c b/java/src/jni/h5gImp.c index b579f31..79b1b65 100644 --- a/java/src/jni/h5gImp.c +++ b/java/src/jni/h5gImp.c @@ -148,11 +148,11 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Gcreate_1anon - (JNIEnv *env, jclass cls, jlong loc_id, jlong gcpl_id, jlong gapl_id) + (JNIEnv *env, jclass clss, jlong loc_id, jlong gcpl_id, jlong gapl_id) { hid_t group_id = H5I_INVALID_HID; - UNUSED(cls); + UNUSED(clss); if ((group_id = H5Gcreate_anon((hid_t)loc_id, (hid_t)gcpl_id, (hid_t)gapl_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -198,11 +198,11 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Gget_1create_1plist - (JNIEnv *env, jclass cls, jlong loc_id) + (JNIEnv *env, jclass clss, jlong loc_id) { hid_t plist_id = H5I_INVALID_HID; - UNUSED(cls); + UNUSED(clss); if ((plist_id = H5Gget_create_plist((hid_t)loc_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -218,12 +218,12 @@ done: */ JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Gget_1info - (JNIEnv *env, jclass cls, jlong loc_id) + (JNIEnv *env, jclass clss, jlong loc_id) { H5G_info_t group_info; jobject obj = NULL; - UNUSED(cls); + UNUSED(clss); if (H5Gget_info((hid_t)loc_id, &group_info) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -242,14 +242,14 @@ done: */ JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name - (JNIEnv *env, jclass cls, jlong loc_id, jstring name, jlong lapl_id) + (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong lapl_id) { H5G_info_t group_info; const char *grpName = NULL; jobject obj = NULL; herr_t ret_val = FAIL; - UNUSED(cls); + UNUSED(clss); if (NULL == name) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_info_by_name: group name is NULL"); @@ -278,7 +278,7 @@ done: */ JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx - (JNIEnv *env, jclass cls, jlong loc_id, jstring name, jint index_type, + (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint index_type, jint order, jlong n, jlong lapl_id) { H5_iter_order_t corder = (H5_iter_order_t)order; @@ -288,7 +288,7 @@ Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx jobject obj = NULL; herr_t ret_val = FAIL; - UNUSED(cls); + UNUSED(clss); if (NULL == name) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_info_by_idx: group name is NULL"); diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c index af6c8ba..7413023 100644 --- a/java/src/jni/h5lImp.c +++ b/java/src/jni/h5lImp.c @@ -628,7 +628,7 @@ H5L_iterate_cb jclass cls; jvalue args[5]; void *op_data = (void *)wrapper->op_data; - jint status; + jint status = -1; if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) { CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE); diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c index 83e2216..1a77fd3 100644 --- a/java/src/jni/h5rImp.c +++ b/java/src/jni/h5rImp.c @@ -211,7 +211,7 @@ Java_hdf_hdf5lib_H5_H5Rget_1obj_1type2 jboolean isCopy, isCopy2; jbyte *refBuf = NULL; jint *ref_objP = NULL; - jint status; + jint status = -1; int retVal = -1; UNUSED(clss); diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c index d8110a1..eedd42e 100644 --- a/java/src/jni/h5sImp.c +++ b/java/src/jni/h5sImp.c @@ -66,7 +66,7 @@ Java_hdf_hdf5lib_H5__1H5Screate_1simple hsize_t *lp = NULL; jlong *dimsP = NULL, *maxdimsP = NULL; jlong *jlp = NULL; - jsize drank, mrank; + jsize drank = 0, mrank = 0; int i; hid_t retVal = H5I_INVALID_HID; @@ -1129,14 +1129,14 @@ done: */ JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_H5_H5Sencode - (JNIEnv *env, jclass cls, jlong obj_id) + (JNIEnv *env, jclass clss, jlong obj_id) { unsigned char *bufPtr = NULL; size_t buf_size = 0; herr_t status = FAIL; jbyteArray returnedArray = NULL; - UNUSED(cls); + UNUSED(clss); if (obj_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sencode: invalid object ID"); @@ -1173,13 +1173,13 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Sdecode - (JNIEnv *env, jclass cls, jbyteArray buf) + (JNIEnv *env, jclass clss, jbyteArray buf) { jboolean isCopy; jbyte *bufP = NULL; hid_t sid = H5I_INVALID_HID; - UNUSED(cls); + UNUSED(clss); if (NULL == buf) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sdecode: buffer is NULL"); @@ -1203,11 +1203,11 @@ done: */ JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab - (JNIEnv *env, jclass cls, jlong obj_id) + (JNIEnv *env, jclass clss, jlong obj_id) { htri_t bval = JNI_FALSE; - UNUSED(cls); + UNUSED(clss); if ((bval = H5Sis_regular_hyperslab((hid_t)obj_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 10ca3f2..af83caa 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -3453,7 +3453,7 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5export_1dataset - (JNIEnv *env, jclass cls, jstring file_export_name, jstring file_name, jstring object_path, jint binary_order) + (JNIEnv *env, jclass clss, jstring file_export_name, jstring file_name, jstring object_path, jint binary_order) { const char *file_export = NULL; const char *object_name = NULL; @@ -3462,9 +3462,9 @@ Java_hdf_hdf5lib_H5_H5export_1dataset herr_t ret_val = FAIL; hid_t file_id = H5I_INVALID_HID; hid_t dataset_id = H5I_INVALID_HID; - FILE *stream; + FILE *stream = NULL; - UNUSED(cls); + UNUSED(clss); if (NULL == file_export_name) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: file_export_name is NULL"); -- cgit v0.12 From 94d3aa716659c3c11d05ce5094948927285bfd2a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 31 May 2019 12:33:50 -0500 Subject: Update macro --- config/cmake/jrunTest.cmake | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index 95c7583..fc49275 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -51,6 +51,8 @@ message (STATUS "COMMAND: ${TEST_TESTER} -Xmx1024M -Dorg.slf4j.simpleLogger.defa if (WIN32 AND NOT MINGW) set (ENV{PATH} "$ENV{PATH}\\;${TEST_LIBRARY_DIRECTORY}") +else () + set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") endif () # run the test program, capture the stdout/stderr and the result var @@ -64,6 +66,7 @@ execute_process ( RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_OUTPUT} ERROR_FILE ${TEST_OUTPUT}.err + OUTPUT_VARIABLE TEST_OUT ERROR_VARIABLE TEST_ERROR ) @@ -126,11 +129,22 @@ if (NOT TEST_SKIP_COMPARE) file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") endif () - # now compare the output with the reference - execute_process ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} - RESULT_VARIABLE TEST_RESULT - ) + if (NOT TEST_SORT_COMPARE) + # now compare the output with the reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} + RESULT_VARIABLE TEST_RESULT + ) + else () + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2) + list (SORT v1) + list (SORT v2) + if (NOT v1 STREQUAL v2) + set(TEST_RESULT 1) + endif () + endif () + if (TEST_RESULT) set (TEST_RESULT 0) file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) -- cgit v0.12 From 35a8a549f6714533b100ca1512979165c0a0f359 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Fri, 31 May 2019 19:26:56 -0500 Subject: Refactor H5S__hyper_project_intersection to operate directly on span trees, improving performance and removing the conditionn that the extents be equal. --- release_docs/RELEASE.txt | 8 + src/H5Dvirtual.c | 7 + src/H5Shyper.c | 1051 +++++++++++++++++++++++++++++++--------------- src/H5Sselect.c | 11 +- test/vds.c | 720 ++++++++++++++++++++++++++++++- 5 files changed, 1457 insertions(+), 340 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 6d1c8b2..649ae24 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -130,6 +130,14 @@ New Features Library: -------- + - Improved the performance of virtual dataset I/O + + Refactored the internal dataspace routines used by the virtual dataset + code to improve performance, especially when one of the selections + involved is very long and non-contiguous. + + (NAF - 2019/05/31, HDFFV-10693) + - Allow pre-generated H5Tinit.c and H5make_libsettings.c to be used. Rather than always running H5detect and generating H5Tinit.c and diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index e3e0aa5..53640e7 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -35,6 +35,13 @@ * until the virtual dataset is closed. */ +/* + * Note: H5S_select_project_intersection has been updated to no longer require + * that the source and source intersect spaces have the same extent. This file + * should therefore be updated to remove code that ensures this condition, which + * should improve both maintainability and performance. + */ + /****************/ /* Module Setup */ /****************/ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index c2cdf2b..00cb7e9 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -44,25 +44,13 @@ /* Macro for checking if two ranges overlap one another */ /* - * Three possible conditions for overlapping: - * 1. The lower bound of range #1 is between the lower and - * higher bounds of range #2. In other words, the low - * part of range #1 will at least overlap with range #2. - * 2. The higher bound of range #1 is between the lower and - * higher bounds of range #2. In other words, the upper - * part of range #1 will at least overlap with range #2. - * 3. Range #1 includes range #2, i.e. the lower bound - * is smaller than that of range #2 and the higher bound - * is larger than that of range #2. + * Check for the inverse of whether the ranges are disjoint. If they are + * disjoint, then the low bound of one of the ranges must be greater than the + * high bound of the other. */ /* (Assumes that low & high bounds are _inclusive_) */ #define H5S_RANGE_OVERLAP(L1, H1, L2, H2) \ - /* condition 1 */ \ - (((L1) >= (L2) && (L1) <= (H2)) || \ - /* condition 2 */ \ - ((H1) >= (L2) && (H1) <= (H2)) || \ - /* condition 3 */ \ - ((L1) <= (L2) && (H1) >= (H2))) + !((L1) > (H2) || (L2) > (H1)) /* Flags for which hyperslab fragments to compute */ #define H5S_HYPER_COMPUTE_B_NOT_A 0x01 @@ -84,6 +72,18 @@ (curr_span) = saved_next_span; \ } while(0) +/* Macro to add "skipped" elements to projection during the execution of + * H5S__hyper_project_intersect() */ +#define H5S_HYPER_PROJ_INT_ADD_SKIP(UDATA, ADD, ERR) \ + do { \ + /* If there are any elements to add, we must add them \ + * to the projection first before adding skip */ \ + if((UDATA)->nelem > 0) \ + if(H5S__hyper_proj_int_build_proj(UDATA) < 0) \ + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, ERR, "can't add elements to projected selection") \ + (UDATA)->skip += (ADD); \ + } while(0) /* end H5S_HYPER_PROJ_INT_ADD_SKIP() */ + /******************/ /* Local Typedefs */ @@ -93,6 +93,28 @@ /* (Makes it easier to understand the alloc / free calls) */ typedef hsize_t hbounds_t; +/* Struct for holding persistent information during iteration for + * H5S__hyper_project_intersect() */ +typedef struct { + const H5S_hyper_span_t *ds_span[H5S_MAX_RANK]; /* Array of the current spans in the destination space in each dimension */ + hsize_t ds_low[H5S_MAX_RANK]; /* Array of current low bounds (of iteration) for each element in ds_span */ + H5S_hyper_span_info_t *ps_span_info[H5S_MAX_RANK]; /* Array of span info structs for projected space during iteration */ + uint32_t ps_clean_bitmap; /* Bitmap of whether the nth rank has a clean projected space since the last time it was set to 1 */ + unsigned ss_rank; /* Rank of source space */ + unsigned ds_rank; /* Rank of destination space */ + unsigned depth; /* Current depth of iterator in destination space */ + hsize_t skip; /* Number of elements to skip in projected space */ + hsize_t nelem; /* Number of elements to add to projected space (after skip) */ + uint64_t op_gen; /* Operation generation for counting elements */ +} H5S_hyper_project_intersect_ud_t; + +/* Assert that H5S_MAX_RANK is <= 32 so our trick with using a 32 bit bitmap + * (ps_clean_bitmap) works. If H5S_MAX_RANK increases either increase the size + * of ps_clean_bitmap or change the algorithm to use an array. */ +#if H5S_MAX_RANK > 32 +#error H5S_MAX_RANK too small for ps_clean_bitmap field in H5S_hyper_project_intersect_ud_t struct +#endif + /********************/ /* Local Prototypes */ @@ -119,6 +141,8 @@ static herr_t H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, unsigned ndims, H5S_hyper_span_info_t **a_not_b, H5S_hyper_span_info_t **a_and_b, H5S_hyper_span_info_t **b_not_a); static herr_t H5S__hyper_merge_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans); +static hsize_t H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, + uint64_t op_gen); static hsize_t H5S__hyper_spans_nelem(H5S_hyper_span_info_t *spans); static herr_t H5S__hyper_add_disjoint_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans); static H5S_hyper_span_info_t *H5S__hyper_make_spans(unsigned rank, @@ -147,6 +171,10 @@ static herr_t H5S__hyper_iter_get_seq_list_opt(H5S_sel_iter_t *iter, size_t maxs size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len); static herr_t H5S__hyper_iter_get_seq_list_single(H5S_sel_iter_t *iter, size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len); +static herr_t H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata); +static herr_t H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info, + const H5S_hyper_span_info_t *sis_span_info, hsize_t count, unsigned depth, + H5S_hyper_project_intersect_ud_t *udata); static void H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count, hsize_t *block, hsize_t clip_size); static hsize_t H5S__hyper_get_clip_extent_real(const H5S_t *clip_space, @@ -10442,6 +10470,577 @@ done: /*-------------------------------------------------------------------------- NAME + H5S__hyper_proj_int_build_proj + PURPOSE + Secondary iteration routine for H5S__hyper_project_intersection + USAGE + herr_t H5S__hyper_proj_int_build_proj(udata) + H5S_hyper_project_intersect_ud_t *udata; IN/OUT: Persistent shared data for iteration + RETURNS + Non-negative on success/Negative on failure. + DESCRIPTION + Takes the skip and nelem amounts listed in udata and converts them to + span trees in the projected space, using the destination space. This + is a non-recursive algorithm by necessity, it saves the current state + of iteration in udata and resumes in the same location on subsequent + calls. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) { + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + HDassert(udata->nelem > 0); + + /* + * Skip over skipped elements + */ + if(udata->skip > 0) { + /* Work upwards, finishing each span tree before moving up */ + HDassert(udata->ds_span[udata->depth]); + do { + /* Check for lowest dimension */ + if(udata->ds_span[udata->depth]->down) { + if(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high) { + /* If we will run out of elements to skip in this span, + * advance to the first not fully skipped span and break + * out of this loop (start moving downwards) */ + if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen) + * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { + udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->u.nelmts; + udata->skip %= udata->ds_span[udata->depth]->down->u.nelmts; + break; + } /* end if */ + + /* Skip over this entire span */ + udata->skip -= udata->ds_span[udata->depth]->down->u.nelmts + * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1); + } /* end if */ + } /* end if */ + else { + HDassert(udata->ds_rank - udata->depth == 1); + + /* If we will run out of elements to skip in this span, + * skip the remainder of the skipped elements and break out */ + HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high); + if(udata->skip < (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { + udata->ds_low[udata->depth] += udata->skip; + udata->skip = 0; + break; + } /* end if */ + + /* Skip over this entire span */ + udata->skip -= udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1; + } /* end else */ + + /* Advance to next span */ + udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next; + if(udata->ds_span[udata->depth]) + udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; + else if(udata->depth > 0) { + /* If present, append this span tree to the higher dimension's, + * and release ownership of it */ + if(udata->ps_span_info[udata->depth]) { + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth - 1], + udata->ds_rank - udata->depth + 1, udata->ds_low[udata->depth - 1], + udata->ds_low[udata->depth - 1], + udata->ps_span_info[udata->depth]) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + H5S__hyper_free_span_info(udata->ps_span_info[udata->depth]); + udata->ps_span_info[udata->depth] = NULL; + } /* end if */ + + /* Ran out of spans, move up one dimension */ + udata->depth--; + HDassert(udata->ds_span[udata->depth]); + udata->ds_low[udata->depth]++; + } /* end if */ + else + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "insufficient elements in destination selection") + } while((udata->skip > 0) + || (udata->ds_low[udata->depth] > udata->ds_span[udata->depth]->high)); + + /* Work downwards until skip is 0 */ + HDassert(udata->ds_span[udata->depth]); + while(udata->skip > 0) { + HDassert(udata->ds_span[udata->depth]->down); + udata->depth++; + udata->ds_span[udata->depth] = udata->ds_span[udata->depth - 1]->down->head; + udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; + if(udata->ds_span[udata->depth]->down) { + do { + /* If we will run out of elements to skip in this span, + * advance to the first not fully skipped span and + * continue down */ + if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen) + * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { + udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->u.nelmts; + udata->skip %= udata->ds_span[udata->depth]->down->u.nelmts; + break; + } /* end if */ + + /* Skip over this entire span */ + udata->skip -= udata->ds_span[udata->depth]->down->u.nelmts + * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1); + + /* Advance to next span */ + udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next; + HDassert(udata->ds_span[udata->depth]); + udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; + } while(udata->skip > 0); + } /* end if */ + else { + do { + /* If we will run out of elements to skip in this span, + * skip the remainder of the skipped elements */ + if(udata->skip < (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { + udata->ds_low[udata->depth] += udata->skip; + udata->skip = 0; + break; + } /* end if */ + + /* Skip over this entire span */ + udata->skip -= udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1; + + /* Advance to next span */ + udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next; + HDassert(udata->ds_span[udata->depth]); + udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; + } while(udata->skip > 0); + } /* end else */ + } /* end while */ + } /* end if */ + + /* + * Add requested number of elements to projected space + */ + /* Work upwards, adding all elements of each span tree until it can't fit + * all elements */ + HDassert(udata->ds_span[udata->depth]); + do { + /* Check for lowest dimension */ + if(udata->ds_span[udata->depth]->down) { + if(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high) { + /* If we will run out of elements to add in this span, add + * any complete spans, advance to the first not fully added + * span, and break out of this loop (start moving downwards) + */ + if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen) + * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { + if(udata->nelem >= udata->ds_span[udata->depth]->down->u.nelmts) { + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], + udata->ds_rank - udata->depth, udata->ds_low[udata->depth], + udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts) - 1, + udata->ds_span[udata->depth]->down) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts; + udata->nelem %= udata->ds_span[udata->depth]->down->u.nelmts; + } /* end if */ + break; + } /* end if */ + + /* Append span tree for entire span */ + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], + udata->ds_rank - udata->depth, udata->ds_low[udata->depth], + udata->ds_span[udata->depth]->high, + udata->ds_span[udata->depth]->down) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + udata->nelem -= udata->ds_span[udata->depth]->down->u.nelmts + * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1); + } /* end if */ + } /* end if */ + else { + HDassert(udata->ds_rank - udata->depth == 1); + + /* If we will run out of elements to add in this span, add the + * remainder of the elements and break out */ + HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high); + if(udata->nelem < (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], 1, + udata->ds_low[udata->depth], udata->ds_low[udata->depth] + udata->nelem - 1, NULL) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + udata->ds_low[udata->depth] += udata->nelem; + udata->nelem = 0; + break; + } /* end if */ + + /* Append span tree for entire span */ + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], 1, + udata->ds_low[udata->depth], udata->ds_span[udata->depth]->high, NULL) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + udata->nelem -= udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1; + } /* end else */ + + /* Advance to next span */ + udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next; + if(udata->ds_span[udata->depth]) + udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; + else if(udata->depth > 0) { + /* Append this span tree to the higher dimension's, and release + * ownership of it */ + HDassert(udata->ps_span_info[udata->depth]); + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth - 1], + udata->ds_rank - udata->depth + 1, udata->ds_low[udata->depth - 1], + udata->ds_low[udata->depth - 1], + udata->ps_span_info[udata->depth]) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + H5S__hyper_free_span_info(udata->ps_span_info[udata->depth]); + udata->ps_span_info[udata->depth] = NULL; + + /* Ran out of spans, move up one dimension */ + udata->depth--; + HDassert(udata->ds_span[udata->depth]); + udata->ds_low[udata->depth]++; + } /* end if */ + else { + /* We have finished the entire destination span tree. If there are + * still elements to add, issue an error. */ + if(udata->nelem > 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "insufficient elements in destination selection") + break; + } /* end else */ + } while((udata->nelem > 0) + || (udata->ds_low[udata->depth] > udata->ds_span[udata->depth]->high)); + + /* Work downwards until nelem is 0 */ + HDassert(udata->ds_span[udata->depth] || (udata->nelem == 0)); + while(udata->nelem > 0) { + HDassert(udata->ds_span[udata->depth]->down); + udata->depth++; + udata->ds_span[udata->depth] = udata->ds_span[udata->depth - 1]->down->head; + udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; + if(udata->ds_span[udata->depth]->down) { + do { + /* If we will run out of elements to add in this span, add + * any complete spans, advance to the first not fully added + * span and continue down + */ + HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high); + if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen) + * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { + if(udata->nelem >= udata->ds_span[udata->depth]->down->u.nelmts) { + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], + udata->ds_rank - udata->depth, udata->ds_low[udata->depth], + udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts) - 1, + udata->ds_span[udata->depth]->down) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts; + udata->nelem %= udata->ds_span[udata->depth]->down->u.nelmts; + } /* end if */ + break; + } /* end if */ + + /* Append span tree for entire span */ + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], + udata->ds_rank - udata->depth, udata->ds_low[udata->depth], + udata->ds_span[udata->depth]->high, + udata->ds_span[udata->depth]->down) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + udata->nelem -= udata->ds_span[udata->depth]->down->u.nelmts + * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1); + + /* Advance to next span */ + udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next; + HDassert(udata->ds_span[udata->depth]); + udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; + } while(udata->nelem > 0); + } /* end if */ + else { + HDassert(udata->ds_rank - udata->depth == 1); + do { + /* If we will run out of elements to add in this span, add + * the remainder of the elements and break out */ + HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high); + if(udata->nelem < (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], 1, + udata->ds_low[udata->depth], udata->ds_low[udata->depth] + udata->nelem - 1, NULL) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + udata->ds_low[udata->depth] += udata->nelem; + udata->nelem = 0; + break; + } /* end if */ + + /* Append span tree for entire span */ + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], 1, + udata->ds_low[udata->depth], udata->ds_span[udata->depth]->high, NULL) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + udata->nelem -= udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1; + + /* Advance to next span */ + udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next; + HDassert(udata->ds_span[udata->depth]); + udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; + } while(udata->nelem > 0); + } /* end else */ + } /* end while */ + + HDassert(udata->skip == 0); + HDassert(udata->nelem == 0); + + /* Mark projected space as changed (for all ranks) */ + udata->ps_clean_bitmap = 0; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5S__hyper_proj_int_build_proj() */ + + +/*-------------------------------------------------------------------------- + NAME + H5S__hyper_proj_int_iterate + PURPOSE + Main iteration routine for H5S__hyper_project_intersection + USAGE + herr_t H5S__hyper_proj_int_iterate(ss_span_info,sis_span_info,count,depth,udata) + const H5S_hyper_span_info_t *ss_span_info; IN: Span tree for source selection + const H5S_hyper_span_info_t *sis_span_info; IN: Span tree for source intersect selection + hsize_t count; IN: Number of times to compute the intersection of ss_span_info and sis_span_info + unsigned depth; IN: Depth of iteration (in terms of rank) + H5S_hyper_project_intersect_ud_t *udata; IN/OUT: Persistent shared data for iteration + RETURNS + Non-negative on success/Negative on failure. + DESCRIPTION + Computes the intersection of ss_span_info and sis_span_info and projects it + to the projected space (held in udata). It accomplishes this by iterating + over both spaces and computing the number of elements to skip (in + ss_span_info) and the number of elements to add (the intersection) in a + sequential fashion (similar to run length encoding). As necessary, this + function both recurses into lower dimensions and calls + H5S__hyper_proj_int_build_proj to convert the skip/nelem pairs to the + projected span tree. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info, + const H5S_hyper_span_info_t *sis_span_info, hsize_t count, unsigned depth, + H5S_hyper_project_intersect_ud_t *udata) +{ + const H5S_hyper_span_t *ss_span; /* Current span in source space */ + const H5S_hyper_span_t *sis_span; /* Current span in source intersect space */ + hsize_t ss_low; /* Current low bounds of source span */ + hsize_t sis_low; /* Current low bounds of source intersect span */ + hsize_t high; /* High bounds of current intersection */ + hsize_t low; /* Low bounds of current intersection */ + hsize_t old_skip; /* Value of udata->skip before main loop */ + hsize_t old_nelem; /* Value of udata->nelem before main loop */ + hbool_t check_intersect; /* Whether to check for intersecting elements */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check for non-overlapping bounds */ + check_intersect = TRUE; + for(u = 0; u < (udata->ss_rank - depth); u++) + if(!H5S_RANGE_OVERLAP(ss_span_info->low_bounds[u], + ss_span_info->high_bounds[u], + sis_span_info->low_bounds[u], + sis_span_info->high_bounds[u])) { + check_intersect = FALSE; + break; + } /* end if */ + + /* Only enter main loop if there's something to do */ + if(check_intersect) { + /* Set ps_clean_bitmap */ + udata->ps_clean_bitmap |= (((uint32_t)1) << depth); + + /* Save old skip and nelem */ + old_skip = udata->skip; + old_nelem = udata->nelem; + + /* Intersect spaces once per count */ + for(u = 0; u < count; u++) { + ss_span = ss_span_info->head; + sis_span = sis_span_info->head; + HDassert(ss_span && sis_span); + ss_low = ss_span->low; + sis_low = sis_span->low; + + /* Main loop */ + do { + /* Check if spans overlap */ + if(H5S_RANGE_OVERLAP(ss_low, ss_span->high, + sis_low, sis_span->high)) { + high = MIN(ss_span->high, sis_span->high); + if(ss_span->down) { + /* Add skipped elements if there's a pre-gap */ + if(ss_low < sis_low) { + low = sis_low; + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (sis_low - ss_low), FAIL); + } /* end if */ + else + low = ss_low; + + /* Recurse into next dimension down */ + if(H5S__hyper_proj_int_iterate(ss_span->down, sis_span->down, high - low + 1, depth + 1, udata) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't iterate over source selections") + } /* end if */ + else { + HDassert(depth == udata->ss_rank - 1); + + /* Add skipped elements if there's a pre-gap */ + if(ss_low < sis_low) { + low = sis_low; + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, sis_low - ss_low, FAIL); + } /* end if */ + else + low = ss_span->low; + + /* Add overlapping elements */ + udata->nelem += high - low + 1; + } /* end else */ + + /* Advance spans */ + if(ss_span->high == sis_span->high) { + /* Advance both spans */ + ss_span = ss_span->next; + if(ss_span) + ss_low = ss_span->low; + sis_span = sis_span->next; + if(sis_span) + sis_low = sis_span->low; + } /* end if */ + else if(ss_span->high == high) { + /* Advance source span */ + HDassert(ss_span->high < sis_span->high); + sis_low = high + 1; + ss_span = ss_span->next; + if(ss_span) + ss_low = ss_span->low; + } /* end if */ + else { + /* Advance source intersect span */ + HDassert(ss_span->high > sis_span->high); + ss_low = high + 1; + sis_span = sis_span->next; + if(sis_span) + sis_low = sis_span->low; + } /* end else */ + } /* end if */ + else { + /* Advance spans */ + if(ss_span->high < sis_low) { + /* Add skipped elements */ + if(ss_span->down) + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL); + else + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, ss_span->high - ss_low + 1, FAIL); + + /* Advance source span */ + ss_span = ss_span->next; + if(ss_span) + ss_low = ss_span->low; + } /* end if */ + else { + /* Advance source intersect span */ + HDassert(ss_low > sis_span->high); + sis_span = sis_span->next; + if(sis_span) + sis_low = sis_span->low; + } /* end else */ + } /* end else */ + } while(ss_span && sis_span); + + if(ss_span && !((depth == 0) && (u == count - 1))) { + /* Count remaining elements in ss_span_info */ + if(ss_span->down) + do { + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL); + ss_span = ss_span->next; + if(ss_span) + ss_low = ss_span->low; + } while(ss_span); + else + do { + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, ss_span->high - ss_low + 1, FAIL); + ss_span = ss_span->next; + if(ss_span) + ss_low = ss_span->low; + } while(ss_span); + } /* end if */ + + /* Check if the projected space was not changed since we started the + * first iteration of the loop, if so we do not need to continue + * looping and can just copy the result */ + if(udata->ps_clean_bitmap & (((uint32_t)1) << depth)) { + HDassert(u == 0); + if(udata->skip == old_skip) { + /* First case: algorithm added only elements */ + HDassert(udata->nelem >= old_nelem); + udata->nelem += (count - 1) * (udata->nelem - old_nelem); + } /* end if */ + else if(udata->nelem == 0) { + /* Second case: algorithm added only skip. In this case, + * nelem must be 0 since otherwise adding skip would have + * triggered a change in the projected space */ + HDassert(old_nelem == 0); + HDassert(udata->skip > old_skip); + udata->skip += (count - 1) * (udata->skip - old_skip); + } /* end if */ + else { + /* Third case: agorithm added skip and nelem (in that + * order). Add the same skip and nelem once for each item + * remaining in count. */ + hsize_t skip_add; + hsize_t nelem_add; + + HDassert(udata->nelem > 0); + HDassert(udata->skip > old_skip); + HDassert(old_nelem == 0); + + skip_add = udata->skip - old_skip; + nelem_add = udata->nelem - old_nelem; + for(u = 1; u < count; u++) { + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, skip_add, FAIL); + udata->nelem += nelem_add; + } /* end for */ + } /* end else */ + + /* End loop since we already took care of it */ + break; + } /* end if */ + } /* end for */ + } /* end if */ + else if(depth > 0) + /* Just count skipped elements */ + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper((H5S_hyper_span_info_t *)ss_span_info, udata->op_gen) * count, FAIL); /* Casting away const OK -NAF */ + + /* Clean up if we are done */ + if(depth == 0) { + /* Add remaining elements */ + if(udata->nelem > 0) + if(H5S__hyper_proj_int_build_proj(udata) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't add elements to projected selection") + + /* Append remaining span trees */ + for(u = udata->ds_rank - 1; u > 0; u--) + if(udata->ps_span_info[u]) { + if(H5S__hyper_append_span(&udata->ps_span_info[u - 1], + udata->ds_rank - u + 1, udata->ds_low[u - 1], + udata->ds_low[u - 1], + udata->ps_span_info[u]) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + H5S__hyper_free_span_info(udata->ps_span_info[u]); + udata->ps_span_info[u] = NULL; + } /* end if */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5S__hyper_proj_int_iterate() */ + + +/*-------------------------------------------------------------------------- + NAME H5S__hyper_project_intersection PURPOSE Projects the intersection of of the selections of src_space and @@ -10461,7 +11060,9 @@ done: within the selection of dst_space. The result is placed in the selection of proj_space. Note src_space, dst_space, and src_intersect_space do not need to use hyperslab selections, but they cannot use point selections. - The result is always a hyperslab selection. + The result is always a hyperslab or none selection. Note also that + proj_space can share some span trees with dst_space, so proj_space + must not be subsequently modified if dst_space must be preserved. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES @@ -10471,43 +11072,11 @@ herr_t H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, const H5S_t *src_intersect_space, H5S_t *proj_space) { - hsize_t ss_off[H5S_PROJECT_INTERSECT_NSEQS]; /* Offset array for src_space */ - size_t ss_len[H5S_PROJECT_INTERSECT_NSEQS]; /* Length array for src_space */ - size_t ss_nseq; /* Number of sequences for src_space */ - size_t ss_nelem; /* Number of elements for src_space */ - size_t ss_i = (size_t)0; /* Index into offset/length arrays for src_space */ - hbool_t advance_ss = FALSE; /* Whether to advance ss_i on the next iteration */ - H5S_sel_iter_t *ss_iter = NULL; /* Selection iterator for src_space */ - hbool_t ss_iter_init = FALSE; /* Whether ss_iter is initialized */ - hsize_t ss_sel_off = (hsize_t)0; /* Offset within src_space selection */ - hsize_t ds_off[H5S_PROJECT_INTERSECT_NSEQS]; /* Offset array for dst_space */ - size_t ds_len[H5S_PROJECT_INTERSECT_NSEQS]; /* Length array for dst_space */ - size_t ds_nseq; /* Number of sequences for dst_space */ - size_t ds_nelem; /* Number of elements for dst_space */ - size_t ds_i = (size_t)0; /* Index into offset/length arrays for dst_space */ - H5S_sel_iter_t *ds_iter = NULL; /* Selection iterator for dst_space */ - hbool_t ds_iter_init = FALSE; /* Whether ds_iter is initialized */ - hsize_t ds_sel_off = (hsize_t)0; /* Offset within dst_space selection */ - hsize_t sis_off[H5S_PROJECT_INTERSECT_NSEQS]; /* Offset array for src_intersect_space */ - size_t sis_len[H5S_PROJECT_INTERSECT_NSEQS]; /* Length array for src_intersect_space */ - size_t sis_nseq; /* Number of sequences for src_intersect_space */ - size_t sis_nelem; /* Number of elements for src_intersect_space */ - size_t sis_i = (size_t)0; /* Index into offset/length arrays for src_intersect_space */ - hbool_t advance_sis = FALSE; /* Whether to advance sis_i on the next iteration */ - H5S_sel_iter_t *sis_iter = NULL; /* Selection iterator for src_intersect_space */ - hbool_t sis_iter_init = FALSE; /* Whether sis_iter is initialized */ - hsize_t int_sel_off; /* Offset within intersected selections (ss/sis and ds/ps) */ - size_t int_len; /* Length of segment in intersected selections */ - hsize_t proj_off; /* Segment offset in proj_space */ - size_t proj_len; /* Segment length in proj_space */ - size_t proj_len_rem; /* Remaining length in proj_space for segment */ - hsize_t proj_down_dims[H5S_MAX_RANK]; /* "Down" dimensions in proj_space */ - H5S_hyper_span_info_t *curr_span_tree[H5S_MAX_RANK]; /* Current span tree being built (in each dimension) */ - hsize_t curr_span_up_dim[H5S_MAX_RANK]; /* "Up" dimensions for current span */ - unsigned proj_rank; /* Rank of proj_space */ - hsize_t low; /* Low value of span */ - size_t nelem; /* Number of elements returned for get_seq_list op */ - unsigned u; /* Local index variable */ + H5S_hyper_project_intersect_ud_t udata; /* User data for subroutines */ + const H5S_hyper_span_info_t *ss_span_info; + const H5S_hyper_span_info_t *ds_span_info; + H5S_hyper_span_info_t *ss_span_info_buf = NULL; + H5S_hyper_span_info_t *ds_span_info_buf = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -10521,280 +11090,88 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, /* Assert that src_space and src_intersect_space have same extent and there * are no point selections */ HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space)); - HDassert(!HDmemcmp(src_space->extent.size, src_intersect_space->extent.size, - (size_t)H5S_GET_EXTENT_NDIMS(src_space) * sizeof(src_space->extent.size[0]))); + HDassert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space)); HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_POINTS); HDassert(H5S_GET_SELECT_TYPE(dst_space) != H5S_SEL_POINTS); - HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) != H5S_SEL_POINTS); - - /* Initialize prev_space, curr_span_tree, and curr_span_up_dim */ - HDmemset(curr_span_tree, 0, sizeof(curr_span_tree)); - HDmemset(curr_span_up_dim, 0, sizeof(curr_span_up_dim)); + HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_HYPERSLABS); - /* Save rank of projected space */ - proj_rank = proj_space->extent.rank; - HDassert(proj_rank > 0); + /* Set up ss_span_info */ + if(H5S_GET_SELECT_TYPE(src_space) == H5S_SEL_HYPERSLABS) { + /* Make certain the selection has a span tree */ + if(NULL == src_space->select.sel_info.hslab->span_lst) + if(H5S__hyper_generate_spans((H5S_t *)src_space) < 0) /* Casting away const OK -NAF */ + HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "can't construct span tree for source hyperslab selection") - /* Get numbers of elements */ - ss_nelem = (size_t)H5S_GET_SELECT_NPOINTS(src_space); - ds_nelem = (size_t)H5S_GET_SELECT_NPOINTS(dst_space); - sis_nelem = (size_t)H5S_GET_SELECT_NPOINTS(src_intersect_space); - HDassert(ss_nelem == ds_nelem); - - /* Calculate proj_down_dims */ - if(H5VM_array_down(proj_rank, proj_space->extent.size, proj_down_dims) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value") - - /* Remove current selection from proj_space */ - if(H5S_SELECT_RELEASE(proj_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection") - - /* If any selections are empty, skip to the end so "none" is selected */ - if((ss_nelem == 0) || (ds_nelem == 0) || (sis_nelem == 0)) - goto loop_end; - - /* Allocate space for the hyperslab selection information (note this sets - * diminfo_valid to FALSE, diminfo arrays to 0, and span list to NULL) */ - if(NULL == (proj_space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info") - - /* Set selection type */ - proj_space->select.type = H5S_sel_hyper; - - /* Set unlim_dim */ - proj_space->select.sel_info.hslab->unlim_dim = -1; - - /* Allocate the source selection iterator */ - if(NULL == (ss_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate source selection iterator") - - /* Initialize source space iterator */ - if(H5S_select_iter_init(ss_iter, src_space, (size_t)1, 0) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") - ss_iter_init = TRUE; - - /* Get sequence list for source space */ - if(H5S_SELECT_ITER_GET_SEQ_LIST(ss_iter, H5S_PROJECT_INTERSECT_NSEQS, ss_nelem, &ss_nseq, &nelem, ss_off, ss_len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") - ss_nelem -= nelem; - HDassert(ss_nseq > 0); - - /* Allocate the destination selection iterator */ - if(NULL == (ds_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate destination selection iterator") - - /* Initialize destination space iterator */ - if(H5S_select_iter_init(ds_iter, dst_space, (size_t)1, 0) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") - ds_iter_init = TRUE; - - /* Get sequence list for destination space */ - if(H5S_SELECT_ITER_GET_SEQ_LIST(ds_iter, H5S_PROJECT_INTERSECT_NSEQS, ds_nelem, &ds_nseq, &nelem, ds_off, ds_len) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") - ds_nelem -= nelem; - HDassert(ds_nseq > 0); - - /* Allocate the source intersect space iterator */ - if(NULL == (sis_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate source intersect space iterator") - - /* Initialize source intersect space iterator */ - if(H5S_select_iter_init(sis_iter, src_intersect_space, (size_t)1, 0) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") - sis_iter_init = TRUE; - - /* Get sequence list for source intersect space */ - if(H5S_SELECT_ITER_GET_SEQ_LIST(sis_iter, H5S_PROJECT_INTERSECT_NSEQS, sis_nelem, &sis_nseq, &nelem, sis_off, sis_len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") - sis_nelem -= nelem; - HDassert(sis_nseq > 0); - - /* Loop until we run out of sequences in either the source or source - * intersect space */ - while(1) { - while(advance_ss || (ss_off[ss_i] + ss_len[ss_i] <= sis_off[sis_i])) { - /* Either we finished the current source sequence or the - * sequences do not intersect. Advance source space. */ - ss_sel_off += (hsize_t)ss_len[ss_i]; - if(++ss_i == ss_nseq) { - if(ss_nelem > 0) { - /* Try to grab more sequences from src_space */ - if(H5S_SELECT_ITER_GET_SEQ_LIST(ss_iter, H5S_PROJECT_INTERSECT_NSEQS, ss_nelem, &ss_nseq, &nelem, ss_off, ss_len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") - HDassert(ss_len[0] > 0); - - /* Update ss_nelem */ - HDassert(nelem > 0); - HDassert(nelem <= ss_nelem); - ss_nelem -= nelem; - - /* Reset source space index */ - ss_i = 0; - } /* end if */ - else - /* There are no more sequences in src_space, so we can exit - * the loop. Use goto instead of break so we exit the outer - * loop. */ - goto loop_end; - } /* end if */ + /* Simply point to existing span tree */ + ss_span_info = src_space->select.sel_info.hslab->span_lst; + } /* end if */ + else { + /* Create temporary span tree from all selection */ + HDassert(H5S_GET_SELECT_TYPE(src_space) == H5S_SEL_ALL); - /* Reset advance_ss */ - advance_ss = FALSE; - } /* end while */ - if(advance_sis || (sis_off[sis_i] + sis_len[sis_i] <= ss_off[ss_i])) { - do { - /* Either we finished the current source intersect sequence or - * the sequences do not intersect. Advance source intersect - * space. */ - if(++sis_i == sis_nseq) { - if(sis_nelem > 0) { - /* Try to grab more sequences from src_intersect_space - */ - if(H5S_SELECT_ITER_GET_SEQ_LIST(sis_iter, H5S_PROJECT_INTERSECT_NSEQS, sis_nelem, &sis_nseq, &nelem, sis_off, sis_len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") - HDassert(sis_len[0] > 0); + if(NULL == (ss_span_info_buf = H5S__hyper_make_spans(H5S_GET_EXTENT_NDIMS(src_space), + H5S_hyper_zeros_g, H5S_hyper_zeros_g, H5S_hyper_ones_g, src_space->extent.size))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't create span tree for ALL source space") + ss_span_info = ss_span_info_buf; + } /* end else */ - /* Update ss_nelem */ - HDassert(nelem > 0); - HDassert(nelem <= sis_nelem); - sis_nelem -= nelem; + /* Set up ds_span_info */ + if(H5S_GET_SELECT_TYPE(dst_space) == H5S_SEL_HYPERSLABS) { + /* Make certain the selection has a span tree */ + if(NULL == dst_space->select.sel_info.hslab->span_lst) + if(H5S__hyper_generate_spans((H5S_t *)dst_space) < 0) /* Casting away const OK -NAF */ + HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "can't construct span tree for dsetination hyperslab selection") - /* Reset source space index */ - sis_i = 0; - } /* end if */ - else - /* There are no more sequences in src_intersect_space, - * so we can exit the loop. Use goto instead of break - * so we exit the outer loop. */ - goto loop_end; - } /* end if */ - } while(sis_off[sis_i] + sis_len[sis_i] <= ss_off[ss_i]); - - /* Reset advance_sis */ - advance_sis = FALSE; - } /* end if */ - else { - /* Sequences intersect, add intersection to projected space */ - /* Calculate intersection sequence in terms of offset within source - * selection and advance any sequences we complete */ - if(ss_off[ss_i] >= sis_off[sis_i]) - int_sel_off = ss_sel_off; - else - int_sel_off = sis_off[sis_i] - ss_off[ss_i] + ss_sel_off; - if((ss_off[ss_i] + (hsize_t)ss_len[ss_i]) <= (sis_off[sis_i] - + (hsize_t)sis_len[sis_i])) { - int_len = (size_t)((hsize_t)ss_len[ss_i] + ss_sel_off - int_sel_off); - advance_ss = TRUE; - } /* end if */ - else - int_len = (size_t)(sis_off[sis_i] + (hsize_t)sis_len[sis_i] - ss_off[ss_i] + ss_sel_off - int_sel_off); - if((ss_off[ss_i] + (hsize_t)ss_len[ss_i]) >= (sis_off[sis_i] - + (hsize_t)sis_len[sis_i])) - advance_sis = TRUE; - - /* Project intersection sequence to destination selection */ - while(int_len > (size_t)0) { - while(ds_sel_off + (hsize_t)ds_len[ds_i] <= int_sel_off) { - /* Intersection is not projected to this destination - * sequence, advance destination space */ - ds_sel_off += (hsize_t)ds_len[ds_i]; - if(++ds_i == ds_nseq) { - HDassert(ds_nelem > 0); - - /* Try to grab more sequences from dst_space */ - if(H5S_SELECT_ITER_GET_SEQ_LIST(ds_iter, H5S_PROJECT_INTERSECT_NSEQS, ds_nelem, &ds_nseq, &nelem, ds_off, ds_len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") - HDassert(ds_len[0] > 0); - - /* Update ss_nelem */ - HDassert(nelem > 0); - HDassert(nelem <= ds_nelem); - ds_nelem -= nelem; - - /* Reset source space index */ - ds_i = 0; - } /* end if */ - } /* end while */ + /* Simply point to existing span tree */ + ds_span_info = dst_space->select.sel_info.hslab->span_lst; + } /* end if */ + else { + /* Create temporary span tree from all selection */ + HDassert(H5S_GET_SELECT_TYPE(dst_space) == H5S_SEL_ALL); - /* Add sequence to projected space */ - HDassert(ds_sel_off <= int_sel_off); - proj_off = ds_off[ds_i] + int_sel_off - ds_sel_off; - proj_len = proj_len_rem = (size_t)MIN(int_len, - (size_t)(ds_sel_off + (hsize_t)ds_len[ds_i] - int_sel_off)); - - /* Add to span tree */ - while(proj_len_rem > (size_t)0) { - hsize_t high; /* High value of span */ - size_t span_len; /* Length of span */ - - /* Append spans in higher dimensions if we're going ouside - * the plane of the span currently being built (i.e. it's - * finished being built) */ - /* Check for more than one full row (in every dim) and - * append multiple spans at once? -NAF */ - for(u = proj_rank - 1; ((u > 0) - && ((proj_off / proj_down_dims[u - 1]) - != curr_span_up_dim[u - 1])); u--) { - if(curr_span_tree[u]) { - /* Append complete lower dimension span tree to - * current dimension */ - low = curr_span_up_dim[u - 1] % proj_space->extent.size[u - 1]; - if(H5S__hyper_append_span(&curr_span_tree[u - 1], (proj_rank - u) + 1, low, low, curr_span_tree[u]) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + if(NULL == (ds_span_info_buf = H5S__hyper_make_spans(H5S_GET_EXTENT_NDIMS(dst_space), + H5S_hyper_zeros_g, H5S_hyper_zeros_g, H5S_hyper_ones_g, dst_space->extent.size))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't create span tree for ALL destination space") + ds_span_info = ds_span_info_buf; + } /* end else */ - /* Reset lower dimension's span tree and previous - * span since we just committed it and will start - * over with a new one */ - H5S__hyper_free_span_info(curr_span_tree[u]); - curr_span_tree[u] = NULL; - } /* end if */ + /* Make certain the source intersect selection has a span tree */ + if(NULL == src_intersect_space->select.sel_info.hslab->span_lst) + if(H5S__hyper_generate_spans((H5S_t *)src_intersect_space) < 0) /* Casting away const OK -NAF */ + HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "can't construct span tree for source intersect hyperslab selection") - /* Update curr_span_up_dim */ - curr_span_up_dim[u - 1] = proj_off / proj_down_dims[u - 1]; - } /* end for */ + /* Initialize udata */ + HDmemset(&udata, 0, sizeof(udata)); + udata.ds_span[0] = ds_span_info->head; + udata.ds_low[0] = udata.ds_span[0]->low; + udata.ss_rank = H5S_GET_EXTENT_NDIMS(src_space); + udata.ds_rank = H5S_GET_EXTENT_NDIMS(dst_space); + udata.op_gen = H5S__hyper_get_op_gen(); - /* Compute bounds for new span in lowest dimension */ - low = proj_off % proj_space->extent.size[proj_rank - 1]; - span_len = MIN(proj_len_rem, - (size_t)(proj_space->extent.size[proj_rank - 1] - - low)); - HDassert(proj_len_rem >= span_len); - high = (low + (hsize_t)span_len) - (hsize_t)1; + /* Iterate over selections and build projected span tree */ + if(H5S__hyper_proj_int_iterate(ss_span_info, src_intersect_space->select.sel_info.hslab->span_lst, 1, 0, &udata) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "selection iteration failed") - /* Append span in lowest dimension */ - if(H5S__hyper_append_span(&curr_span_tree[proj_rank - 1], 1, low, high, NULL) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + /* Remove current selection from proj_space */ + if(H5S_SELECT_RELEASE(proj_space) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection") - /* Update remaining offset and length */ - proj_off += (hsize_t)span_len; - proj_len_rem -= span_len; - } /* end while */ + /* Check for elements in projected space */ + if(udata.ps_span_info[0]) { + /* Allocate space for the hyperslab selection information (note this sets + * diminfo_valid to FALSE, diminfo arrays to 0, and span list to NULL) */ + if(NULL == (proj_space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info") - /* Update intersection sequence */ - int_sel_off += (hsize_t)proj_len; - int_len -= proj_len; - } /* end while */ - } /* end else */ - } /* end while */ - -loop_end: - /* Add remaining spans to span tree */ - for(u = proj_rank - 1; u > 0; u--) - if(curr_span_tree[u]) { - /* Append remaining span tree to higher dimension */ - low = curr_span_up_dim[u - 1] % proj_space->extent.size[u - 1]; - if(H5S__hyper_append_span(&curr_span_tree[u - 1], (proj_rank - u) + 1, low, low, curr_span_tree[u]) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + /* Set selection type */ + proj_space->select.type = H5S_sel_hyper; - /* Reset span tree */ - H5S__hyper_free_span_info(curr_span_tree[u]); - curr_span_tree[u] = NULL; - } /* end if */ + /* Set unlim_dim */ + proj_space->select.sel_info.hslab->unlim_dim = -1; - /* Add span tree to proj_space */ - if(curr_span_tree[0]) { - proj_space->select.sel_info.hslab->span_lst = curr_span_tree[0]; - curr_span_tree[0] = NULL; + /* Set span tree */ + proj_space->select.sel_info.hslab->span_lst = udata.ps_span_info[0]; + udata.ps_span_info[0] = NULL; /* Set the number of elements in current selection */ proj_space->select.num_elem = H5S__hyper_spans_nelem(proj_space->select.sel_info.hslab->span_lst); @@ -10810,36 +11187,40 @@ loop_end: HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection") done: - /* Release source selection iterator */ - if(ss_iter_init && H5S_SELECT_ITER_RELEASE(ss_iter) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") - if(ss_iter) - ss_iter = H5FL_FREE(H5S_sel_iter_t, ss_iter); - - /* Release destination selection iterator */ - if(ds_iter_init && H5S_SELECT_ITER_RELEASE(ds_iter) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") - if(ds_iter) - ds_iter = H5FL_FREE(H5S_sel_iter_t, ds_iter); - - /* Release source intersect selection iterator */ - if(sis_iter_init && H5S_SELECT_ITER_RELEASE(sis_iter) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") - if(sis_iter) - sis_iter = H5FL_FREE(H5S_sel_iter_t, sis_iter); + /* Free ss_span_info_buf */ + if(ss_span_info_buf) { + H5S__hyper_free_span_info(ss_span_info_buf); + ss_span_info_buf = NULL; + } /* end if */ + + /* Free ds_span_info_buf */ + if(ds_span_info_buf) { + H5S__hyper_free_span_info(ds_span_info_buf); + ds_span_info_buf = NULL; + } /* end if */ /* Cleanup on error */ if(ret_value < 0) { - /* Remove current selection from proj_space */ - if(H5S_SELECT_RELEASE(proj_space) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection") + unsigned u; /* Free span trees */ - for(u = 0; u < proj_rank; u++) - if(curr_span_tree[u]) - H5S__hyper_free_span_info(curr_span_tree[u]); + for(u = 0; u < udata.ds_rank; u++) + if(udata.ps_span_info[u]) { + H5S__hyper_free_span_info(udata.ps_span_info[u]); + udata.ps_span_info[u] = NULL; + } /* end if */ } /* end if */ +#ifndef NDEBUG + /* Verify there are no more span trees */ + { + unsigned u; + + for(u = 0; u < H5S_MAX_RANK; u++) + HDassert(!udata.ps_span_info[u]); + } /* end block */ +#endif /* NDEBUG */ + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_project_intersection() */ diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 80b5ea1..6983c93 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -2374,10 +2374,11 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, if(H5S_select_copy(new_space, dst_space, FALSE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination space selection") } /* end if */ - /* If any of the spaces are "none", the projection must also be "none" */ - else if((src_intersect_space->select.type->type == H5S_SEL_NONE) - || (src_space->select.type->type == H5S_SEL_NONE) - || (dst_space->select.type->type == H5S_SEL_NONE)) { + /* If any of the selections contain no elements, the projection must be + * "none" */ + else if((H5S_GET_SELECT_NPOINTS(src_intersect_space) == 0) + || (H5S_GET_SELECT_NPOINTS(src_space) == 0) + || (H5S_GET_SELECT_NPOINTS(dst_space) == 0)) { /* Change to "none" selection */ if(H5S_select_none(new_space) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") @@ -2389,6 +2390,8 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "point selections not currently supported") else { HDassert(src_intersect_space->select.type->type == H5S_SEL_HYPERSLABS); + HDassert(src_space->select.type->type != H5S_SEL_NONE); + HDassert(dst_space->select.type->type != H5S_SEL_NONE); /* Intersecting space is hyperslab selection. Call the hyperslab * routine to project to another hyperslab selection. */ diff --git a/test/vds.c b/test/vds.c index c3b6181..af052a8 100644 --- a/test/vds.c +++ b/test/vds.c @@ -1409,7 +1409,7 @@ test_basic_io(unsigned config, hid_t fapl) int erbuf[10][26]; /* Expected read buffer */ int fill = -1; /* Fill value */ herr_t ret; /* Generic return value */ - int i, j; + int i, j, u, v; TESTING("basic virtual dataset I/O") @@ -3498,6 +3498,724 @@ test_basic_io(unsigned config, hid_t fapl) memspace = -1; + /* + * Test 8: For code coverage: Horizontal block virtual mappings, and file + * selection, grid memory selection + */ + /* Clear virtual layout in DCPL */ + if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + TEST_ERROR + + /* Create memory dataspace */ + if((memspace = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Create virtual dataspaces */ + dims[0] = 8; + dims[1] = 15; + if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Create source dataspace */ + dims[0] = 4; + if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Select all in source space (should not be necessary, but just to be sure) + */ + if(H5Sselect_all(srcspace[0]) < 0) + TEST_ERROR + + /* Select hyperslabs in virtual spaces */ + start[0] = 0; + start[1] = 0; + if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + TEST_ERROR + start[0] = 4; + if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + TEST_ERROR + + /* Add virtual layout mappings */ + if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0) + TEST_ERROR + if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0) + TEST_ERROR + + /* Reset dims */ + dims[0] = 10; + dims[1] = 26; + + /* Create virtual file */ + if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + + /* Create source file if requested */ + if(config & TEST_IO_DIFFERENT_FILE) { + if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + } + else { + srcfile[0] = vfile; + if(H5Iinc_ref(srcfile[0]) < 0) + TEST_ERROR + } + + /* Create source datasets */ + if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Create virtual dataset */ + if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Reset erbuf */ + HDmemset(erbuf[0], 0, sizeof(rbuf)); + + /* Populate write buffer */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; + + /* Select hyperslab in memory */ + start[0] = 0; + start[1] = 0; + count[0] = 4; + count[1] = 15; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Write data directly to first source dataset */ + if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Update erbuf */ + u = 0; + v = 0; + for(i = 2; i < 4; i++) + for(j = 0; j < 15; j++) { + erbuf[u][v] = buf[i][j]; + v += 2; + if(v >= 24) { + u += 2; + v = 0; + } + } + + /* Select hyperslab in memory */ + start[0] = 4; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Write data directly to second source dataset */ + if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Update erbuf */ + for(i = 4; i < 6; i++) + for(j = 0; j < 15; j++) { + erbuf[u][v] = buf[i][j]; + v += 2; + if(v >= 24) { + u += 2; + v = 0; + } + } + + /* Close srcdsets and srcfile if config option specified */ + if(config & TEST_IO_CLOSE_SRC) { + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if(H5Dclose(srcdset[1]) < 0) + TEST_ERROR + srcdset[1] = -1; + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } + + /* Reopen virtual dataset and file if config option specified */ + if(config & TEST_IO_REOPEN_VIRT) { + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + TEST_ERROR + } + + /* Select hyperslab in memory */ + start[0] = 0; + start[1] = 0; + stride[0] = 2; + stride[1] = 2; + count[0] = 5; + count[1] = 12; + block[0] = 1; + block[1] = 1; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0) + TEST_ERROR + + /* Select hyperslab in file */ + start[0] = 2; + start[1] = 0; + count[0] = 4; + count[1] = 15; + if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Read data through virtual dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0) + TEST_ERROR + + /* Verify read data */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if(rbuf[i][j] != erbuf[i][j]) + TEST_ERROR + + /* Close */ + if(!(config & TEST_IO_CLOSE_SRC)) { + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if(H5Dclose(srcdset[1]) < 0) + TEST_ERROR + srcdset[1] = -1; + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if(H5Sclose(srcspace[0]) < 0) + TEST_ERROR + srcspace[0] = -1; + if(H5Sclose(vspace[0]) < 0) + TEST_ERROR + vspace[0] = -1; + if(H5Sclose(vspace[1]) < 0) + TEST_ERROR + vspace[1] = -1; + if(H5Sclose(memspace) < 0) + TEST_ERROR + memspace = -1; + + + /* + * Test 9: For code coverage: Horizontal block virtual mappings, and file + * selection, grid memory selection, 3 mappings, 3D memory space + */ + /* Clear virtual layout in DCPL */ + if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + TEST_ERROR + + /* Create memory dataspace */ + dims[1] = 13; + dims[2] = 2; + if((memspace = H5Screate_simple(3, dims, NULL)) < 0) + TEST_ERROR + + /* Create virtual dataspaces */ + dims[0] = 6; + dims[1] = 10; + if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + if((vspace[2] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Create source dataspace */ + dims[0] = 2; + if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Select all in source space (should not be necessary, but just to be sure) + */ + if(H5Sselect_all(srcspace[0]) < 0) + TEST_ERROR + + /* Select hyperslabs in virtual spaces */ + start[0] = 0; + start[1] = 0; + if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + TEST_ERROR + start[0] = 2; + if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + TEST_ERROR + start[0] = 4; + if(H5Sselect_hyperslab(vspace[2], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + TEST_ERROR + + /* Add virtual layout mappings */ + if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0) + TEST_ERROR + if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0) + TEST_ERROR + if(H5Pset_virtual(dcpl, vspace[2], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset3", srcspace[0]) < 0) + TEST_ERROR + + /* Reset dims */ + dims[0] = 10; + dims[1] = 26; + + /* Create virtual file */ + if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + + /* Create source file if requested */ + if(config & TEST_IO_DIFFERENT_FILE) { + if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + } + else { + srcfile[0] = vfile; + if(H5Iinc_ref(srcfile[0]) < 0) + TEST_ERROR + } + + /* Create source datasets */ + if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Create virtual dataset */ + if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Reset erbuf */ + HDmemset(erbuf[0], 0, sizeof(rbuf)); + + /* Populate write buffer */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; + + /* Select hyperslab in memory */ + start[0] = 0; + start[1] = 0; + start[2] = 0; + count[0] = 2; + count[1] = 5; + count[2] = 2; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Write data directly to first source dataset */ + if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Update erbuf */ + u = 0; + v = 0; + for(i = 0; i < 2; i++) + for(j = 0; j < 10; j++) { + erbuf[u][v] = buf[i][j]; + if(++v == 6) + v += 2; + else if(v == 14) { + u += 2; + v = 0; + } + } + + /* Select hyperslab in memory */ + start[0] = 2; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Write data directly to second source dataset */ + if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Update erbuf */ + for(i = 2; i < 4; i++) + for(j = 0; j < 10; j++) { + erbuf[u][v] = buf[i][j]; + if(++v == 6) + v += 2; + else if(v == 14) { + u += 2; + v = 0; + } + } + + /* Select hyperslab in memory */ + start[0] = 4; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Write data directly to third source dataset */ + if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Update erbuf */ + for(i = 4; i < 6; i++) + for(j = 0; j < 10; j++) { + erbuf[u][v] = buf[i][j]; + if(++v == 6) + v += 2; + else if(v == 14) { + u += 2; + v = 0; + } + } + + /* Close srcdsets and srcfile if config option specified */ + if(config & TEST_IO_CLOSE_SRC) { + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if(H5Dclose(srcdset[1]) < 0) + TEST_ERROR + srcdset[1] = -1; + if(H5Dclose(srcdset[2]) < 0) + TEST_ERROR + srcdset[2] = -1; + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } + + /* Reopen virtual dataset and file if config option specified */ + if(config & TEST_IO_REOPEN_VIRT) { + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + TEST_ERROR + } + + /* Select hyperslab in memory */ + start[0] = 0; + start[1] = 0; + start[2] = 0; + stride[0] = 2; + stride[1] = 4; + stride[2] = 1; + count[0] = 5; + count[1] = 2; + count[2] = 1; + block[0] = 1; + block[1] = 3; + block[2] = 2; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0) + TEST_ERROR + + /* Read data through virtual dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + TEST_ERROR + + /* Verify read data */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if(rbuf[i][j] != erbuf[i][j]) + TEST_ERROR + + /* Close */ + if(!(config & TEST_IO_CLOSE_SRC)) { + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if(H5Dclose(srcdset[1]) < 0) + TEST_ERROR + srcdset[1] = -1; + if(H5Dclose(srcdset[2]) < 0) + TEST_ERROR + srcdset[2] = -1; + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if(H5Sclose(srcspace[0]) < 0) + TEST_ERROR + srcspace[0] = -1; + if(H5Sclose(vspace[0]) < 0) + TEST_ERROR + vspace[0] = -1; + if(H5Sclose(vspace[1]) < 0) + TEST_ERROR + vspace[1] = -1; + if(H5Sclose(vspace[2]) < 0) + TEST_ERROR + vspace[2] = -1; + if(H5Sclose(memspace) < 0) + TEST_ERROR + memspace = -1; + + + /* + * Test 10: For code coverage: Vertical stripe virtual mappings, vertical + * block file selection, block memory selection, 3D VDS + */ + /* Clear virtual layout in DCPL */ + if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + TEST_ERROR + + /* Create memory dataspace */ + if((memspace = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Create virtual dataspaces */ + dims[0] = 10; + dims[1] = 9; + dims[2] = 6; + if((vspace[0] = H5Screate_simple(3, dims, NULL)) < 0) + TEST_ERROR + if((vspace[1] = H5Screate_simple(3, dims, NULL)) < 0) + TEST_ERROR + + /* Create source dataspace */ + dims[1] = 12; + if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Select all in source space (should not be necessary, but just to be sure) + */ + if(H5Sselect_all(srcspace[0]) < 0) + TEST_ERROR + + /* Select hyperslabs in virtual spaces */ + start[0] = 0; + start[1] = 0; + start[2] = 0; + count[0] = 1; + count[1] = 4; + count[2] = 3; + stride[0] = 1; + stride[1] = 2; + stride[2] = 2; + block[0] = 10; + block[1] = 1; + block[2] = 1; + if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) + TEST_ERROR + start[2] = 1; + if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) + TEST_ERROR + + /* Add virtual layout mappings */ + if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0) + TEST_ERROR + if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0) + TEST_ERROR + + /* Reset dims */ + dims[0] = 10; + dims[1] = 26; + + /* Create virtual file */ + if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + + /* Create source file if requested */ + if(config & TEST_IO_DIFFERENT_FILE) { + if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + } + else { + srcfile[0] = vfile; + if(H5Iinc_ref(srcfile[0]) < 0) + TEST_ERROR + } + + /* Create source datasets */ + if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Create virtual dataset */ + if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Initialize erbuf */ + HDmemset(erbuf[0], 0, sizeof(rbuf)); + for(i = 0; i < 10; i++) + for(j = 0; j < 24; j += 6) { + erbuf[i][j] = -1; + erbuf[i][j + 1] = -1; + } + + /* Populate write buffer */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; + + /* Select hyperslab in memory */ + start[0] = 0; + start[1] = 0; + count[0] = 10; + count[1] = 12; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Write data directly to first source dataset */ + if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Update erbuf */ + u = 0; + v = 0; + for(i = 0; i < 10; i++) + for(j = 0; j < 8; j++) { + if(v == 0 || v == 12) + erbuf[u][v] = buf[i][j]; + v += 2; + if(!(v % 6)) + v += 6; + if(v >= 28) { + u++; + v = 0; + } + } + + /* Select hyperslab in memory */ + start[1] = 8; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Write data directly to second source dataset */ + if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Update erbuf */ + u = 0; + v = 1; + for(i = 0; i < 10; i++) + for(j = 8; j < 16; j++) { + if(v == 1 || v == 13) + erbuf[u][v] = buf[i][j]; + v += 2; + if(!((v - 1) % 6)) + v += 6; + if(v >= 28) { + u++; + v = 1; + } + } + + /* Close srcdsets and srcfile if config option specified */ + if(config & TEST_IO_CLOSE_SRC) { + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if(H5Dclose(srcdset[1]) < 0) + TEST_ERROR + srcdset[1] = -1; + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } + + /* Reopen virtual dataset and file if config option specified */ + if(config & TEST_IO_REOPEN_VIRT) { + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + TEST_ERROR + } + + /* Select hyperslab in memory */ + start[0] = 0; + start[1] = 0; + stride[0] = 1; + stride[1] = 6; + count[0] = 1; + count[1] = 4; + block[0] = 10; + block[1] = 2; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0) + TEST_ERROR + + /* Select hyperslab in file */ + start[0] = 0; + start[1] = 0; + start[2] = 0; + count[0] = 10; + count[1] = 4; + count[2] = 2; + if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Read data through virtual dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0) + TEST_ERROR + + /* Verify read data */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if(rbuf[i][j] != erbuf[i][j]) + TEST_ERROR + + /* Close */ + if(!(config & TEST_IO_CLOSE_SRC)) { + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if(H5Dclose(srcdset[1]) < 0) + TEST_ERROR + srcdset[1] = -1; + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if(H5Sclose(srcspace[0]) < 0) + TEST_ERROR + srcspace[0] = -1; + if(H5Sclose(vspace[0]) < 0) + TEST_ERROR + vspace[0] = -1; + if(H5Sclose(vspace[1]) < 0) + TEST_ERROR + vspace[1] = -1; + if(H5Sclose(memspace) < 0) + TEST_ERROR + memspace = -1; + + /* Close */ if(H5Pclose(dcpl) < 0) TEST_ERROR -- cgit v0.12 From 988d6d0844943c1032a6948ed5a0aa678a0db528 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Fri, 31 May 2019 19:32:35 -0500 Subject: Refactor H5S__hyper_project_intersection to operate directly on span trees, improving performance and removing the conditionn that the extents be equal. --- release_docs/RELEASE.txt | 8 + src/H5Dvirtual.c | 7 + src/H5Shyper.c | 1051 +++++++++++++++++++++++++++++++--------------- src/H5Sselect.c | 11 +- test/vds.c | 720 ++++++++++++++++++++++++++++++- 5 files changed, 1457 insertions(+), 340 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 6d1c8b2..649ae24 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -130,6 +130,14 @@ New Features Library: -------- + - Improved the performance of virtual dataset I/O + + Refactored the internal dataspace routines used by the virtual dataset + code to improve performance, especially when one of the selections + involved is very long and non-contiguous. + + (NAF - 2019/05/31, HDFFV-10693) + - Allow pre-generated H5Tinit.c and H5make_libsettings.c to be used. Rather than always running H5detect and generating H5Tinit.c and diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index e3e0aa5..53640e7 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -35,6 +35,13 @@ * until the virtual dataset is closed. */ +/* + * Note: H5S_select_project_intersection has been updated to no longer require + * that the source and source intersect spaces have the same extent. This file + * should therefore be updated to remove code that ensures this condition, which + * should improve both maintainability and performance. + */ + /****************/ /* Module Setup */ /****************/ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index c2cdf2b..00cb7e9 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -44,25 +44,13 @@ /* Macro for checking if two ranges overlap one another */ /* - * Three possible conditions for overlapping: - * 1. The lower bound of range #1 is between the lower and - * higher bounds of range #2. In other words, the low - * part of range #1 will at least overlap with range #2. - * 2. The higher bound of range #1 is between the lower and - * higher bounds of range #2. In other words, the upper - * part of range #1 will at least overlap with range #2. - * 3. Range #1 includes range #2, i.e. the lower bound - * is smaller than that of range #2 and the higher bound - * is larger than that of range #2. + * Check for the inverse of whether the ranges are disjoint. If they are + * disjoint, then the low bound of one of the ranges must be greater than the + * high bound of the other. */ /* (Assumes that low & high bounds are _inclusive_) */ #define H5S_RANGE_OVERLAP(L1, H1, L2, H2) \ - /* condition 1 */ \ - (((L1) >= (L2) && (L1) <= (H2)) || \ - /* condition 2 */ \ - ((H1) >= (L2) && (H1) <= (H2)) || \ - /* condition 3 */ \ - ((L1) <= (L2) && (H1) >= (H2))) + !((L1) > (H2) || (L2) > (H1)) /* Flags for which hyperslab fragments to compute */ #define H5S_HYPER_COMPUTE_B_NOT_A 0x01 @@ -84,6 +72,18 @@ (curr_span) = saved_next_span; \ } while(0) +/* Macro to add "skipped" elements to projection during the execution of + * H5S__hyper_project_intersect() */ +#define H5S_HYPER_PROJ_INT_ADD_SKIP(UDATA, ADD, ERR) \ + do { \ + /* If there are any elements to add, we must add them \ + * to the projection first before adding skip */ \ + if((UDATA)->nelem > 0) \ + if(H5S__hyper_proj_int_build_proj(UDATA) < 0) \ + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, ERR, "can't add elements to projected selection") \ + (UDATA)->skip += (ADD); \ + } while(0) /* end H5S_HYPER_PROJ_INT_ADD_SKIP() */ + /******************/ /* Local Typedefs */ @@ -93,6 +93,28 @@ /* (Makes it easier to understand the alloc / free calls) */ typedef hsize_t hbounds_t; +/* Struct for holding persistent information during iteration for + * H5S__hyper_project_intersect() */ +typedef struct { + const H5S_hyper_span_t *ds_span[H5S_MAX_RANK]; /* Array of the current spans in the destination space in each dimension */ + hsize_t ds_low[H5S_MAX_RANK]; /* Array of current low bounds (of iteration) for each element in ds_span */ + H5S_hyper_span_info_t *ps_span_info[H5S_MAX_RANK]; /* Array of span info structs for projected space during iteration */ + uint32_t ps_clean_bitmap; /* Bitmap of whether the nth rank has a clean projected space since the last time it was set to 1 */ + unsigned ss_rank; /* Rank of source space */ + unsigned ds_rank; /* Rank of destination space */ + unsigned depth; /* Current depth of iterator in destination space */ + hsize_t skip; /* Number of elements to skip in projected space */ + hsize_t nelem; /* Number of elements to add to projected space (after skip) */ + uint64_t op_gen; /* Operation generation for counting elements */ +} H5S_hyper_project_intersect_ud_t; + +/* Assert that H5S_MAX_RANK is <= 32 so our trick with using a 32 bit bitmap + * (ps_clean_bitmap) works. If H5S_MAX_RANK increases either increase the size + * of ps_clean_bitmap or change the algorithm to use an array. */ +#if H5S_MAX_RANK > 32 +#error H5S_MAX_RANK too small for ps_clean_bitmap field in H5S_hyper_project_intersect_ud_t struct +#endif + /********************/ /* Local Prototypes */ @@ -119,6 +141,8 @@ static herr_t H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, unsigned ndims, H5S_hyper_span_info_t **a_not_b, H5S_hyper_span_info_t **a_and_b, H5S_hyper_span_info_t **b_not_a); static herr_t H5S__hyper_merge_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans); +static hsize_t H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, + uint64_t op_gen); static hsize_t H5S__hyper_spans_nelem(H5S_hyper_span_info_t *spans); static herr_t H5S__hyper_add_disjoint_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans); static H5S_hyper_span_info_t *H5S__hyper_make_spans(unsigned rank, @@ -147,6 +171,10 @@ static herr_t H5S__hyper_iter_get_seq_list_opt(H5S_sel_iter_t *iter, size_t maxs size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len); static herr_t H5S__hyper_iter_get_seq_list_single(H5S_sel_iter_t *iter, size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len); +static herr_t H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata); +static herr_t H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info, + const H5S_hyper_span_info_t *sis_span_info, hsize_t count, unsigned depth, + H5S_hyper_project_intersect_ud_t *udata); static void H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count, hsize_t *block, hsize_t clip_size); static hsize_t H5S__hyper_get_clip_extent_real(const H5S_t *clip_space, @@ -10442,6 +10470,577 @@ done: /*-------------------------------------------------------------------------- NAME + H5S__hyper_proj_int_build_proj + PURPOSE + Secondary iteration routine for H5S__hyper_project_intersection + USAGE + herr_t H5S__hyper_proj_int_build_proj(udata) + H5S_hyper_project_intersect_ud_t *udata; IN/OUT: Persistent shared data for iteration + RETURNS + Non-negative on success/Negative on failure. + DESCRIPTION + Takes the skip and nelem amounts listed in udata and converts them to + span trees in the projected space, using the destination space. This + is a non-recursive algorithm by necessity, it saves the current state + of iteration in udata and resumes in the same location on subsequent + calls. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) { + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + HDassert(udata->nelem > 0); + + /* + * Skip over skipped elements + */ + if(udata->skip > 0) { + /* Work upwards, finishing each span tree before moving up */ + HDassert(udata->ds_span[udata->depth]); + do { + /* Check for lowest dimension */ + if(udata->ds_span[udata->depth]->down) { + if(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high) { + /* If we will run out of elements to skip in this span, + * advance to the first not fully skipped span and break + * out of this loop (start moving downwards) */ + if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen) + * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { + udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->u.nelmts; + udata->skip %= udata->ds_span[udata->depth]->down->u.nelmts; + break; + } /* end if */ + + /* Skip over this entire span */ + udata->skip -= udata->ds_span[udata->depth]->down->u.nelmts + * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1); + } /* end if */ + } /* end if */ + else { + HDassert(udata->ds_rank - udata->depth == 1); + + /* If we will run out of elements to skip in this span, + * skip the remainder of the skipped elements and break out */ + HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high); + if(udata->skip < (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { + udata->ds_low[udata->depth] += udata->skip; + udata->skip = 0; + break; + } /* end if */ + + /* Skip over this entire span */ + udata->skip -= udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1; + } /* end else */ + + /* Advance to next span */ + udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next; + if(udata->ds_span[udata->depth]) + udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; + else if(udata->depth > 0) { + /* If present, append this span tree to the higher dimension's, + * and release ownership of it */ + if(udata->ps_span_info[udata->depth]) { + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth - 1], + udata->ds_rank - udata->depth + 1, udata->ds_low[udata->depth - 1], + udata->ds_low[udata->depth - 1], + udata->ps_span_info[udata->depth]) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + H5S__hyper_free_span_info(udata->ps_span_info[udata->depth]); + udata->ps_span_info[udata->depth] = NULL; + } /* end if */ + + /* Ran out of spans, move up one dimension */ + udata->depth--; + HDassert(udata->ds_span[udata->depth]); + udata->ds_low[udata->depth]++; + } /* end if */ + else + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "insufficient elements in destination selection") + } while((udata->skip > 0) + || (udata->ds_low[udata->depth] > udata->ds_span[udata->depth]->high)); + + /* Work downwards until skip is 0 */ + HDassert(udata->ds_span[udata->depth]); + while(udata->skip > 0) { + HDassert(udata->ds_span[udata->depth]->down); + udata->depth++; + udata->ds_span[udata->depth] = udata->ds_span[udata->depth - 1]->down->head; + udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; + if(udata->ds_span[udata->depth]->down) { + do { + /* If we will run out of elements to skip in this span, + * advance to the first not fully skipped span and + * continue down */ + if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen) + * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { + udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->u.nelmts; + udata->skip %= udata->ds_span[udata->depth]->down->u.nelmts; + break; + } /* end if */ + + /* Skip over this entire span */ + udata->skip -= udata->ds_span[udata->depth]->down->u.nelmts + * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1); + + /* Advance to next span */ + udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next; + HDassert(udata->ds_span[udata->depth]); + udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; + } while(udata->skip > 0); + } /* end if */ + else { + do { + /* If we will run out of elements to skip in this span, + * skip the remainder of the skipped elements */ + if(udata->skip < (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { + udata->ds_low[udata->depth] += udata->skip; + udata->skip = 0; + break; + } /* end if */ + + /* Skip over this entire span */ + udata->skip -= udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1; + + /* Advance to next span */ + udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next; + HDassert(udata->ds_span[udata->depth]); + udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; + } while(udata->skip > 0); + } /* end else */ + } /* end while */ + } /* end if */ + + /* + * Add requested number of elements to projected space + */ + /* Work upwards, adding all elements of each span tree until it can't fit + * all elements */ + HDassert(udata->ds_span[udata->depth]); + do { + /* Check for lowest dimension */ + if(udata->ds_span[udata->depth]->down) { + if(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high) { + /* If we will run out of elements to add in this span, add + * any complete spans, advance to the first not fully added + * span, and break out of this loop (start moving downwards) + */ + if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen) + * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { + if(udata->nelem >= udata->ds_span[udata->depth]->down->u.nelmts) { + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], + udata->ds_rank - udata->depth, udata->ds_low[udata->depth], + udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts) - 1, + udata->ds_span[udata->depth]->down) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts; + udata->nelem %= udata->ds_span[udata->depth]->down->u.nelmts; + } /* end if */ + break; + } /* end if */ + + /* Append span tree for entire span */ + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], + udata->ds_rank - udata->depth, udata->ds_low[udata->depth], + udata->ds_span[udata->depth]->high, + udata->ds_span[udata->depth]->down) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + udata->nelem -= udata->ds_span[udata->depth]->down->u.nelmts + * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1); + } /* end if */ + } /* end if */ + else { + HDassert(udata->ds_rank - udata->depth == 1); + + /* If we will run out of elements to add in this span, add the + * remainder of the elements and break out */ + HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high); + if(udata->nelem < (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], 1, + udata->ds_low[udata->depth], udata->ds_low[udata->depth] + udata->nelem - 1, NULL) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + udata->ds_low[udata->depth] += udata->nelem; + udata->nelem = 0; + break; + } /* end if */ + + /* Append span tree for entire span */ + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], 1, + udata->ds_low[udata->depth], udata->ds_span[udata->depth]->high, NULL) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + udata->nelem -= udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1; + } /* end else */ + + /* Advance to next span */ + udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next; + if(udata->ds_span[udata->depth]) + udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; + else if(udata->depth > 0) { + /* Append this span tree to the higher dimension's, and release + * ownership of it */ + HDassert(udata->ps_span_info[udata->depth]); + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth - 1], + udata->ds_rank - udata->depth + 1, udata->ds_low[udata->depth - 1], + udata->ds_low[udata->depth - 1], + udata->ps_span_info[udata->depth]) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + H5S__hyper_free_span_info(udata->ps_span_info[udata->depth]); + udata->ps_span_info[udata->depth] = NULL; + + /* Ran out of spans, move up one dimension */ + udata->depth--; + HDassert(udata->ds_span[udata->depth]); + udata->ds_low[udata->depth]++; + } /* end if */ + else { + /* We have finished the entire destination span tree. If there are + * still elements to add, issue an error. */ + if(udata->nelem > 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "insufficient elements in destination selection") + break; + } /* end else */ + } while((udata->nelem > 0) + || (udata->ds_low[udata->depth] > udata->ds_span[udata->depth]->high)); + + /* Work downwards until nelem is 0 */ + HDassert(udata->ds_span[udata->depth] || (udata->nelem == 0)); + while(udata->nelem > 0) { + HDassert(udata->ds_span[udata->depth]->down); + udata->depth++; + udata->ds_span[udata->depth] = udata->ds_span[udata->depth - 1]->down->head; + udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; + if(udata->ds_span[udata->depth]->down) { + do { + /* If we will run out of elements to add in this span, add + * any complete spans, advance to the first not fully added + * span and continue down + */ + HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high); + if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen) + * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { + if(udata->nelem >= udata->ds_span[udata->depth]->down->u.nelmts) { + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], + udata->ds_rank - udata->depth, udata->ds_low[udata->depth], + udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts) - 1, + udata->ds_span[udata->depth]->down) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts; + udata->nelem %= udata->ds_span[udata->depth]->down->u.nelmts; + } /* end if */ + break; + } /* end if */ + + /* Append span tree for entire span */ + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], + udata->ds_rank - udata->depth, udata->ds_low[udata->depth], + udata->ds_span[udata->depth]->high, + udata->ds_span[udata->depth]->down) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + udata->nelem -= udata->ds_span[udata->depth]->down->u.nelmts + * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1); + + /* Advance to next span */ + udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next; + HDassert(udata->ds_span[udata->depth]); + udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; + } while(udata->nelem > 0); + } /* end if */ + else { + HDassert(udata->ds_rank - udata->depth == 1); + do { + /* If we will run out of elements to add in this span, add + * the remainder of the elements and break out */ + HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high); + if(udata->nelem < (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], 1, + udata->ds_low[udata->depth], udata->ds_low[udata->depth] + udata->nelem - 1, NULL) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + udata->ds_low[udata->depth] += udata->nelem; + udata->nelem = 0; + break; + } /* end if */ + + /* Append span tree for entire span */ + if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth], 1, + udata->ds_low[udata->depth], udata->ds_span[udata->depth]->high, NULL) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + udata->nelem -= udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1; + + /* Advance to next span */ + udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next; + HDassert(udata->ds_span[udata->depth]); + udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; + } while(udata->nelem > 0); + } /* end else */ + } /* end while */ + + HDassert(udata->skip == 0); + HDassert(udata->nelem == 0); + + /* Mark projected space as changed (for all ranks) */ + udata->ps_clean_bitmap = 0; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5S__hyper_proj_int_build_proj() */ + + +/*-------------------------------------------------------------------------- + NAME + H5S__hyper_proj_int_iterate + PURPOSE + Main iteration routine for H5S__hyper_project_intersection + USAGE + herr_t H5S__hyper_proj_int_iterate(ss_span_info,sis_span_info,count,depth,udata) + const H5S_hyper_span_info_t *ss_span_info; IN: Span tree for source selection + const H5S_hyper_span_info_t *sis_span_info; IN: Span tree for source intersect selection + hsize_t count; IN: Number of times to compute the intersection of ss_span_info and sis_span_info + unsigned depth; IN: Depth of iteration (in terms of rank) + H5S_hyper_project_intersect_ud_t *udata; IN/OUT: Persistent shared data for iteration + RETURNS + Non-negative on success/Negative on failure. + DESCRIPTION + Computes the intersection of ss_span_info and sis_span_info and projects it + to the projected space (held in udata). It accomplishes this by iterating + over both spaces and computing the number of elements to skip (in + ss_span_info) and the number of elements to add (the intersection) in a + sequential fashion (similar to run length encoding). As necessary, this + function both recurses into lower dimensions and calls + H5S__hyper_proj_int_build_proj to convert the skip/nelem pairs to the + projected span tree. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info, + const H5S_hyper_span_info_t *sis_span_info, hsize_t count, unsigned depth, + H5S_hyper_project_intersect_ud_t *udata) +{ + const H5S_hyper_span_t *ss_span; /* Current span in source space */ + const H5S_hyper_span_t *sis_span; /* Current span in source intersect space */ + hsize_t ss_low; /* Current low bounds of source span */ + hsize_t sis_low; /* Current low bounds of source intersect span */ + hsize_t high; /* High bounds of current intersection */ + hsize_t low; /* Low bounds of current intersection */ + hsize_t old_skip; /* Value of udata->skip before main loop */ + hsize_t old_nelem; /* Value of udata->nelem before main loop */ + hbool_t check_intersect; /* Whether to check for intersecting elements */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check for non-overlapping bounds */ + check_intersect = TRUE; + for(u = 0; u < (udata->ss_rank - depth); u++) + if(!H5S_RANGE_OVERLAP(ss_span_info->low_bounds[u], + ss_span_info->high_bounds[u], + sis_span_info->low_bounds[u], + sis_span_info->high_bounds[u])) { + check_intersect = FALSE; + break; + } /* end if */ + + /* Only enter main loop if there's something to do */ + if(check_intersect) { + /* Set ps_clean_bitmap */ + udata->ps_clean_bitmap |= (((uint32_t)1) << depth); + + /* Save old skip and nelem */ + old_skip = udata->skip; + old_nelem = udata->nelem; + + /* Intersect spaces once per count */ + for(u = 0; u < count; u++) { + ss_span = ss_span_info->head; + sis_span = sis_span_info->head; + HDassert(ss_span && sis_span); + ss_low = ss_span->low; + sis_low = sis_span->low; + + /* Main loop */ + do { + /* Check if spans overlap */ + if(H5S_RANGE_OVERLAP(ss_low, ss_span->high, + sis_low, sis_span->high)) { + high = MIN(ss_span->high, sis_span->high); + if(ss_span->down) { + /* Add skipped elements if there's a pre-gap */ + if(ss_low < sis_low) { + low = sis_low; + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (sis_low - ss_low), FAIL); + } /* end if */ + else + low = ss_low; + + /* Recurse into next dimension down */ + if(H5S__hyper_proj_int_iterate(ss_span->down, sis_span->down, high - low + 1, depth + 1, udata) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't iterate over source selections") + } /* end if */ + else { + HDassert(depth == udata->ss_rank - 1); + + /* Add skipped elements if there's a pre-gap */ + if(ss_low < sis_low) { + low = sis_low; + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, sis_low - ss_low, FAIL); + } /* end if */ + else + low = ss_span->low; + + /* Add overlapping elements */ + udata->nelem += high - low + 1; + } /* end else */ + + /* Advance spans */ + if(ss_span->high == sis_span->high) { + /* Advance both spans */ + ss_span = ss_span->next; + if(ss_span) + ss_low = ss_span->low; + sis_span = sis_span->next; + if(sis_span) + sis_low = sis_span->low; + } /* end if */ + else if(ss_span->high == high) { + /* Advance source span */ + HDassert(ss_span->high < sis_span->high); + sis_low = high + 1; + ss_span = ss_span->next; + if(ss_span) + ss_low = ss_span->low; + } /* end if */ + else { + /* Advance source intersect span */ + HDassert(ss_span->high > sis_span->high); + ss_low = high + 1; + sis_span = sis_span->next; + if(sis_span) + sis_low = sis_span->low; + } /* end else */ + } /* end if */ + else { + /* Advance spans */ + if(ss_span->high < sis_low) { + /* Add skipped elements */ + if(ss_span->down) + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL); + else + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, ss_span->high - ss_low + 1, FAIL); + + /* Advance source span */ + ss_span = ss_span->next; + if(ss_span) + ss_low = ss_span->low; + } /* end if */ + else { + /* Advance source intersect span */ + HDassert(ss_low > sis_span->high); + sis_span = sis_span->next; + if(sis_span) + sis_low = sis_span->low; + } /* end else */ + } /* end else */ + } while(ss_span && sis_span); + + if(ss_span && !((depth == 0) && (u == count - 1))) { + /* Count remaining elements in ss_span_info */ + if(ss_span->down) + do { + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL); + ss_span = ss_span->next; + if(ss_span) + ss_low = ss_span->low; + } while(ss_span); + else + do { + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, ss_span->high - ss_low + 1, FAIL); + ss_span = ss_span->next; + if(ss_span) + ss_low = ss_span->low; + } while(ss_span); + } /* end if */ + + /* Check if the projected space was not changed since we started the + * first iteration of the loop, if so we do not need to continue + * looping and can just copy the result */ + if(udata->ps_clean_bitmap & (((uint32_t)1) << depth)) { + HDassert(u == 0); + if(udata->skip == old_skip) { + /* First case: algorithm added only elements */ + HDassert(udata->nelem >= old_nelem); + udata->nelem += (count - 1) * (udata->nelem - old_nelem); + } /* end if */ + else if(udata->nelem == 0) { + /* Second case: algorithm added only skip. In this case, + * nelem must be 0 since otherwise adding skip would have + * triggered a change in the projected space */ + HDassert(old_nelem == 0); + HDassert(udata->skip > old_skip); + udata->skip += (count - 1) * (udata->skip - old_skip); + } /* end if */ + else { + /* Third case: agorithm added skip and nelem (in that + * order). Add the same skip and nelem once for each item + * remaining in count. */ + hsize_t skip_add; + hsize_t nelem_add; + + HDassert(udata->nelem > 0); + HDassert(udata->skip > old_skip); + HDassert(old_nelem == 0); + + skip_add = udata->skip - old_skip; + nelem_add = udata->nelem - old_nelem; + for(u = 1; u < count; u++) { + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, skip_add, FAIL); + udata->nelem += nelem_add; + } /* end for */ + } /* end else */ + + /* End loop since we already took care of it */ + break; + } /* end if */ + } /* end for */ + } /* end if */ + else if(depth > 0) + /* Just count skipped elements */ + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper((H5S_hyper_span_info_t *)ss_span_info, udata->op_gen) * count, FAIL); /* Casting away const OK -NAF */ + + /* Clean up if we are done */ + if(depth == 0) { + /* Add remaining elements */ + if(udata->nelem > 0) + if(H5S__hyper_proj_int_build_proj(udata) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't add elements to projected selection") + + /* Append remaining span trees */ + for(u = udata->ds_rank - 1; u > 0; u--) + if(udata->ps_span_info[u]) { + if(H5S__hyper_append_span(&udata->ps_span_info[u - 1], + udata->ds_rank - u + 1, udata->ds_low[u - 1], + udata->ds_low[u - 1], + udata->ps_span_info[u]) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + H5S__hyper_free_span_info(udata->ps_span_info[u]); + udata->ps_span_info[u] = NULL; + } /* end if */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5S__hyper_proj_int_iterate() */ + + +/*-------------------------------------------------------------------------- + NAME H5S__hyper_project_intersection PURPOSE Projects the intersection of of the selections of src_space and @@ -10461,7 +11060,9 @@ done: within the selection of dst_space. The result is placed in the selection of proj_space. Note src_space, dst_space, and src_intersect_space do not need to use hyperslab selections, but they cannot use point selections. - The result is always a hyperslab selection. + The result is always a hyperslab or none selection. Note also that + proj_space can share some span trees with dst_space, so proj_space + must not be subsequently modified if dst_space must be preserved. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES @@ -10471,43 +11072,11 @@ herr_t H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, const H5S_t *src_intersect_space, H5S_t *proj_space) { - hsize_t ss_off[H5S_PROJECT_INTERSECT_NSEQS]; /* Offset array for src_space */ - size_t ss_len[H5S_PROJECT_INTERSECT_NSEQS]; /* Length array for src_space */ - size_t ss_nseq; /* Number of sequences for src_space */ - size_t ss_nelem; /* Number of elements for src_space */ - size_t ss_i = (size_t)0; /* Index into offset/length arrays for src_space */ - hbool_t advance_ss = FALSE; /* Whether to advance ss_i on the next iteration */ - H5S_sel_iter_t *ss_iter = NULL; /* Selection iterator for src_space */ - hbool_t ss_iter_init = FALSE; /* Whether ss_iter is initialized */ - hsize_t ss_sel_off = (hsize_t)0; /* Offset within src_space selection */ - hsize_t ds_off[H5S_PROJECT_INTERSECT_NSEQS]; /* Offset array for dst_space */ - size_t ds_len[H5S_PROJECT_INTERSECT_NSEQS]; /* Length array for dst_space */ - size_t ds_nseq; /* Number of sequences for dst_space */ - size_t ds_nelem; /* Number of elements for dst_space */ - size_t ds_i = (size_t)0; /* Index into offset/length arrays for dst_space */ - H5S_sel_iter_t *ds_iter = NULL; /* Selection iterator for dst_space */ - hbool_t ds_iter_init = FALSE; /* Whether ds_iter is initialized */ - hsize_t ds_sel_off = (hsize_t)0; /* Offset within dst_space selection */ - hsize_t sis_off[H5S_PROJECT_INTERSECT_NSEQS]; /* Offset array for src_intersect_space */ - size_t sis_len[H5S_PROJECT_INTERSECT_NSEQS]; /* Length array for src_intersect_space */ - size_t sis_nseq; /* Number of sequences for src_intersect_space */ - size_t sis_nelem; /* Number of elements for src_intersect_space */ - size_t sis_i = (size_t)0; /* Index into offset/length arrays for src_intersect_space */ - hbool_t advance_sis = FALSE; /* Whether to advance sis_i on the next iteration */ - H5S_sel_iter_t *sis_iter = NULL; /* Selection iterator for src_intersect_space */ - hbool_t sis_iter_init = FALSE; /* Whether sis_iter is initialized */ - hsize_t int_sel_off; /* Offset within intersected selections (ss/sis and ds/ps) */ - size_t int_len; /* Length of segment in intersected selections */ - hsize_t proj_off; /* Segment offset in proj_space */ - size_t proj_len; /* Segment length in proj_space */ - size_t proj_len_rem; /* Remaining length in proj_space for segment */ - hsize_t proj_down_dims[H5S_MAX_RANK]; /* "Down" dimensions in proj_space */ - H5S_hyper_span_info_t *curr_span_tree[H5S_MAX_RANK]; /* Current span tree being built (in each dimension) */ - hsize_t curr_span_up_dim[H5S_MAX_RANK]; /* "Up" dimensions for current span */ - unsigned proj_rank; /* Rank of proj_space */ - hsize_t low; /* Low value of span */ - size_t nelem; /* Number of elements returned for get_seq_list op */ - unsigned u; /* Local index variable */ + H5S_hyper_project_intersect_ud_t udata; /* User data for subroutines */ + const H5S_hyper_span_info_t *ss_span_info; + const H5S_hyper_span_info_t *ds_span_info; + H5S_hyper_span_info_t *ss_span_info_buf = NULL; + H5S_hyper_span_info_t *ds_span_info_buf = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -10521,280 +11090,88 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, /* Assert that src_space and src_intersect_space have same extent and there * are no point selections */ HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space)); - HDassert(!HDmemcmp(src_space->extent.size, src_intersect_space->extent.size, - (size_t)H5S_GET_EXTENT_NDIMS(src_space) * sizeof(src_space->extent.size[0]))); + HDassert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space)); HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_POINTS); HDassert(H5S_GET_SELECT_TYPE(dst_space) != H5S_SEL_POINTS); - HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) != H5S_SEL_POINTS); - - /* Initialize prev_space, curr_span_tree, and curr_span_up_dim */ - HDmemset(curr_span_tree, 0, sizeof(curr_span_tree)); - HDmemset(curr_span_up_dim, 0, sizeof(curr_span_up_dim)); + HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_HYPERSLABS); - /* Save rank of projected space */ - proj_rank = proj_space->extent.rank; - HDassert(proj_rank > 0); + /* Set up ss_span_info */ + if(H5S_GET_SELECT_TYPE(src_space) == H5S_SEL_HYPERSLABS) { + /* Make certain the selection has a span tree */ + if(NULL == src_space->select.sel_info.hslab->span_lst) + if(H5S__hyper_generate_spans((H5S_t *)src_space) < 0) /* Casting away const OK -NAF */ + HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "can't construct span tree for source hyperslab selection") - /* Get numbers of elements */ - ss_nelem = (size_t)H5S_GET_SELECT_NPOINTS(src_space); - ds_nelem = (size_t)H5S_GET_SELECT_NPOINTS(dst_space); - sis_nelem = (size_t)H5S_GET_SELECT_NPOINTS(src_intersect_space); - HDassert(ss_nelem == ds_nelem); - - /* Calculate proj_down_dims */ - if(H5VM_array_down(proj_rank, proj_space->extent.size, proj_down_dims) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value") - - /* Remove current selection from proj_space */ - if(H5S_SELECT_RELEASE(proj_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection") - - /* If any selections are empty, skip to the end so "none" is selected */ - if((ss_nelem == 0) || (ds_nelem == 0) || (sis_nelem == 0)) - goto loop_end; - - /* Allocate space for the hyperslab selection information (note this sets - * diminfo_valid to FALSE, diminfo arrays to 0, and span list to NULL) */ - if(NULL == (proj_space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info") - - /* Set selection type */ - proj_space->select.type = H5S_sel_hyper; - - /* Set unlim_dim */ - proj_space->select.sel_info.hslab->unlim_dim = -1; - - /* Allocate the source selection iterator */ - if(NULL == (ss_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate source selection iterator") - - /* Initialize source space iterator */ - if(H5S_select_iter_init(ss_iter, src_space, (size_t)1, 0) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") - ss_iter_init = TRUE; - - /* Get sequence list for source space */ - if(H5S_SELECT_ITER_GET_SEQ_LIST(ss_iter, H5S_PROJECT_INTERSECT_NSEQS, ss_nelem, &ss_nseq, &nelem, ss_off, ss_len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") - ss_nelem -= nelem; - HDassert(ss_nseq > 0); - - /* Allocate the destination selection iterator */ - if(NULL == (ds_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate destination selection iterator") - - /* Initialize destination space iterator */ - if(H5S_select_iter_init(ds_iter, dst_space, (size_t)1, 0) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") - ds_iter_init = TRUE; - - /* Get sequence list for destination space */ - if(H5S_SELECT_ITER_GET_SEQ_LIST(ds_iter, H5S_PROJECT_INTERSECT_NSEQS, ds_nelem, &ds_nseq, &nelem, ds_off, ds_len) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") - ds_nelem -= nelem; - HDassert(ds_nseq > 0); - - /* Allocate the source intersect space iterator */ - if(NULL == (sis_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate source intersect space iterator") - - /* Initialize source intersect space iterator */ - if(H5S_select_iter_init(sis_iter, src_intersect_space, (size_t)1, 0) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") - sis_iter_init = TRUE; - - /* Get sequence list for source intersect space */ - if(H5S_SELECT_ITER_GET_SEQ_LIST(sis_iter, H5S_PROJECT_INTERSECT_NSEQS, sis_nelem, &sis_nseq, &nelem, sis_off, sis_len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") - sis_nelem -= nelem; - HDassert(sis_nseq > 0); - - /* Loop until we run out of sequences in either the source or source - * intersect space */ - while(1) { - while(advance_ss || (ss_off[ss_i] + ss_len[ss_i] <= sis_off[sis_i])) { - /* Either we finished the current source sequence or the - * sequences do not intersect. Advance source space. */ - ss_sel_off += (hsize_t)ss_len[ss_i]; - if(++ss_i == ss_nseq) { - if(ss_nelem > 0) { - /* Try to grab more sequences from src_space */ - if(H5S_SELECT_ITER_GET_SEQ_LIST(ss_iter, H5S_PROJECT_INTERSECT_NSEQS, ss_nelem, &ss_nseq, &nelem, ss_off, ss_len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") - HDassert(ss_len[0] > 0); - - /* Update ss_nelem */ - HDassert(nelem > 0); - HDassert(nelem <= ss_nelem); - ss_nelem -= nelem; - - /* Reset source space index */ - ss_i = 0; - } /* end if */ - else - /* There are no more sequences in src_space, so we can exit - * the loop. Use goto instead of break so we exit the outer - * loop. */ - goto loop_end; - } /* end if */ + /* Simply point to existing span tree */ + ss_span_info = src_space->select.sel_info.hslab->span_lst; + } /* end if */ + else { + /* Create temporary span tree from all selection */ + HDassert(H5S_GET_SELECT_TYPE(src_space) == H5S_SEL_ALL); - /* Reset advance_ss */ - advance_ss = FALSE; - } /* end while */ - if(advance_sis || (sis_off[sis_i] + sis_len[sis_i] <= ss_off[ss_i])) { - do { - /* Either we finished the current source intersect sequence or - * the sequences do not intersect. Advance source intersect - * space. */ - if(++sis_i == sis_nseq) { - if(sis_nelem > 0) { - /* Try to grab more sequences from src_intersect_space - */ - if(H5S_SELECT_ITER_GET_SEQ_LIST(sis_iter, H5S_PROJECT_INTERSECT_NSEQS, sis_nelem, &sis_nseq, &nelem, sis_off, sis_len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") - HDassert(sis_len[0] > 0); + if(NULL == (ss_span_info_buf = H5S__hyper_make_spans(H5S_GET_EXTENT_NDIMS(src_space), + H5S_hyper_zeros_g, H5S_hyper_zeros_g, H5S_hyper_ones_g, src_space->extent.size))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't create span tree for ALL source space") + ss_span_info = ss_span_info_buf; + } /* end else */ - /* Update ss_nelem */ - HDassert(nelem > 0); - HDassert(nelem <= sis_nelem); - sis_nelem -= nelem; + /* Set up ds_span_info */ + if(H5S_GET_SELECT_TYPE(dst_space) == H5S_SEL_HYPERSLABS) { + /* Make certain the selection has a span tree */ + if(NULL == dst_space->select.sel_info.hslab->span_lst) + if(H5S__hyper_generate_spans((H5S_t *)dst_space) < 0) /* Casting away const OK -NAF */ + HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "can't construct span tree for dsetination hyperslab selection") - /* Reset source space index */ - sis_i = 0; - } /* end if */ - else - /* There are no more sequences in src_intersect_space, - * so we can exit the loop. Use goto instead of break - * so we exit the outer loop. */ - goto loop_end; - } /* end if */ - } while(sis_off[sis_i] + sis_len[sis_i] <= ss_off[ss_i]); - - /* Reset advance_sis */ - advance_sis = FALSE; - } /* end if */ - else { - /* Sequences intersect, add intersection to projected space */ - /* Calculate intersection sequence in terms of offset within source - * selection and advance any sequences we complete */ - if(ss_off[ss_i] >= sis_off[sis_i]) - int_sel_off = ss_sel_off; - else - int_sel_off = sis_off[sis_i] - ss_off[ss_i] + ss_sel_off; - if((ss_off[ss_i] + (hsize_t)ss_len[ss_i]) <= (sis_off[sis_i] - + (hsize_t)sis_len[sis_i])) { - int_len = (size_t)((hsize_t)ss_len[ss_i] + ss_sel_off - int_sel_off); - advance_ss = TRUE; - } /* end if */ - else - int_len = (size_t)(sis_off[sis_i] + (hsize_t)sis_len[sis_i] - ss_off[ss_i] + ss_sel_off - int_sel_off); - if((ss_off[ss_i] + (hsize_t)ss_len[ss_i]) >= (sis_off[sis_i] - + (hsize_t)sis_len[sis_i])) - advance_sis = TRUE; - - /* Project intersection sequence to destination selection */ - while(int_len > (size_t)0) { - while(ds_sel_off + (hsize_t)ds_len[ds_i] <= int_sel_off) { - /* Intersection is not projected to this destination - * sequence, advance destination space */ - ds_sel_off += (hsize_t)ds_len[ds_i]; - if(++ds_i == ds_nseq) { - HDassert(ds_nelem > 0); - - /* Try to grab more sequences from dst_space */ - if(H5S_SELECT_ITER_GET_SEQ_LIST(ds_iter, H5S_PROJECT_INTERSECT_NSEQS, ds_nelem, &ds_nseq, &nelem, ds_off, ds_len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") - HDassert(ds_len[0] > 0); - - /* Update ss_nelem */ - HDassert(nelem > 0); - HDassert(nelem <= ds_nelem); - ds_nelem -= nelem; - - /* Reset source space index */ - ds_i = 0; - } /* end if */ - } /* end while */ + /* Simply point to existing span tree */ + ds_span_info = dst_space->select.sel_info.hslab->span_lst; + } /* end if */ + else { + /* Create temporary span tree from all selection */ + HDassert(H5S_GET_SELECT_TYPE(dst_space) == H5S_SEL_ALL); - /* Add sequence to projected space */ - HDassert(ds_sel_off <= int_sel_off); - proj_off = ds_off[ds_i] + int_sel_off - ds_sel_off; - proj_len = proj_len_rem = (size_t)MIN(int_len, - (size_t)(ds_sel_off + (hsize_t)ds_len[ds_i] - int_sel_off)); - - /* Add to span tree */ - while(proj_len_rem > (size_t)0) { - hsize_t high; /* High value of span */ - size_t span_len; /* Length of span */ - - /* Append spans in higher dimensions if we're going ouside - * the plane of the span currently being built (i.e. it's - * finished being built) */ - /* Check for more than one full row (in every dim) and - * append multiple spans at once? -NAF */ - for(u = proj_rank - 1; ((u > 0) - && ((proj_off / proj_down_dims[u - 1]) - != curr_span_up_dim[u - 1])); u--) { - if(curr_span_tree[u]) { - /* Append complete lower dimension span tree to - * current dimension */ - low = curr_span_up_dim[u - 1] % proj_space->extent.size[u - 1]; - if(H5S__hyper_append_span(&curr_span_tree[u - 1], (proj_rank - u) + 1, low, low, curr_span_tree[u]) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + if(NULL == (ds_span_info_buf = H5S__hyper_make_spans(H5S_GET_EXTENT_NDIMS(dst_space), + H5S_hyper_zeros_g, H5S_hyper_zeros_g, H5S_hyper_ones_g, dst_space->extent.size))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't create span tree for ALL destination space") + ds_span_info = ds_span_info_buf; + } /* end else */ - /* Reset lower dimension's span tree and previous - * span since we just committed it and will start - * over with a new one */ - H5S__hyper_free_span_info(curr_span_tree[u]); - curr_span_tree[u] = NULL; - } /* end if */ + /* Make certain the source intersect selection has a span tree */ + if(NULL == src_intersect_space->select.sel_info.hslab->span_lst) + if(H5S__hyper_generate_spans((H5S_t *)src_intersect_space) < 0) /* Casting away const OK -NAF */ + HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "can't construct span tree for source intersect hyperslab selection") - /* Update curr_span_up_dim */ - curr_span_up_dim[u - 1] = proj_off / proj_down_dims[u - 1]; - } /* end for */ + /* Initialize udata */ + HDmemset(&udata, 0, sizeof(udata)); + udata.ds_span[0] = ds_span_info->head; + udata.ds_low[0] = udata.ds_span[0]->low; + udata.ss_rank = H5S_GET_EXTENT_NDIMS(src_space); + udata.ds_rank = H5S_GET_EXTENT_NDIMS(dst_space); + udata.op_gen = H5S__hyper_get_op_gen(); - /* Compute bounds for new span in lowest dimension */ - low = proj_off % proj_space->extent.size[proj_rank - 1]; - span_len = MIN(proj_len_rem, - (size_t)(proj_space->extent.size[proj_rank - 1] - - low)); - HDassert(proj_len_rem >= span_len); - high = (low + (hsize_t)span_len) - (hsize_t)1; + /* Iterate over selections and build projected span tree */ + if(H5S__hyper_proj_int_iterate(ss_span_info, src_intersect_space->select.sel_info.hslab->span_lst, 1, 0, &udata) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "selection iteration failed") - /* Append span in lowest dimension */ - if(H5S__hyper_append_span(&curr_span_tree[proj_rank - 1], 1, low, high, NULL) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + /* Remove current selection from proj_space */ + if(H5S_SELECT_RELEASE(proj_space) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection") - /* Update remaining offset and length */ - proj_off += (hsize_t)span_len; - proj_len_rem -= span_len; - } /* end while */ + /* Check for elements in projected space */ + if(udata.ps_span_info[0]) { + /* Allocate space for the hyperslab selection information (note this sets + * diminfo_valid to FALSE, diminfo arrays to 0, and span list to NULL) */ + if(NULL == (proj_space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info") - /* Update intersection sequence */ - int_sel_off += (hsize_t)proj_len; - int_len -= proj_len; - } /* end while */ - } /* end else */ - } /* end while */ - -loop_end: - /* Add remaining spans to span tree */ - for(u = proj_rank - 1; u > 0; u--) - if(curr_span_tree[u]) { - /* Append remaining span tree to higher dimension */ - low = curr_span_up_dim[u - 1] % proj_space->extent.size[u - 1]; - if(H5S__hyper_append_span(&curr_span_tree[u - 1], (proj_rank - u) + 1, low, low, curr_span_tree[u]) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + /* Set selection type */ + proj_space->select.type = H5S_sel_hyper; - /* Reset span tree */ - H5S__hyper_free_span_info(curr_span_tree[u]); - curr_span_tree[u] = NULL; - } /* end if */ + /* Set unlim_dim */ + proj_space->select.sel_info.hslab->unlim_dim = -1; - /* Add span tree to proj_space */ - if(curr_span_tree[0]) { - proj_space->select.sel_info.hslab->span_lst = curr_span_tree[0]; - curr_span_tree[0] = NULL; + /* Set span tree */ + proj_space->select.sel_info.hslab->span_lst = udata.ps_span_info[0]; + udata.ps_span_info[0] = NULL; /* Set the number of elements in current selection */ proj_space->select.num_elem = H5S__hyper_spans_nelem(proj_space->select.sel_info.hslab->span_lst); @@ -10810,36 +11187,40 @@ loop_end: HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection") done: - /* Release source selection iterator */ - if(ss_iter_init && H5S_SELECT_ITER_RELEASE(ss_iter) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") - if(ss_iter) - ss_iter = H5FL_FREE(H5S_sel_iter_t, ss_iter); - - /* Release destination selection iterator */ - if(ds_iter_init && H5S_SELECT_ITER_RELEASE(ds_iter) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") - if(ds_iter) - ds_iter = H5FL_FREE(H5S_sel_iter_t, ds_iter); - - /* Release source intersect selection iterator */ - if(sis_iter_init && H5S_SELECT_ITER_RELEASE(sis_iter) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") - if(sis_iter) - sis_iter = H5FL_FREE(H5S_sel_iter_t, sis_iter); + /* Free ss_span_info_buf */ + if(ss_span_info_buf) { + H5S__hyper_free_span_info(ss_span_info_buf); + ss_span_info_buf = NULL; + } /* end if */ + + /* Free ds_span_info_buf */ + if(ds_span_info_buf) { + H5S__hyper_free_span_info(ds_span_info_buf); + ds_span_info_buf = NULL; + } /* end if */ /* Cleanup on error */ if(ret_value < 0) { - /* Remove current selection from proj_space */ - if(H5S_SELECT_RELEASE(proj_space) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection") + unsigned u; /* Free span trees */ - for(u = 0; u < proj_rank; u++) - if(curr_span_tree[u]) - H5S__hyper_free_span_info(curr_span_tree[u]); + for(u = 0; u < udata.ds_rank; u++) + if(udata.ps_span_info[u]) { + H5S__hyper_free_span_info(udata.ps_span_info[u]); + udata.ps_span_info[u] = NULL; + } /* end if */ } /* end if */ +#ifndef NDEBUG + /* Verify there are no more span trees */ + { + unsigned u; + + for(u = 0; u < H5S_MAX_RANK; u++) + HDassert(!udata.ps_span_info[u]); + } /* end block */ +#endif /* NDEBUG */ + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_project_intersection() */ diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 80b5ea1..6983c93 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -2374,10 +2374,11 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, if(H5S_select_copy(new_space, dst_space, FALSE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination space selection") } /* end if */ - /* If any of the spaces are "none", the projection must also be "none" */ - else if((src_intersect_space->select.type->type == H5S_SEL_NONE) - || (src_space->select.type->type == H5S_SEL_NONE) - || (dst_space->select.type->type == H5S_SEL_NONE)) { + /* If any of the selections contain no elements, the projection must be + * "none" */ + else if((H5S_GET_SELECT_NPOINTS(src_intersect_space) == 0) + || (H5S_GET_SELECT_NPOINTS(src_space) == 0) + || (H5S_GET_SELECT_NPOINTS(dst_space) == 0)) { /* Change to "none" selection */ if(H5S_select_none(new_space) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") @@ -2389,6 +2390,8 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "point selections not currently supported") else { HDassert(src_intersect_space->select.type->type == H5S_SEL_HYPERSLABS); + HDassert(src_space->select.type->type != H5S_SEL_NONE); + HDassert(dst_space->select.type->type != H5S_SEL_NONE); /* Intersecting space is hyperslab selection. Call the hyperslab * routine to project to another hyperslab selection. */ diff --git a/test/vds.c b/test/vds.c index c3b6181..af052a8 100644 --- a/test/vds.c +++ b/test/vds.c @@ -1409,7 +1409,7 @@ test_basic_io(unsigned config, hid_t fapl) int erbuf[10][26]; /* Expected read buffer */ int fill = -1; /* Fill value */ herr_t ret; /* Generic return value */ - int i, j; + int i, j, u, v; TESTING("basic virtual dataset I/O") @@ -3498,6 +3498,724 @@ test_basic_io(unsigned config, hid_t fapl) memspace = -1; + /* + * Test 8: For code coverage: Horizontal block virtual mappings, and file + * selection, grid memory selection + */ + /* Clear virtual layout in DCPL */ + if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + TEST_ERROR + + /* Create memory dataspace */ + if((memspace = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Create virtual dataspaces */ + dims[0] = 8; + dims[1] = 15; + if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Create source dataspace */ + dims[0] = 4; + if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Select all in source space (should not be necessary, but just to be sure) + */ + if(H5Sselect_all(srcspace[0]) < 0) + TEST_ERROR + + /* Select hyperslabs in virtual spaces */ + start[0] = 0; + start[1] = 0; + if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + TEST_ERROR + start[0] = 4; + if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + TEST_ERROR + + /* Add virtual layout mappings */ + if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0) + TEST_ERROR + if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0) + TEST_ERROR + + /* Reset dims */ + dims[0] = 10; + dims[1] = 26; + + /* Create virtual file */ + if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + + /* Create source file if requested */ + if(config & TEST_IO_DIFFERENT_FILE) { + if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + } + else { + srcfile[0] = vfile; + if(H5Iinc_ref(srcfile[0]) < 0) + TEST_ERROR + } + + /* Create source datasets */ + if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Create virtual dataset */ + if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Reset erbuf */ + HDmemset(erbuf[0], 0, sizeof(rbuf)); + + /* Populate write buffer */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; + + /* Select hyperslab in memory */ + start[0] = 0; + start[1] = 0; + count[0] = 4; + count[1] = 15; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Write data directly to first source dataset */ + if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Update erbuf */ + u = 0; + v = 0; + for(i = 2; i < 4; i++) + for(j = 0; j < 15; j++) { + erbuf[u][v] = buf[i][j]; + v += 2; + if(v >= 24) { + u += 2; + v = 0; + } + } + + /* Select hyperslab in memory */ + start[0] = 4; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Write data directly to second source dataset */ + if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Update erbuf */ + for(i = 4; i < 6; i++) + for(j = 0; j < 15; j++) { + erbuf[u][v] = buf[i][j]; + v += 2; + if(v >= 24) { + u += 2; + v = 0; + } + } + + /* Close srcdsets and srcfile if config option specified */ + if(config & TEST_IO_CLOSE_SRC) { + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if(H5Dclose(srcdset[1]) < 0) + TEST_ERROR + srcdset[1] = -1; + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } + + /* Reopen virtual dataset and file if config option specified */ + if(config & TEST_IO_REOPEN_VIRT) { + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + TEST_ERROR + } + + /* Select hyperslab in memory */ + start[0] = 0; + start[1] = 0; + stride[0] = 2; + stride[1] = 2; + count[0] = 5; + count[1] = 12; + block[0] = 1; + block[1] = 1; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0) + TEST_ERROR + + /* Select hyperslab in file */ + start[0] = 2; + start[1] = 0; + count[0] = 4; + count[1] = 15; + if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Read data through virtual dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0) + TEST_ERROR + + /* Verify read data */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if(rbuf[i][j] != erbuf[i][j]) + TEST_ERROR + + /* Close */ + if(!(config & TEST_IO_CLOSE_SRC)) { + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if(H5Dclose(srcdset[1]) < 0) + TEST_ERROR + srcdset[1] = -1; + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if(H5Sclose(srcspace[0]) < 0) + TEST_ERROR + srcspace[0] = -1; + if(H5Sclose(vspace[0]) < 0) + TEST_ERROR + vspace[0] = -1; + if(H5Sclose(vspace[1]) < 0) + TEST_ERROR + vspace[1] = -1; + if(H5Sclose(memspace) < 0) + TEST_ERROR + memspace = -1; + + + /* + * Test 9: For code coverage: Horizontal block virtual mappings, and file + * selection, grid memory selection, 3 mappings, 3D memory space + */ + /* Clear virtual layout in DCPL */ + if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + TEST_ERROR + + /* Create memory dataspace */ + dims[1] = 13; + dims[2] = 2; + if((memspace = H5Screate_simple(3, dims, NULL)) < 0) + TEST_ERROR + + /* Create virtual dataspaces */ + dims[0] = 6; + dims[1] = 10; + if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + if((vspace[2] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Create source dataspace */ + dims[0] = 2; + if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Select all in source space (should not be necessary, but just to be sure) + */ + if(H5Sselect_all(srcspace[0]) < 0) + TEST_ERROR + + /* Select hyperslabs in virtual spaces */ + start[0] = 0; + start[1] = 0; + if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + TEST_ERROR + start[0] = 2; + if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + TEST_ERROR + start[0] = 4; + if(H5Sselect_hyperslab(vspace[2], H5S_SELECT_SET, start, NULL, dims, NULL) < 0) + TEST_ERROR + + /* Add virtual layout mappings */ + if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0) + TEST_ERROR + if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0) + TEST_ERROR + if(H5Pset_virtual(dcpl, vspace[2], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset3", srcspace[0]) < 0) + TEST_ERROR + + /* Reset dims */ + dims[0] = 10; + dims[1] = 26; + + /* Create virtual file */ + if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + + /* Create source file if requested */ + if(config & TEST_IO_DIFFERENT_FILE) { + if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + } + else { + srcfile[0] = vfile; + if(H5Iinc_ref(srcfile[0]) < 0) + TEST_ERROR + } + + /* Create source datasets */ + if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Create virtual dataset */ + if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Reset erbuf */ + HDmemset(erbuf[0], 0, sizeof(rbuf)); + + /* Populate write buffer */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; + + /* Select hyperslab in memory */ + start[0] = 0; + start[1] = 0; + start[2] = 0; + count[0] = 2; + count[1] = 5; + count[2] = 2; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Write data directly to first source dataset */ + if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Update erbuf */ + u = 0; + v = 0; + for(i = 0; i < 2; i++) + for(j = 0; j < 10; j++) { + erbuf[u][v] = buf[i][j]; + if(++v == 6) + v += 2; + else if(v == 14) { + u += 2; + v = 0; + } + } + + /* Select hyperslab in memory */ + start[0] = 2; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Write data directly to second source dataset */ + if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Update erbuf */ + for(i = 2; i < 4; i++) + for(j = 0; j < 10; j++) { + erbuf[u][v] = buf[i][j]; + if(++v == 6) + v += 2; + else if(v == 14) { + u += 2; + v = 0; + } + } + + /* Select hyperslab in memory */ + start[0] = 4; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Write data directly to third source dataset */ + if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Update erbuf */ + for(i = 4; i < 6; i++) + for(j = 0; j < 10; j++) { + erbuf[u][v] = buf[i][j]; + if(++v == 6) + v += 2; + else if(v == 14) { + u += 2; + v = 0; + } + } + + /* Close srcdsets and srcfile if config option specified */ + if(config & TEST_IO_CLOSE_SRC) { + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if(H5Dclose(srcdset[1]) < 0) + TEST_ERROR + srcdset[1] = -1; + if(H5Dclose(srcdset[2]) < 0) + TEST_ERROR + srcdset[2] = -1; + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } + + /* Reopen virtual dataset and file if config option specified */ + if(config & TEST_IO_REOPEN_VIRT) { + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + TEST_ERROR + } + + /* Select hyperslab in memory */ + start[0] = 0; + start[1] = 0; + start[2] = 0; + stride[0] = 2; + stride[1] = 4; + stride[2] = 1; + count[0] = 5; + count[1] = 2; + count[2] = 1; + block[0] = 1; + block[1] = 3; + block[2] = 2; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0) + TEST_ERROR + + /* Read data through virtual dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + TEST_ERROR + + /* Verify read data */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if(rbuf[i][j] != erbuf[i][j]) + TEST_ERROR + + /* Close */ + if(!(config & TEST_IO_CLOSE_SRC)) { + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if(H5Dclose(srcdset[1]) < 0) + TEST_ERROR + srcdset[1] = -1; + if(H5Dclose(srcdset[2]) < 0) + TEST_ERROR + srcdset[2] = -1; + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if(H5Sclose(srcspace[0]) < 0) + TEST_ERROR + srcspace[0] = -1; + if(H5Sclose(vspace[0]) < 0) + TEST_ERROR + vspace[0] = -1; + if(H5Sclose(vspace[1]) < 0) + TEST_ERROR + vspace[1] = -1; + if(H5Sclose(vspace[2]) < 0) + TEST_ERROR + vspace[2] = -1; + if(H5Sclose(memspace) < 0) + TEST_ERROR + memspace = -1; + + + /* + * Test 10: For code coverage: Vertical stripe virtual mappings, vertical + * block file selection, block memory selection, 3D VDS + */ + /* Clear virtual layout in DCPL */ + if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) + TEST_ERROR + + /* Create memory dataspace */ + if((memspace = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Create virtual dataspaces */ + dims[0] = 10; + dims[1] = 9; + dims[2] = 6; + if((vspace[0] = H5Screate_simple(3, dims, NULL)) < 0) + TEST_ERROR + if((vspace[1] = H5Screate_simple(3, dims, NULL)) < 0) + TEST_ERROR + + /* Create source dataspace */ + dims[1] = 12; + if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Select all in source space (should not be necessary, but just to be sure) + */ + if(H5Sselect_all(srcspace[0]) < 0) + TEST_ERROR + + /* Select hyperslabs in virtual spaces */ + start[0] = 0; + start[1] = 0; + start[2] = 0; + count[0] = 1; + count[1] = 4; + count[2] = 3; + stride[0] = 1; + stride[1] = 2; + stride[2] = 2; + block[0] = 10; + block[1] = 1; + block[2] = 1; + if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0) + TEST_ERROR + start[2] = 1; + if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0) + TEST_ERROR + + /* Add virtual layout mappings */ + if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0) + TEST_ERROR + if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0) + TEST_ERROR + + /* Reset dims */ + dims[0] = 10; + dims[1] = 26; + + /* Create virtual file */ + if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + + /* Create source file if requested */ + if(config & TEST_IO_DIFFERENT_FILE) { + if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + } + else { + srcfile[0] = vfile; + if(H5Iinc_ref(srcfile[0]) < 0) + TEST_ERROR + } + + /* Create source datasets */ + if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Create virtual dataset */ + if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Initialize erbuf */ + HDmemset(erbuf[0], 0, sizeof(rbuf)); + for(i = 0; i < 10; i++) + for(j = 0; j < 24; j += 6) { + erbuf[i][j] = -1; + erbuf[i][j + 1] = -1; + } + + /* Populate write buffer */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; + + /* Select hyperslab in memory */ + start[0] = 0; + start[1] = 0; + count[0] = 10; + count[1] = 12; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Write data directly to first source dataset */ + if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Update erbuf */ + u = 0; + v = 0; + for(i = 0; i < 10; i++) + for(j = 0; j < 8; j++) { + if(v == 0 || v == 12) + erbuf[u][v] = buf[i][j]; + v += 2; + if(!(v % 6)) + v += 6; + if(v >= 28) { + u++; + v = 0; + } + } + + /* Select hyperslab in memory */ + start[1] = 8; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Write data directly to second source dataset */ + if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Update erbuf */ + u = 0; + v = 1; + for(i = 0; i < 10; i++) + for(j = 8; j < 16; j++) { + if(v == 1 || v == 13) + erbuf[u][v] = buf[i][j]; + v += 2; + if(!((v - 1) % 6)) + v += 6; + if(v >= 28) { + u++; + v = 1; + } + } + + /* Close srcdsets and srcfile if config option specified */ + if(config & TEST_IO_CLOSE_SRC) { + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if(H5Dclose(srcdset[1]) < 0) + TEST_ERROR + srcdset[1] = -1; + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } + + /* Reopen virtual dataset and file if config option specified */ + if(config & TEST_IO_REOPEN_VIRT) { + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) + TEST_ERROR + } + + /* Select hyperslab in memory */ + start[0] = 0; + start[1] = 0; + stride[0] = 1; + stride[1] = 6; + count[0] = 1; + count[1] = 4; + block[0] = 10; + block[1] = 2; + if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0) + TEST_ERROR + + /* Select hyperslab in file */ + start[0] = 0; + start[1] = 0; + start[2] = 0; + count[0] = 10; + count[1] = 4; + count[2] = 2; + if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0) + TEST_ERROR + + /* Read data through virtual dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], H5P_DEFAULT, rbuf[0]) < 0) + TEST_ERROR + + /* Verify read data */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if(rbuf[i][j] != erbuf[i][j]) + TEST_ERROR + + /* Close */ + if(!(config & TEST_IO_CLOSE_SRC)) { + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if(H5Dclose(srcdset[1]) < 0) + TEST_ERROR + srcdset[1] = -1; + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if(H5Sclose(srcspace[0]) < 0) + TEST_ERROR + srcspace[0] = -1; + if(H5Sclose(vspace[0]) < 0) + TEST_ERROR + vspace[0] = -1; + if(H5Sclose(vspace[1]) < 0) + TEST_ERROR + vspace[1] = -1; + if(H5Sclose(memspace) < 0) + TEST_ERROR + memspace = -1; + + /* Close */ if(H5Pclose(dcpl) < 0) TEST_ERROR -- cgit v0.12 From 1ecce0e9bbc07cb3eb6f6bc1fca9d42c9e9c8176 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 3 Jun 2019 10:45:13 -0500 Subject: Fix minor issues --- config/cmake_ext_mod/HDFUseFortran.cmake | 2 +- java/src/jni/h5tImp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/cmake_ext_mod/HDFUseFortran.cmake b/config/cmake_ext_mod/HDFUseFortran.cmake index de66e33..bed1fc1 100644 --- a/config/cmake_ext_mod/HDFUseFortran.cmake +++ b/config/cmake_ext_mod/HDFUseFortran.cmake @@ -13,7 +13,7 @@ # This file provides functions for Fortran support. # #------------------------------------------------------------------------------- -ENABLE_LANGUAGE (Fortran) +enable_language (Fortran) set (HDF_PREFIX "H5") #------------------------------------------------------------------------------- diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c index 313ca8b..460f12e 100644 --- a/java/src/jni/h5tImp.c +++ b/java/src/jni/h5tImp.c @@ -1620,7 +1620,7 @@ done: /* * Class: hdf_hdf5lib_H5 - * Method: H5Tarray_get_dims2 + * Method: H5Tget_array_dims2 * Signature: (J[J)I */ JNIEXPORT jint JNICALL -- cgit v0.12 From 45daa3d168f110ad26d390b9aa0fed419e20071c Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Mon, 3 Jun 2019 12:42:22 -0500 Subject: Minor fixes/improvements for VDS performance improvement (HDFFV-10693). --- src/H5Shyper.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 00cb7e9..63f457b 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -50,7 +50,7 @@ */ /* (Assumes that low & high bounds are _inclusive_) */ #define H5S_RANGE_OVERLAP(L1, H1, L2, H2) \ - !((L1) > (H2) || (L2) > (H1)) + (!((L1) > (H2) || (L2) > (H1))) /* Flags for which hyperslab fragments to compute */ #define H5S_HYPER_COMPUTE_B_NOT_A 0x01 @@ -112,7 +112,7 @@ typedef struct { * (ps_clean_bitmap) works. If H5S_MAX_RANK increases either increase the size * of ps_clean_bitmap or change the algorithm to use an array. */ #if H5S_MAX_RANK > 32 -#error H5S_MAX_RANK too small for ps_clean_bitmap field in H5S_hyper_project_intersect_ud_t struct +#error H5S_MAX_RANK too large for ps_clean_bitmap field in H5S_hyper_project_intersect_ud_t struct #endif @@ -10893,7 +10893,7 @@ H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info, H5S_HYPER_PROJ_INT_ADD_SKIP(udata, sis_low - ss_low, FAIL); } /* end if */ else - low = ss_span->low; + low = ss_low; /* Add overlapping elements */ udata->nelem += high - low + 1; @@ -10952,20 +10952,22 @@ H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info, if(ss_span && !((depth == 0) && (u == count - 1))) { /* Count remaining elements in ss_span_info */ - if(ss_span->down) - do { - H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL); + if(ss_span->down) { + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL); + ss_span = ss_span->next; + while(ss_span) { + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_span->low + 1), FAIL); ss_span = ss_span->next; - if(ss_span) - ss_low = ss_span->low; - } while(ss_span); - else - do { - H5S_HYPER_PROJ_INT_ADD_SKIP(udata, ss_span->high - ss_low + 1, FAIL); + } /* end while */ + } /* end if */ + else { + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, ss_span->high - ss_low + 1, FAIL); + ss_span = ss_span->next; + while(ss_span) { + H5S_HYPER_PROJ_INT_ADD_SKIP(udata, ss_span->high - ss_span->low + 1, FAIL); ss_span = ss_span->next; - if(ss_span) - ss_low = ss_span->low; - } while(ss_span); + } /* end while */ + } /* end else */ } /* end if */ /* Check if the projected space was not changed since we started the -- cgit v0.12 From 9557087c0ed7811301610155654bf58d6583e38c Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 5 Jun 2019 04:32:08 -0700 Subject: Minor warning fixes: * Fixed an error return value in H5Aint.c (NULL --> FAIL) * Added H5VL_FILE_GET_FILENO to H5trace.c --- src/H5Aint.c | 2 +- src/H5trace.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/H5Aint.c b/src/H5Aint.c index ebd6860..6162401 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2400,7 +2400,7 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, /* Determine size of the destination datatype */ if(0 == (dst_dt_size = H5T_get_size(attr_dst->shared->dt))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size") /* Determine # of reference elements to copy */ ref_count = attr_dst->shared->data_size / dst_dt_size; diff --git a/src/H5trace.c b/src/H5trace.c index 851ec73..1125072 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -2714,6 +2714,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5VL_FILE_GET_INTENT: HDfprintf(out, "H5VL_FILE_GET_INTENT"); break; + case H5VL_FILE_GET_FILENO: + HDfprintf(out, "H5VL_FILE_GET_FILENO"); + break; case H5VL_FILE_GET_NAME: HDfprintf(out, "H5VL_FILE_GET_NAME"); break; -- cgit v0.12 From a18727bc77c90a9925cabbde8d8ec46c757c6254 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 5 Jun 2019 04:34:36 -0700 Subject: Added a VOL initialization property list type. --- java/src/hdf/hdf5lib/HDF5Constants.java | 6 ++ java/src/jni/h5Constants.c | 4 ++ src/H5Pint.c | 105 +++++++++++++++++++++----------- src/H5Pprivate.h | 1 + src/H5Ppublic.h | 4 ++ src/H5VL.c | 22 +++++++ test/vol.c | 51 +++++++++++----- 7 files changed, 142 insertions(+), 51 deletions(-) diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 9294bad..8054ee8 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -374,6 +374,7 @@ public class HDF5Constants { public static final long H5P_OBJECT_COPY = H5P_OBJECT_COPY(); public static final long H5P_LINK_CREATE = H5P_LINK_CREATE(); public static final long H5P_LINK_ACCESS = H5P_LINK_ACCESS(); + public static final long H5P_VOL_INITIALIZE = H5P_VOL_INITIALIZE(); public static final long H5P_FILE_CREATE_DEFAULT = H5P_FILE_CREATE_DEFAULT(); public static final long H5P_FILE_ACCESS_DEFAULT = H5P_FILE_ACCESS_DEFAULT(); public static final long H5P_DATASET_CREATE_DEFAULT = H5P_DATASET_CREATE_DEFAULT(); @@ -389,6 +390,7 @@ public class HDF5Constants { public static final long H5P_OBJECT_COPY_DEFAULT = H5P_OBJECT_COPY_DEFAULT(); public static final long H5P_LINK_CREATE_DEFAULT = H5P_LINK_CREATE_DEFAULT(); public static final long H5P_LINK_ACCESS_DEFAULT = H5P_LINK_ACCESS_DEFAULT(); + public static final long H5P_VOL_INITIALIZE_DEFAULT = H5P_VOL_INITIALIZE_DEFAULT(); public static final int H5P_CRT_ORDER_TRACKED = H5P_CRT_ORDER_TRACKED(); public static final int H5P_CRT_ORDER_INDEXED = H5P_CRT_ORDER_INDEXED(); public static final long H5P_DEFAULT = H5P_DEFAULT(); @@ -1352,6 +1354,8 @@ public class HDF5Constants { private static native final long H5P_LINK_ACCESS(); + private static native final long H5P_VOL_INITIALIZE(); + private static native final long H5P_FILE_CREATE_DEFAULT(); private static native final long H5P_FILE_ACCESS_DEFAULT(); @@ -1382,6 +1386,8 @@ public class HDF5Constants { private static native final long H5P_LINK_ACCESS_DEFAULT(); + private static native final long H5P_VOL_INITIALIZE_DEFAULT(); + private static native final int H5P_CRT_ORDER_TRACKED(); private static native final int H5P_CRT_ORDER_INDEXED(); diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 74eb436..4b10479 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -731,6 +731,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1CREATE(JNIEnv *env, jclass cls){return JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1ACCESS(JNIEnv *env, jclass cls){return H5P_LINK_ACCESS;} JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5P_1VOL_1INITIALIZE(JNIEnv *env, jclass cls){return H5P_VOL_INITIALIZE;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_CREATE_DEFAULT;} JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_ACCESS_DEFAULT;} @@ -760,6 +762,8 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_LINK_CREATE_DEFAULT;} JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_LINK_ACCESS_DEFAULT;} +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5P_1VOL_1INITIALIZE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_VOL_INITIALIZE_DEFAULT;} JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1CRT_1ORDER_1TRACKED(JNIEnv *env, jclass cls){return H5P_CRT_ORDER_TRACKED;} JNIEXPORT jint JNICALL diff --git a/src/H5Pint.c b/src/H5Pint.c index b07f42d..04411a5 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -127,62 +127,65 @@ static herr_t H5P__free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H * Predefined property list classes. These are initialized at runtime by * H5P__init_package() in this source file. */ -hid_t H5P_CLS_ROOT_ID_g = FAIL; +hid_t H5P_CLS_ROOT_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_ROOT_g = NULL; -hid_t H5P_CLS_OBJECT_CREATE_ID_g = FAIL; +hid_t H5P_CLS_OBJECT_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_OBJECT_CREATE_g = NULL; -hid_t H5P_CLS_FILE_CREATE_ID_g = FAIL; +hid_t H5P_CLS_FILE_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_FILE_CREATE_g = NULL; -hid_t H5P_CLS_FILE_ACCESS_ID_g = FAIL; +hid_t H5P_CLS_FILE_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_FILE_ACCESS_g = NULL; -hid_t H5P_CLS_DATASET_CREATE_ID_g = FAIL; +hid_t H5P_CLS_DATASET_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_DATASET_CREATE_g = NULL; -hid_t H5P_CLS_DATASET_ACCESS_ID_g = FAIL; +hid_t H5P_CLS_DATASET_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_DATASET_ACCESS_g = NULL; -hid_t H5P_CLS_DATASET_XFER_ID_g = FAIL; +hid_t H5P_CLS_DATASET_XFER_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_DATASET_XFER_g = NULL; -hid_t H5P_CLS_FILE_MOUNT_ID_g = FAIL; +hid_t H5P_CLS_FILE_MOUNT_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_FILE_MOUNT_g = NULL; -hid_t H5P_CLS_GROUP_CREATE_ID_g = FAIL; +hid_t H5P_CLS_GROUP_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_GROUP_CREATE_g = NULL; -hid_t H5P_CLS_GROUP_ACCESS_ID_g = FAIL; +hid_t H5P_CLS_GROUP_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_GROUP_ACCESS_g = NULL; -hid_t H5P_CLS_DATATYPE_CREATE_ID_g = FAIL; +hid_t H5P_CLS_DATATYPE_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_DATATYPE_CREATE_g = NULL; -hid_t H5P_CLS_DATATYPE_ACCESS_ID_g = FAIL; +hid_t H5P_CLS_DATATYPE_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g = NULL; -hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g = FAIL; +hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g = NULL; -hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g = FAIL; +hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_ATTRIBUTE_ACCESS_g = NULL; -hid_t H5P_CLS_OBJECT_COPY_ID_g = FAIL; +hid_t H5P_CLS_OBJECT_COPY_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_OBJECT_COPY_g = NULL; -hid_t H5P_CLS_LINK_CREATE_ID_g = FAIL; +hid_t H5P_CLS_LINK_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_LINK_CREATE_g = NULL; -hid_t H5P_CLS_LINK_ACCESS_ID_g = FAIL; +hid_t H5P_CLS_LINK_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_LINK_ACCESS_g = NULL; -hid_t H5P_CLS_STRING_CREATE_ID_g = FAIL; +hid_t H5P_CLS_STRING_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_STRING_CREATE_g = NULL; +hid_t H5P_CLS_VOL_INITIALIZE_ID_g = H5I_INVALID_HID; +H5P_genclass_t *H5P_CLS_VOL_INITIALIZE_g = NULL; /* * Predefined property lists for each predefined class. These are initialized * at runtime by H5P__init_package() in this source file. */ -hid_t H5P_LST_FILE_CREATE_ID_g = FAIL; -hid_t H5P_LST_FILE_ACCESS_ID_g = FAIL; -hid_t H5P_LST_DATASET_CREATE_ID_g = FAIL; -hid_t H5P_LST_DATASET_ACCESS_ID_g = FAIL; -hid_t H5P_LST_DATASET_XFER_ID_g = FAIL; -hid_t H5P_LST_FILE_MOUNT_ID_g = FAIL; -hid_t H5P_LST_GROUP_CREATE_ID_g = FAIL; -hid_t H5P_LST_GROUP_ACCESS_ID_g = FAIL; -hid_t H5P_LST_DATATYPE_CREATE_ID_g = FAIL; -hid_t H5P_LST_DATATYPE_ACCESS_ID_g = FAIL; -hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g = FAIL; -hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g = FAIL; -hid_t H5P_LST_OBJECT_COPY_ID_g = FAIL; -hid_t H5P_LST_LINK_CREATE_ID_g = FAIL; -hid_t H5P_LST_LINK_ACCESS_ID_g = FAIL; +hid_t H5P_LST_FILE_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_FILE_ACCESS_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_DATASET_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_DATASET_ACCESS_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_DATASET_XFER_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_FILE_MOUNT_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_GROUP_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_GROUP_ACCESS_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_DATATYPE_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_DATATYPE_ACCESS_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_OBJECT_COPY_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_LINK_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_LINK_ACCESS_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_VOL_INITIALIZE_ID_g = H5I_INVALID_HID; /* Root property list class library initialization object */ const H5P_libclass_t H5P_CLS_ROOT[1] = {{ @@ -283,6 +286,26 @@ const H5P_libclass_t H5P_CLS_TACC[1] = {{ NULL /* Class close callback info */ }}; +/* VOL initialization property list class library initialization object */ +/* (move to proper source code file when used for real) */ +const H5P_libclass_t H5P_CLS_VINI[1] = {{ + "VOL initialization", /* Class name for debugging */ + H5P_TYPE_VOL_INITIALIZE, /* Class type */ + + &H5P_CLS_ROOT_g, /* Parent class */ + &H5P_CLS_VOL_INITIALIZE_g, /* Pointer to class */ + &H5P_CLS_VOL_INITIALIZE_ID_g, /* Pointer to class ID */ + &H5P_LST_VOL_INITIALIZE_ID_g, /* Pointer to default property list ID */ + NULL, /* Default property registration routine */ + + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + /* Library property list classes defined in other code modules */ /* (And not present in src/H5Pprivate.h) */ @@ -331,7 +354,8 @@ static H5P_libclass_t const * const init_class[] = { H5P_CLS_TACC, /* Datatype access */ H5P_CLS_ACRT, /* Attribute creation */ H5P_CLS_AACC, /* Attribute access */ - H5P_CLS_LCRT /* Link creation */ + H5P_CLS_LCRT, /* Link creation */ + H5P_CLS_VINI /* VOL initialization */ }; /* Declare a free list to manage the H5P_genclass_t struct */ @@ -525,7 +549,8 @@ H5P_term_package(void) H5P_LST_OBJECT_COPY_ID_g = H5P_LST_LINK_CREATE_ID_g = H5P_LST_LINK_ACCESS_ID_g = - H5P_LST_FILE_MOUNT_ID_g = (-1); + H5P_LST_VOL_INITIALIZE_ID_g = + H5P_LST_FILE_MOUNT_ID_g = H5I_INVALID_HID; } /* end if */ } /* end if */ @@ -552,6 +577,7 @@ H5P_term_package(void) H5P_CLS_OBJECT_COPY_g = H5P_CLS_LINK_CREATE_g = H5P_CLS_LINK_ACCESS_g = + H5P_CLS_VOL_INITIALIZE_g = H5P_CLS_FILE_MOUNT_g = NULL; H5P_CLS_ROOT_ID_g = @@ -571,7 +597,8 @@ H5P_term_package(void) H5P_CLS_OBJECT_COPY_ID_g = H5P_CLS_LINK_CREATE_ID_g = H5P_CLS_LINK_ACCESS_ID_g = - H5P_CLS_FILE_MOUNT_ID_g = (-1); + H5P_CLS_VOL_INITIALIZE_ID_g = + H5P_CLS_FILE_MOUNT_ID_g = H5I_INVALID_HID; } /* end if */ } /* end if */ @@ -5408,7 +5435,7 @@ H5P__new_plist_of_type(H5P_plist_type_t type) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDcompile_assert(H5P_TYPE_ATTRIBUTE_ACCESS == (H5P_TYPE_MAX_TYPE - 1)); + HDcompile_assert(H5P_TYPE_VOL_INITIALIZE == (H5P_TYPE_MAX_TYPE - 1)); HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_LINK_ACCESS); /* Check arguments */ @@ -5487,6 +5514,10 @@ H5P__new_plist_of_type(H5P_plist_type_t type) class_id = H5P_CLS_LINK_ACCESS_ID_g; break; + case H5P_TYPE_VOL_INITIALIZE: + class_id = H5P_CLS_VOL_INITIALIZE_ID_g; + break; + case H5P_TYPE_USER: /* shut compiler warnings up */ case H5P_TYPE_ROOT: case H5P_TYPE_MAX_TYPE: diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 49f7a12..07910c3 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -78,6 +78,7 @@ typedef enum H5P_plist_type_t { H5P_TYPE_LINK_CREATE = 16, H5P_TYPE_LINK_ACCESS = 17, H5P_TYPE_ATTRIBUTE_ACCESS = 18, + H5P_TYPE_VOL_INITIALIZE = 19, H5P_TYPE_MAX_TYPE } H5P_plist_type_t; diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 90e6618..cad2071 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -68,6 +68,7 @@ #define H5P_OBJECT_COPY (H5OPEN H5P_CLS_OBJECT_COPY_ID_g) #define H5P_LINK_CREATE (H5OPEN H5P_CLS_LINK_CREATE_ID_g) #define H5P_LINK_ACCESS (H5OPEN H5P_CLS_LINK_ACCESS_ID_g) +#define H5P_VOL_INITIALIZE (H5OPEN H5P_CLS_VOL_INITIALIZE_ID_g) /* * The library's default property lists @@ -87,6 +88,7 @@ #define H5P_OBJECT_COPY_DEFAULT (H5OPEN H5P_LST_OBJECT_COPY_ID_g) #define H5P_LINK_CREATE_DEFAULT (H5OPEN H5P_LST_LINK_CREATE_ID_g) #define H5P_LINK_ACCESS_DEFAULT (H5OPEN H5P_LST_LINK_ACCESS_ID_g) +#define H5P_VOL_INITIALIZE_DEFAULT (H5OPEN H5P_LST_VOL_INITIALIZE_ID_g) /* Common creation order flags (for links in groups and attributes on objects) */ #define H5P_CRT_ORDER_TRACKED 0x0001 @@ -195,6 +197,7 @@ H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_CLS_OBJECT_COPY_ID_g; H5_DLLVAR hid_t H5P_CLS_LINK_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_LINK_ACCESS_ID_g; +H5_DLLVAR hid_t H5P_CLS_VOL_INITIALIZE_ID_g; /* Default roperty list IDs */ /* (Internal to library, do not use! Use macros above) */ @@ -213,6 +216,7 @@ H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_OBJECT_COPY_ID_g; H5_DLLVAR hid_t H5P_LST_LINK_CREATE_ID_g; H5_DLLVAR hid_t H5P_LST_LINK_ACCESS_ID_g; +H5_DLLVAR hid_t H5P_LST_VOL_INITIALIZE_ID_g; /*********************/ /* Public Prototypes */ diff --git a/src/H5VL.c b/src/H5VL.c index d4c0ff2..2cd5f02 100644 --- a/src/H5VL.c +++ b/src/H5VL.c @@ -31,6 +31,7 @@ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ +#include "H5Pprivate.h" /* Property lists */ #include "H5VLpkg.h" /* Virtual Object Layer */ /* VOL connectors */ @@ -101,6 +102,13 @@ H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id) if (cls->wrap_cls.get_wrap_ctx && !cls->wrap_cls.free_wrap_ctx) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for object wrapping contexts when a get callback is provided") + /* Check VOL initialization property list */ + if(H5P_DEFAULT == vipl_id) + vipl_id = H5P_VOL_INITIALIZE_DEFAULT; + else + if(TRUE != H5P_isa_class(vipl_id, H5P_VOL_INITIALIZE)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL initialize property list") + /* Register connector */ if((ret_value = H5VL__register_connector(cls, TRUE, vipl_id)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector") @@ -138,6 +146,13 @@ H5VLregister_connector_by_name(const char *name, hid_t vipl_id) if (0 == HDstrlen(name)) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL connector name is disallowed") + /* Check VOL initialization property list */ + if(H5P_DEFAULT == vipl_id) + vipl_id = H5P_VOL_INITIALIZE_DEFAULT; + else + if(TRUE != H5P_isa_class(vipl_id, H5P_VOL_INITIALIZE)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL initialize property list") + /* Register connector */ if((ret_value = H5VL__register_connector_by_name(name, TRUE, vipl_id)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector") @@ -173,6 +188,13 @@ H5VLregister_connector_by_value(H5VL_class_value_t value, hid_t vipl_id) if(value < 0) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "negative VOL connector value is disallowed") + /* Check VOL initialization property list */ + if(H5P_DEFAULT == vipl_id) + vipl_id = H5P_VOL_INITIALIZE_DEFAULT; + else + if(TRUE != H5P_isa_class(vipl_id, H5P_VOL_INITIALIZE)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL initialize property list") + /* Register connector */ if((ret_value = H5VL__register_connector_by_value(value, TRUE, vipl_id)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector") diff --git a/test/vol.c b/test/vol.c index e5b8243..5ff0af0 100644 --- a/test/vol.c +++ b/test/vol.c @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Purpose: Tests the virtual object layer (H5VL) + * Purpose: Tests the virtual object layer (H5VL) * * This is a minimal test to ensure VOL usage (setting a VOL, etc.) * works as expected. Actual VOL functionality is tested using @@ -149,6 +149,8 @@ static herr_t test_vol_registration(void) { hid_t native_id = H5I_INVALID_HID; + hid_t lapl_id = H5I_INVALID_HID; + hid_t vipl_id = H5I_INVALID_HID; herr_t ret = SUCCEED; htri_t is_registered = FAIL; hid_t vol_id = H5I_INVALID_HID; @@ -158,47 +160,66 @@ test_vol_registration(void) /* The test/fake VOL connector should not be registered at the start of the test */ if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (is_registered > 0) FAIL_PUTS_ERROR("VOL connector is inappropriately registered"); - /* Load a VOL interface */ - if ((vol_id = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + /* Test registering a connector with an incorrect property list (SHOULD FAIL) */ + if ((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) + TEST_ERROR; + H5E_BEGIN_TRY { + vol_id = H5VLregister_connector(&fake_vol_g, lapl_id); + } H5E_END_TRY; + if (H5I_INVALID_HID != vol_id) + FAIL_PUTS_ERROR("should not be able to register a connector with an incorrect property list"); + if (H5Pclose(lapl_id) < 0) + TEST_ERROR; + + /* Load a VOL interface + * The vipl_id does nothing without a VOL that needs it, but we do need to + * test creating a property list of that class and passing it along as a + * smoke check. + */ + if ((vipl_id = H5Pcreate(H5P_VOL_INITIALIZE)) < 0) + TEST_ERROR; + if ((vol_id = H5VLregister_connector(&fake_vol_g, vipl_id)) < 0) + TEST_ERROR; + if (H5Pclose(vipl_id) < 0) + TEST_ERROR; /* The test/fake VOL connector should be registered now */ if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (0 == is_registered) FAIL_PUTS_ERROR("VOL connector is un-registered"); /* Re-register a VOL connector */ if ((vol_id2 = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* The test/fake VOL connector should still be registered now */ if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (0 == is_registered) FAIL_PUTS_ERROR("VOL connector is un-registered"); /* Unregister the second test/fake VOL ID */ if (H5VLunregister_connector(vol_id2) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* The test/fake VOL connector should still be registered now */ if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (0 == is_registered) FAIL_PUTS_ERROR("VOL connector is un-registered"); /* Unregister the original test/fake VOL ID */ if (H5VLunregister_connector(vol_id) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Try to unregister the native VOL connector (should fail) */ if (H5I_INVALID_HID == (native_id = H5VLget_connector_id(H5VL_NATIVE_NAME))) - FAIL_STACK_ERROR; + TEST_ERROR; H5E_BEGIN_TRY { ret = H5VLunregister_connector(native_id); } H5E_END_TRY; @@ -211,6 +232,8 @@ test_vol_registration(void) error: H5E_BEGIN_TRY { H5VLunregister_connector(vol_id); + H5Pclose(lapl_id); + H5Pclose(vipl_id); } H5E_END_TRY; return FAIL; @@ -235,7 +258,7 @@ test_native_vol_init(void) /* The native VOL connector should always be registered */ if ((is_registered = H5VLis_connector_registered(H5VL_NATIVE_NAME)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (0 == is_registered) FAIL_PUTS_ERROR("native VOL connector is un-registered"); @@ -293,7 +316,7 @@ test_basic_file_operation(const char *env_h5_drvr) if(H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI) < 0) TEST_ERROR; if(H5Pset_metadata_read_attempts(fapl_id, 9) < 0) - FAIL_STACK_ERROR + TEST_ERROR /* H5Fcreate */ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) -- cgit v0.12 From c64bfbd8a0eb71bfbd458eb680e7419bc1bd10c7 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Wed, 5 Jun 2019 16:35:04 -0500 Subject: Move check for MPI defined to enable parallel from options scripts in HPC to config/cmake/HDF5options.cmake. --- config/cmake/scripts/HDF5options.cmake | 14 ++++++++------ config/cmake/scripts/HPC/bsub-HDF5options.cmake | 12 ------------ config/cmake/scripts/HPC/qsub-HDF5options.cmake | 12 ------------ config/cmake/scripts/HPC/raybsub-HDF5options.cmake | 12 ------------ config/cmake/scripts/HPC/sbatch-HDF5options.cmake | 12 ------------ 5 files changed, 8 insertions(+), 54 deletions(-) diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 45877d7..cb75c02 100644 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -69,12 +69,14 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRIN ############################################################################################# ### enable parallel builds - -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") - +if (DEFINED MPI) + # maximum parallel processor count for build and test #### + set (MAX_PROC_COUNT 8) + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") +endif() ############################################################################################# ### enable thread-safety builds diff --git a/config/cmake/scripts/HPC/bsub-HDF5options.cmake b/config/cmake/scripts/HPC/bsub-HDF5options.cmake index 83c17aa..e0b48f4 100644 --- a/config/cmake/scripts/HPC/bsub-HDF5options.cmake +++ b/config/cmake/scripts/HPC/bsub-HDF5options.cmake @@ -14,18 +14,6 @@ #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### ############################################################################################# -### uncomment/comment and change the following lines for other configuration options - -############################################################################################# -### enable parallel builds -if (DEFINED MPI) - # maximum parallel processor count for build and test #### - set (MAX_PROC_COUNT 8) - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") -endif () ############################################################################################# ### options to run test scripts in batch commands set (LOCAL_BATCH_SCRIPT_COMMAND "bsub") diff --git a/config/cmake/scripts/HPC/qsub-HDF5options.cmake b/config/cmake/scripts/HPC/qsub-HDF5options.cmake index 51c3891..d9af140 100644 --- a/config/cmake/scripts/HPC/qsub-HDF5options.cmake +++ b/config/cmake/scripts/HPC/qsub-HDF5options.cmake @@ -14,18 +14,6 @@ #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### ############################################################################################# -### uncomment/comment and change the following lines for other configuration options - -############################################################################################# -### enable parallel builds -if (DEFINED MPI) - # maximum parallel processor count for build and test #### - set (MAX_PROC_COUNT 8) - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") -endif () ############################################################################################# ### options to run test scripts in batch commands set (LOCAL_BATCH_SCRIPT_NAME "ctest.qsub") diff --git a/config/cmake/scripts/HPC/raybsub-HDF5options.cmake b/config/cmake/scripts/HPC/raybsub-HDF5options.cmake index 4aad887..f70e754 100644 --- a/config/cmake/scripts/HPC/raybsub-HDF5options.cmake +++ b/config/cmake/scripts/HPC/raybsub-HDF5options.cmake @@ -14,18 +14,6 @@ #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### ############################################################################################# -### uncomment/comment and change the following lines for other configuration options - -############################################################################################# -### enable parallel builds -if (DEFINED MPI) - # maximum parallel processor count for build and test #### - set (MAX_PROC_COUNT 8) - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") -endif () ############################################################################################# ### options to run test scripts in batch commands set (LOCAL_BATCH_SCRIPT_COMMAND "raybsub") diff --git a/config/cmake/scripts/HPC/sbatch-HDF5options.cmake b/config/cmake/scripts/HPC/sbatch-HDF5options.cmake index f70526e..42d7482 100644 --- a/config/cmake/scripts/HPC/sbatch-HDF5options.cmake +++ b/config/cmake/scripts/HPC/sbatch-HDF5options.cmake @@ -14,18 +14,6 @@ #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### ############################################################################################# -### uncomment/comment and change the following lines for other configuration options - -############################################################################################# -### enable parallel builds -if (DEFINED MPI) - # maximum parallel processor count for build and test #### - set (MAX_PROC_COUNT 8) - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") -endif () ############################################################################################# ### options to run test scripts in batch commands if (DEFINED KNL) -- cgit v0.12 From 931abe94244c94e106835250e2f723f634a61c8c Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Wed, 5 Jun 2019 16:44:10 -0500 Subject: Move set (MAX_PROC_COUNT 8) back to HPC options files. --- config/cmake/scripts/HDF5options.cmake | 2 -- config/cmake/scripts/HPC/bsub-HDF5options.cmake | 5 ++++- config/cmake/scripts/HPC/qsub-HDF5options.cmake | 5 ++++- config/cmake/scripts/HPC/raybsub-HDF5options.cmake | 5 ++++- config/cmake/scripts/HPC/sbatch-HDF5options.cmake | 5 ++++- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index cb75c02..bfd7fad 100644 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -70,8 +70,6 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRIN ############################################################################################# ### enable parallel builds if (DEFINED MPI) - # maximum parallel processor count for build and test #### - set (MAX_PROC_COUNT 8) set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") diff --git a/config/cmake/scripts/HPC/bsub-HDF5options.cmake b/config/cmake/scripts/HPC/bsub-HDF5options.cmake index e0b48f4..7473e8a 100644 --- a/config/cmake/scripts/HPC/bsub-HDF5options.cmake +++ b/config/cmake/scripts/HPC/bsub-HDF5options.cmake @@ -13,7 +13,10 @@ #### Change default configuration of options in config/cmake/cacheinit.cmake file ### #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### ############################################################################################# - +if (DEFINED MPI) + # maximum parallel processor count for build and test #### + set (MAX_PROC_COUNT 8) +endif() ############################################################################################# ### options to run test scripts in batch commands set (LOCAL_BATCH_SCRIPT_COMMAND "bsub") diff --git a/config/cmake/scripts/HPC/qsub-HDF5options.cmake b/config/cmake/scripts/HPC/qsub-HDF5options.cmake index d9af140..34eba1b 100644 --- a/config/cmake/scripts/HPC/qsub-HDF5options.cmake +++ b/config/cmake/scripts/HPC/qsub-HDF5options.cmake @@ -13,7 +13,10 @@ #### Change default configuration of options in config/cmake/cacheinit.cmake file ### #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### ############################################################################################# - +if (DEFINED MPI) + # maximum parallel processor count for build and test #### + set (MAX_PROC_COUNT 8) +endif() ############################################################################################# ### options to run test scripts in batch commands set (LOCAL_BATCH_SCRIPT_NAME "ctest.qsub") diff --git a/config/cmake/scripts/HPC/raybsub-HDF5options.cmake b/config/cmake/scripts/HPC/raybsub-HDF5options.cmake index f70e754..fa1ec4a 100644 --- a/config/cmake/scripts/HPC/raybsub-HDF5options.cmake +++ b/config/cmake/scripts/HPC/raybsub-HDF5options.cmake @@ -13,7 +13,10 @@ #### Change default configuration of options in config/cmake/cacheinit.cmake file ### #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### ############################################################################################# - +if (DEFINED MPI) + # maximum parallel processor count for build and test #### + set (MAX_PROC_COUNT 8) +endif() ############################################################################################# ### options to run test scripts in batch commands set (LOCAL_BATCH_SCRIPT_COMMAND "raybsub") diff --git a/config/cmake/scripts/HPC/sbatch-HDF5options.cmake b/config/cmake/scripts/HPC/sbatch-HDF5options.cmake index 42d7482..3205a1c 100644 --- a/config/cmake/scripts/HPC/sbatch-HDF5options.cmake +++ b/config/cmake/scripts/HPC/sbatch-HDF5options.cmake @@ -13,7 +13,10 @@ #### Change default configuration of options in config/cmake/cacheinit.cmake file ### #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### ############################################################################################# - +if (DEFINED MPI) + # maximum parallel processor count for build and test #### + set (MAX_PROC_COUNT 8) +endif() ############################################################################################# ### options to run test scripts in batch commands if (DEFINED KNL) -- cgit v0.12 From 54a07f556cd2f3556f8c7946fe7905bc658a11aa Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Wed, 5 Jun 2019 23:20:01 -0500 Subject: Add options to enable or disable building tools and tests. The default is enabled for each. --- Makefile.am | 24 +++++++++++++++------- c++/Makefile.am | 8 +++++++- configure.ac | 54 ++++++++++++++++++++++++++++++++++++++++++++++---- fortran/Makefile.am | 11 ++++++++-- hl/Makefile.am | 12 ++++++++++- hl/c++/Makefile.am | 8 +++++++- hl/fortran/Makefile.am | 8 +++++++- java/Makefile.am | 10 +++++++++- tools/Makefile.am | 8 +++++++- 9 files changed, 124 insertions(+), 19 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7f872b0..a3c4385 100644 --- a/Makefile.am +++ b/Makefile.am @@ -49,11 +49,6 @@ include $(top_srcdir)/config/commence.am # Conditionals. These conditionals are defined during configure # Define each variable to empty if it is not used to placate pmake -if BUILD_PARALLEL_CONDITIONAL - TESTPARALLEL_DIR =testpar -else - TESTPARALLEL_DIR= -endif if BUILD_CXX_CONDITIONAL CXX_DIR =c++ else @@ -74,9 +69,24 @@ if BUILD_HDF5_HL_CONDITIONAL else HDF5_HL_DIR= endif +if BUILD_TESTS_CONDITIONAL + TESTSERIAL_DIR =test +else + TESTSERIAL_DIR= +endif +if BUILD_TESTS_PARALLEL_CONDITIONAL + TESTPARALLEL_DIR =testpar +else + TESTPARALLEL_DIR= +endif +if BUILD_TOOLS_CONDITIONAL + TOOLS_DIR =tools +else + TOOLS_DIR= +endif -SUBDIRS = src test $(TESTPARALLEL_DIR) tools . $(CXX_DIR) $(FORTRAN_DIR) \ - $(JAVA_DIR) $(HDF5_HL_DIR) +SUBDIRS = src $(TESTSERIAL_DIR) $(TESTPARALLEL_DIR) $(TOOLS_DIR) . $(CXX_DIR) \ + $(FORTRAN_DIR) $(JAVA_DIR) $(HDF5_HL_DIR) DIST_SUBDIRS = src test testpar tools . c++ fortran hl examples java # Some files generated during configure that should be cleaned diff --git a/c++/Makefile.am b/c++/Makefile.am index 3713901..319ce6e 100644 --- a/c++/Makefile.am +++ b/c++/Makefile.am @@ -18,9 +18,15 @@ include $(top_srcdir)/config/commence.am +if BUILD_TESTS_CONDITIONAL + TEST_DIR = test +else + TEST_DIR= +endif + ## Only recurse into subdirectories if C++ interface is enabled. if BUILD_CXX_CONDITIONAL - SUBDIRS=src test + SUBDIRS=src $(TEST_DIR) # Test with just the native connector, with a single pass-through connector # and with a doubly-stacked pass-through. diff --git a/configure.ac b/configure.ac index cf9cd64..7846357 100644 --- a/configure.ac +++ b/configure.ac @@ -943,6 +943,48 @@ fi AM_CONDITIONAL([FORTRAN_SHARED_CONDITIONAL], [test "X$H5_FORTRAN_SHARED" = "Xyes"]) ## ---------------------------------------------------------------------- +## Check if they would like to disable building tests +## + +## This needs to be exposed for the library info file. +AC_SUBST([HDF5_TESTS]) + +## Default is to build tests +HDF5_TESTS=yes + +AC_MSG_CHECKING([if building tests is disabled]) + +AC_ARG_ENABLE([tests], + [AS_HELP_STRING([--enable-tests], + [Compile the HDF5 tests [default=yes]])], + [HDF5_TESTS=$enableval]) + +if test "X$HDF5_TESTS" = "Xno"; then + echo "Building HDF5 tests is disabled" +fi + +## ---------------------------------------------------------------------- +## Check if they would like to disable building tools +## + +## This needs to be exposed for the library info file. +AC_SUBST([HDF5_TOOLS]) + +## Default is to build tests and tools +HDF5_TOOLS=yes + +AC_MSG_CHECKING([if building tools is disabled]) + +AC_ARG_ENABLE([tools], + [AS_HELP_STRING([--enable-tools], + [Compile the HDF5 tools [default=yes]])], + [HDF5_TOOLS=$enableval]) + +if test "X$HDF5_TOOLS" = "Xno"; then + echo "Building HDF5 tools is disabled" +fi + +## ---------------------------------------------------------------------- ## Create libtool. If shared/static libraries are going to be enabled ## or disabled, it should happen before these macros. LT_PREREQ([2.2]) @@ -2511,8 +2553,10 @@ AC_SUBST([PARALLEL_FILTERED_WRITES]) AC_SUBST([LARGE_PARALLEL_IO]) if test -n "$PARALLEL"; then - ## The 'testpar' directory should participate in the build - TESTPARALLEL=testpar + if test "X$HDF5_TESTS" = "Xyes"; then + ## The 'testpar' directory should participate in the build + TESTPARALLEL=testpar + fi ## We are building a parallel library AC_DEFINE([HAVE_PARALLEL], [1], [Define if we have parallel support]) @@ -3361,11 +3405,13 @@ LDFLAGS="$saved_user_LDFLAGS" ## need to be compiled AM_CONDITIONAL([BUILD_CXX_CONDITIONAL], [test "X$HDF_CXX" = "Xyes"]) -AM_CONDITIONAL([BUILD_PARALLEL_CONDITIONAL], [test -n "$TESTPARALLEL"]) +AM_CONDITIONAL([BUILD_PARALLEL_CONDITIONAL], [test "X$PARALLEL" = "Xyes"]) AM_CONDITIONAL([BUILD_FORTRAN_CONDITIONAL], [test "X$HDF_FORTRAN" = "Xyes"]) AM_CONDITIONAL([BUILD_JAVA_CONDITIONAL], [test "X$HDF_JAVA" = "Xyes"]) AM_CONDITIONAL([BUILD_HDF5_HL_CONDITIONAL], [test "X$HDF5_HL" = "Xyes"]) - +AM_CONDITIONAL([BUILD_TESTS_CONDITIONAL], [test "X$HDF5_TESTS" = "Xyes"]) +AM_CONDITIONAL([BUILD_TESTS_PARALLEL_CONDITIONAL], [test -n "$TESTPARALLEL"]) +AM_CONDITIONAL([BUILD_TOOLS_CONDITIONAL], [test "X$HDF5_TOOLS" = "Xyes"]) ## ---------------------------------------------------------------------- ## Build the Makefiles. diff --git a/fortran/Makefile.am b/fortran/Makefile.am index ca0733f..c07fa3e 100644 --- a/fortran/Makefile.am +++ b/fortran/Makefile.am @@ -22,14 +22,21 @@ include $(top_srcdir)/config/commence.am -if BUILD_PARALLEL_CONDITIONAL +if BUILD_TESTS_PARALLEL_CONDITIONAL TESTPARALLEL_DIR=testpar +else + TESTPARALLEL_DIR= +endif +if BUILD_TESTS_CONDITIONAL + TESTSERIAL_DIR=test +else + TESTSERIAL_DIR= endif # Subdirectories in build order, not including examples directory ## Only recurse into subdirectories if HDF5 is configured to use Fortran. if BUILD_FORTRAN_CONDITIONAL - SUBDIRS=src test $(TESTPARALLEL_DIR) + SUBDIRS=src $(TESTSERIAL_DIR) $(TESTPARALLEL_DIR) # Test with just the native connector, with a single pass-through connector # and with a doubly-stacked pass-through. diff --git a/hl/Makefile.am b/hl/Makefile.am index 172d0e8..ded7aa0 100644 --- a/hl/Makefile.am +++ b/hl/Makefile.am @@ -31,11 +31,21 @@ endif if BUILD_CXX_CONDITIONAL CXX_DIR = c++ endif +if BUILD_TESTS_CONDITIONAL + TEST_DIR = test +else + TEST_DIR = +endif +if BUILD_TOOLS_CONDITIONAL + TOOLS_DIR = tools +else + TOOLS_DIR = +endif ## Don't recurse into any subdirectories if HDF5 is not configured to ## use the HL library if BUILD_HDF5_HL_CONDITIONAL - SUBDIRS=src test tools $(CXX_DIR) $(FORTRAN_DIR) + SUBDIRS=src $(TEST_DIR) $(TOOLS_DIR) $(CXX_DIR) $(FORTRAN_DIR) # Test with just the native connector, with a single pass-through connector # and with a doubly-stacked pass-through. diff --git a/hl/c++/Makefile.am b/hl/c++/Makefile.am index 1968bf5..f9ea328 100644 --- a/hl/c++/Makefile.am +++ b/hl/c++/Makefile.am @@ -18,7 +18,13 @@ include $(top_srcdir)/config/commence.am -SUBDIRS=src test +if BUILD_TESTS_CONDITIONAL + TESTSERIAL_DIR =test +else + TESTSERIAL_DIR= +endif + +SUBDIRS=src $(TESTSERIAL_DIR) DIST_SUBDIRS=src test examples # Install examples diff --git a/hl/fortran/Makefile.am b/hl/fortran/Makefile.am index ad18a21..7d24770 100644 --- a/hl/fortran/Makefile.am +++ b/hl/fortran/Makefile.am @@ -23,7 +23,13 @@ include $(top_srcdir)/config/commence.am -SUBDIRS=src test +if BUILD_TESTS_CONDITIONAL + TESTSERIAL_DIR =test +else + TESTSERIAL_DIR= +endif + +SUBDIRS=src $(TESTSERIAL_DIR) DIST_SUBDIRS=src test examples # Install examples diff --git a/java/Makefile.am b/java/Makefile.am index ed2414d..51398f2 100644 --- a/java/Makefile.am +++ b/java/Makefile.am @@ -23,13 +23,21 @@ include $(top_srcdir)/config/commence.am +if BUILD_TESTS_CONDITIONAL + TESTSERIAL_DIR =test + TESTEXAMPLES_DIR =examples +else + TESTSERIAL_DIR= + TESTEXAMPLES_DIR= +endif + ## Only recurse into subdirectories if the Java (JNI) interface is enabled. if BUILD_JAVA_CONDITIONAL # Mark this directory as part of the JNI API JAVA_API=yes -SUBDIRS=src test examples +SUBDIRS=src $(TESTSERIAL_DIR) $(TESTEXAMPLES_DIR) # Test with just the native connector, with a single pass-through connector # and with a doubly-stacked pass-through. diff --git a/tools/Makefile.am b/tools/Makefile.am index c53ecd6..5877cef 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -19,10 +19,16 @@ include $(top_srcdir)/config/commence.am +if BUILD_TESTS_CONDITIONAL + TESTSERIAL_DIR =test +else + TESTSERIAL_DIR= +endif + CONFIG=ordered # All subdirectories -SUBDIRS=lib src test +SUBDIRS=lib src $(TESTSERIAL_DIR) # Test with just the native connector, with a single pass-through connector # and with a doubly-stacked pass-through. -- cgit v0.12 From a668acfc6cb541cc6afa63f964af3d808d058883 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 6 Jun 2019 11:06:04 -0700 Subject: Minor tweaks to the VOL function comments to bring them in line with the RM. --- src/H5VL.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/H5VL.c b/src/H5VL.c index 2cd5f02..5c62f6f 100644 --- a/src/H5VL.c +++ b/src/H5VL.c @@ -74,6 +74,9 @@ * Purpose: Registers a new VOL connector as a member of the virtual object * layer class. * + * VIPL_ID is a VOL initialization property list which must be + * created with H5Pcreate(H5P_VOL_INITIALIZE) (or H5P_DEFAULT). + * * Return: Success: A VOL connector ID which is good until the * library is closed or the connector is * unregistered. @@ -124,6 +127,9 @@ done: * Purpose: Registers a new VOL connector as a member of the virtual object * layer class. * + * VIPL_ID is a VOL initialization property list which must be + * created with H5Pcreate(H5P_VOL_INITIALIZE) (or H5P_DEFAULT). + * * Return: Success: A VOL connector ID which is good until the * library is closed or the connector is * unregistered. @@ -168,6 +174,9 @@ done: * Purpose: Registers a new VOL connector as a member of the virtual object * layer class. * + * VIPL_ID is a VOL initialization property list which must be + * created with H5Pcreate(H5P_VOL_INITIALIZE) (or H5P_DEFAULT). + * * Return: Success: A VOL connector ID which is good until the * library is closed or the connector is * unregistered. @@ -209,9 +218,9 @@ done: * * Purpose: Tests whether a VOL class has been registered or not * - * Return: >0 if the VOL class has been registered - * 0 if it is unregistered - * <0 on error (if the class is not a valid class ID) + * Return: >0 if a VOL connector with that name has been registered + * 0 if a VOL connector with that name has NOT been registered + * <0 on errors * * Programmer: Dana Robinson * June 17, 2017 @@ -240,8 +249,12 @@ done: * * Purpose: Retrieves the ID for a registered VOL connector. * - * Return: Positive if the VOL class has been registered - * Negative on error (if the class is not a valid class or not registered) + * Return: A valid VOL connector ID if a connector by that name has + * been registered. This ID will need to be closed using + * H5VLclose(). + * + * H5I_INVALID_HID on error or if a VOL connector of that + * name has not been registered. * * Programmer: Dana Robinson * June 17, 2017 @@ -269,7 +282,12 @@ done: * Function: H5VLget_connector_name * * Purpose: Returns the connector name for the VOL associated with the - * object or file ID + * object or file ID. + * + * This works like other calls where the caller must provide a + * buffer of the appropriate size for the library to fill in. + * i.e., passing in a NULL pointer for NAME will return the + * required size of the buffer. * * Return: Success: The length of the connector name * @@ -336,6 +354,9 @@ done: * this VOL connector or files which are already opened under with * this connector. * + * The native VOL connector cannot be unregistered and attempts + * to do so are considered an error. + * * Return: Success: Non-negative * * Failure: Negative -- cgit v0.12 From 5098894ffde76620db2798fba900287aaf518166 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 11 Jun 2019 04:09:27 -0700 Subject: Fixed a memory issue where unfreed shared attribute dataspace memory tripped an assert in our memory sanity checks. Fixes HDFFV-10774. --- src/H5Oattr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 0a7c4bf..f9c5fcf 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -200,7 +200,7 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, * What's actually shared, though, is only the extent. */ if(NULL == (attr->shared->ds = H5FL_CALLOC(H5S_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Decode attribute's dataspace extent */ if((extent = (H5S_extent_t *)(H5O_MSG_SDSPACE->decode)(f, open_oh, @@ -253,6 +253,8 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, done: if(NULL == ret_value) if(attr) { + if(attr->shared->ds) + attr->shared->ds = H5FL_FREE(H5S_t, attr->shared->ds); if(attr->shared) { /* Free any dynamically allocated items */ if(H5A__free(attr) < 0) -- cgit v0.12 From 2bd041f8787562928ba8a060843cdeeb386bebf0 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 11 Jun 2019 09:04:23 -0700 Subject: Added H5Fdelete call and VOL support (but no VFD/native implementation). --- java/src/hdf/hdf5lib/HDF5Constants.java | 3 + .../hdf5lib/exceptions/HDF5LibraryException.java | 5 +- java/src/jni/h5Constants.c | 2 + src/H5F.c | 73 +++++++++++++- src/H5Fint.c | 4 +- src/H5Fpublic.h | 1 + src/H5VLcallback.c | 2 +- src/H5VLnative_file.c | 8 +- src/H5VLpassthru.c | 2 +- src/H5VLpublic.h | 3 +- src/H5err.txt | 1 + src/H5trace.c | 3 + test/tfile.c | 107 +++++++++++++++++++++ 13 files changed, 202 insertions(+), 12 deletions(-) diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 8054ee8..cb5ed22 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -121,6 +121,7 @@ public class HDF5Constants { public static final long H5E_CANTDEC = H5E_CANTDEC(); public static final long H5E_CANTDECODE = H5E_CANTDECODE(); public static final long H5E_CANTDELETE = H5E_CANTDELETE(); + public static final long H5E_CANTDELETEFILE = H5E_CANTDELETEFILE(); public static final long H5E_CANTENCODE = H5E_CANTENCODE(); public static final long H5E_CANTFLUSH = H5E_CANTFLUSH(); public static final long H5E_CANTFREE = H5E_CANTFREE(); @@ -863,6 +864,8 @@ public class HDF5Constants { private static native final long H5E_CANTDELETE(); + private static native final long H5E_CANTDELETEFILE(); + private static native final long H5E_CANTENCODE(); private static native final long H5E_CANTFLUSH(); diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java index 3a1361a..54acbdd 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java @@ -171,6 +171,9 @@ public class HDF5LibraryException extends HDF5Exception { else if (err_code == HDF5Constants.H5E_MOUNT) { return "file mount error"; } + else if (err_code == HDF5Constants.H5E_CANTDELETEFILE) { + return "Unable to delete file"; + } else if (err_code == HDF5Constants.H5E_SEEKERROR) { return "seek failed"; } @@ -262,7 +265,7 @@ public class HDF5LibraryException extends HDF5Exception { return "unrecognized message"; } else if (err_code == HDF5Constants.H5E_CANTDELETE) { - return " Can't delete message"; + return "Can't delete message"; } else if (err_code == HDF5Constants.H5E_CANTOPENOBJ) { return "Can't open object"; diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 4b10479..b9e320f 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -204,6 +204,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDECODE(JNIEnv *env, jclass cls) { return JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDELETE(JNIEnv *env, jclass cls) { return H5E_CANTDELETE; } JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDELETEFILE(JNIEnv *env, jclass cls) { return H5E_CANTDELETEFILE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTENCODE(JNIEnv *env, jclass cls) { return H5E_CANTENCODE; } JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTFLUSH(JNIEnv *env, jclass cls) { return H5E_CANTFLUSH; } diff --git a/src/H5F.c b/src/H5F.c index 779c940..e123d0b 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -560,20 +560,21 @@ done: * * Purpose: Check if the file can be opened with the given fapl. * - * Return: TRUE/FALSE/FAIL + * Return: Succeed: TRUE/FALSE + * Failure: FAIL (includes file does not exist) * *------------------------------------------------------------------------- */ htri_t -H5Fis_accessible(const char *name, hid_t fapl_id) +H5Fis_accessible(const char *filename, hid_t fapl_id) { htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("t", "*si", name, fapl_id); + H5TRACE2("t", "*si", filename, fapl_id); /* Check args */ - if(!name || !*name) + if(!filename || !*filename) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") /* Check the file access property list */ @@ -584,7 +585,7 @@ H5Fis_accessible(const char *name, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") /* Check if file is accessible */ - if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0) + if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, filename, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5") done: @@ -838,6 +839,68 @@ done: /*------------------------------------------------------------------------- + * Function: H5Fdelete + * + * Purpose: Deletes an HDF5 file. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5Fdelete(const char *filename, hid_t fapl_id) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + htri_t is_hdf5 = FAIL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "*si", filename, fapl_id); + + /* Check args */ + if(!filename || !*filename) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") + + /* Check the file access property list */ + if(H5P_DEFAULT == fapl_id) + fapl_id = H5P_FILE_ACCESS_DEFAULT; + else + if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + + /* Get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(fapl_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") + + /* Stash a copy of the "top-level" connector property, before any pass-through + * connectors modify or unwrap it. + */ + if(H5CX_set_vol_connector_prop(&connector_prop) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context") + + /* Make sure this is HDF5 storage for this VOL connector */ + if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, filename, &is_hdf5) < 0) + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5") + if(!is_hdf5) + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "not an HDF5 file") + + /* Delete the file */ + if(H5VL_file_specific(NULL, H5VL_FILE_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, filename, &ret_value) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "unable to delete the file") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Fdelete() */ + + +/*------------------------------------------------------------------------- * Function: H5Freopen * * Purpose: Reopen a file. The new file handle which is returned points diff --git a/src/H5Fint.c b/src/H5Fint.c index 2e8771c..ee9afed 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -863,7 +863,7 @@ H5F__is_hdf5(const char *name, hid_t fapl_id) * should work with arbitrary VFDs, unlike H5Fis_hdf5(). */ if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF))) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to open file") /* The file is an hdf5 file if the hdf5 file signature can be found */ if(H5FD_locate_signature(file, &sig_addr) < 0) @@ -874,7 +874,7 @@ done: /* Close the file */ if(file) if(H5FD_close(file) < 0 && TRUE == ret_value) - HDONE_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__is_hdf5() */ diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 52f1ee2..dd794e4 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -233,6 +233,7 @@ H5_DLL hid_t H5Fopen(const char *filename, unsigned flags, H5_DLL hid_t H5Freopen(hid_t file_id); H5_DLL herr_t H5Fflush(hid_t object_id, H5F_scope_t scope); H5_DLL herr_t H5Fclose(hid_t file_id); +H5_DLL herr_t H5Fdelete(const char *filename, hid_t fapl_id); H5_DLL hid_t H5Fget_create_plist(hid_t file_id); H5_DLL hid_t H5Fget_access_plist(hid_t file_id); H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned *intent); diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 2d1274c..696ccab 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -3041,7 +3041,7 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t arg_started = TRUE; /* Special treatment of file access check */ - if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { + if(specific_type == H5VL_FILE_IS_ACCESSIBLE || specific_type == H5VL_FILE_DELETE) { H5P_genplist_t *plist; /* Property list pointer */ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ va_list tmp_args; /* argument list passed from the API call */ diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c index 8903911..eeaade6 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -386,10 +386,16 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, /* Call private routine */ if((*ret = H5F__is_hdf5(name, fapl_id)) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "error in HDF5 file check") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "error in HDF5 file check") break; } + /* H5Fdelete */ + case H5VL_FILE_DELETE: + { + HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL, "H5Fdelete() is currently not supported in the native VOL connector") + break; + } default: diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index ef92ddb..78150c5 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -1733,7 +1733,7 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, /* Re-issue 'file specific' call, using the unwrapped pieces */ ret_value = H5VL_pass_through_file_specific_reissue(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, (int)loc_type, name, child_file->under_object, plist_id); } /* end if */ - else if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { + else if(specific_type == H5VL_FILE_IS_ACCESSIBLE || specific_type == H5VL_FILE_DELETE) { H5VL_pass_through_info_t *info; hid_t fapl_id, under_fapl_id; const char *name; diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index ebe424a..fc3ee8a 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -105,7 +105,8 @@ typedef enum H5VL_file_specific_t { H5VL_FILE_REOPEN, /* Reopen the file */ H5VL_FILE_MOUNT, /* Mount a file */ H5VL_FILE_UNMOUNT, /* Unmount a file */ - H5VL_FILE_IS_ACCESSIBLE /* Check if a file is accessible */ + H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */ + H5VL_FILE_DELETE /* Delete a file */ } H5VL_file_specific_t; /* types for group GET callback */ diff --git a/src/H5err.txt b/src/H5err.txt index 4eedc0f..d4edfba 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -134,6 +134,7 @@ MINOR, FILEACC, H5E_NOTHDF5, Not an HDF5 file MINOR, FILEACC, H5E_BADFILE, Bad file ID accessed MINOR, FILEACC, H5E_TRUNCATED, File has been truncated MINOR, FILEACC, H5E_MOUNT, File mount error +MINOR, FILEACC, H5E_CANTDELETEFILE, Unable to delete file # Generic low-level file I/O errors MINOR, FILE, H5E_SEEKERROR, Seek failed diff --git a/src/H5trace.c b/src/H5trace.c index 1125072..ff81ae8 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -2758,6 +2758,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5VL_FILE_IS_ACCESSIBLE: HDfprintf(out, "H5VL_FILE_IS_ACCESSIBLE"); break; + case H5VL_FILE_DELETE: + HDfprintf(out, "H5VL_FILE_DELETE"); + break; default: HDfprintf(out, "%ld", (long)specific); break; diff --git a/test/tfile.c b/test/tfile.c index 695d437..6318787 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1850,6 +1850,102 @@ test_file_ishdf5(const char *env_h5_drvr) } /* end test_file_ishdf5() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ + +/**************************************************************** +** +** test_file_delete(): tests H5Fdelete for all VFDs +** +*****************************************************************/ +#define FILE_DELETE "test_file_delete" +#define FILE_DELETE_NOT_HDF5 "test_file_delete_not_hdf5" +static void +test_file_delete(hid_t fapl_id) +{ + hid_t fid = H5I_INVALID_HID; /* File to be deleted */ + char filename[FILENAME_LEN]; /* Filename to use */ + htri_t is_hdf5; /* Whether a file is an HDF5 file */ + int fd; /* POSIX file descriptor */ + int iret; + herr_t ret; + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Deletion of HDF5 Files\n")); + + /*************/ + /* HDF5 FILE */ + /*************/ + + /* This is just a placeholder until the native VOL connector supports + * H5Fdelete(). + */ + + /* Get fapl-dependent filename */ + h5_fixname(FILE_DELETE, fapl_id, filename, sizeof(filename)); + + /* Create a file */ + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); + + /* Close file */ + ret = H5Fclose(fid); + VERIFY(ret, SUCCEED, "H5Fclose"); + + /* Verify that the file is an HDF5 file */ + is_hdf5 = H5Fis_accessible(filename, fapl_id); + VERIFY(is_hdf5, TRUE, "H5Fis_accessible"); + + /* Attempt to delete the file - should fail */ + H5E_BEGIN_TRY { + ret = H5Fdelete(filename, fapl_id); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Fdelete"); + + /* Verify that the file still exists */ + is_hdf5 = H5Fis_accessible(filename, fapl_id); + VERIFY(is_hdf5, TRUE, "H5Fis_accessible"); + + /* Actually delete the test file */ + h5_delete_test_file(FILE_DELETE, fapl_id); + + /*****************/ + /* NON-HDF5 FILE */ + /*****************/ + + /* Get fapl-dependent filename */ + h5_fixname(FILE_DELETE_NOT_HDF5, fapl_id, filename, sizeof(filename)); + + /* Create a non-HDF5 file */ + fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW); + CHECK_I(fd, "HDopen"); + + /* Close the file */ + ret = HDclose(fd); + VERIFY(ret, 0, "HDclose"); + + /* Verify that the file is not an HDF5 file */ + /* Note that you can get a FAIL result when h5_fixname() + * perturbs the filename as a file with that exact name + * may not have been created since we created it with + * open(2) and not the library. + */ + H5E_BEGIN_TRY { + is_hdf5 = H5Fis_accessible(filename, fapl_id); + } H5E_END_TRY; + VERIFY(is_hdf5, SUCCEED, "H5Fis_accessible"); + + /* Try to delete it (should fail) */ + H5E_BEGIN_TRY { + ret = H5Fdelete(filename, fapl_id); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Fdelete"); + + /* Delete the file */ + iret = HDremove(filename); + VERIFY(iret, 0, "HDremove"); + +} /* end test_file_delete() */ + + /**************************************************************** ** ** test_file_open_dot(): low-level file test routine. @@ -7606,6 +7702,8 @@ void test_file(void) { const char *env_h5_drvr; /* File Driver value from environment */ + hid_t fapl_id = H5I_INVALID_HID; /* VFD-dependent fapl ID */ + herr_t ret; /* Output message about test being performed */ MESSAGE(5, ("Testing Low-Level File I/O\n")); @@ -7615,6 +7713,10 @@ test_file(void) if(env_h5_drvr == NULL) env_h5_drvr = "nomatch"; + /* Improved version of VFD-dependent checks */ + fapl_id = h5_fileaccess(); + CHECK(fapl_id, H5I_INVALID_HID, "h5_fileaccess"); + test_file_create(); /* Test file creation(also creation templates)*/ test_file_open(); /* Test file opening */ test_file_reopen(); /* Test file reopening */ @@ -7624,6 +7726,7 @@ test_file(void) test_file_perm(); /* Test file access permissions */ test_file_perm2(); /* Test file access permission again */ test_file_is_accessible(env_h5_drvr); /* Test detecting HDF5 files correctly */ + test_file_delete(fapl_id); /* Test H5Fdelete */ test_file_open_dot(); /* Test opening objects with "." for a name */ test_file_open_overlap(); /* Test opening files in an overlapping manner */ test_file_getname(); /* Test basic H5Fget_name() functionality */ @@ -7662,6 +7765,10 @@ test_file(void) test_file_ishdf5(env_h5_drvr); /* Test detecting HDF5 files correctly */ test_deprec(); /* Test deprecated routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ + + ret = H5Pclose(fapl_id); + CHECK(ret, FAIL, "H5Pclose"); + } /* test_file() */ -- cgit v0.12 From c4ee9ef7c05ce79e4503c1e5b3edfe8f912de60e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 11 Jun 2019 04:09:27 -0700 Subject: Fixed a memory issue where unfreed shared attribute dataspace memory tripped an assert in our memory sanity checks. Fixes HDFFV-10774. --- src/H5Adense.c | 10 +++------- src/H5Aint.c | 17 +++++++++++------ src/H5Oattr.c | 13 ++++--------- src/H5S.c | 10 +++++++--- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/H5Adense.c b/src/H5Adense.c index 81e0dc5..ceac7d9 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -325,14 +325,10 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) */ if(*user_attr != NULL) { H5A_t *old_attr = *user_attr; - if(old_attr->shared) { - /* Free any dynamically allocated items */ - if(H5A__free(old_attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info") - /* Destroy shared attribute struct */ - old_attr->shared = H5FL_FREE(H5A_shared_t, old_attr->shared); - } /* end if */ + /* Free any dynamically allocated items */ + if(H5A__free(old_attr) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info") old_attr = H5FL_FREE(H5A_t, old_attr); } /* end if */ diff --git a/src/H5Aint.c b/src/H5Aint.c index 6162401..2240657 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -1113,24 +1113,32 @@ H5A__free(H5A_t *attr) HDassert(attr); - /* Free dynamically allocated items */ + if(!attr->shared) + HGOTO_DONE(SUCCEED) + + /* Free dynamically allocated items. + * When possible, keep trying to shut things down (via HDONE_ERROR). + */ if(attr->shared->name) { H5MM_xfree(attr->shared->name); attr->shared->name = NULL; } if(attr->shared->dt) { if(H5T_close_real(attr->shared->dt) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info") + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info") attr->shared->dt = NULL; } if(attr->shared->ds) { if(H5S_close(attr->shared->ds) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info") + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info") attr->shared->ds = NULL; } if(attr->shared->data) attr->shared->data = H5FL_BLK_FREE(attr_buf, attr->shared->data); + /* Destroy shared attribute struct */ + attr->shared = H5FL_FREE(H5A_shared_t, attr->shared); + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__free() */ @@ -1199,9 +1207,6 @@ H5A__close(H5A_t *attr) /* Free dynamically allocated items */ if(H5A__free(attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info") - - /* Destroy shared attribute struct */ - attr->shared = H5FL_FREE(H5A_shared_t, attr->shared); } /* end if */ else { /* There are other references to the shared part of the attribute. diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 0a7c4bf..653c23a 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -200,7 +200,7 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, * What's actually shared, though, is only the extent. */ if(NULL == (attr->shared->ds = H5FL_CALLOC(H5S_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Decode attribute's dataspace extent */ if((extent = (H5S_extent_t *)(H5O_MSG_SDSPACE->decode)(f, open_oh, @@ -253,14 +253,9 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, done: if(NULL == ret_value) if(attr) { - if(attr->shared) { - /* Free any dynamically allocated items */ - if(H5A__free(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't release attribute info") - - /* Destroy shared attribute struct */ - attr->shared = H5FL_FREE(H5A_shared_t, attr->shared); - } /* end if */ + /* Free any dynamically allocated items */ + if(H5A__free(attr) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't release attribute info") attr = H5FL_FREE(H5A_t, attr); } /* end if */ diff --git a/src/H5S.c b/src/H5S.c index 3926b5f..e50985f 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -448,10 +448,14 @@ H5S_close(H5S_t *ds) if(H5S__extent_release(&ds->extent) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent") - /* Release the main structure */ - ds = H5FL_FREE(H5S_t, ds); - done: + /* Release the main structure. + * Always do this to ensure that we don't leak memory when calling this + * function on partially constructed dataspaces (which will fail one or + * both of the above calls) + */ + H5FL_FREE(H5S_t, ds); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_close() */ -- cgit v0.12 From 893641990a23adae72df309d601416169b9e848c Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Tue, 11 Jun 2019 14:28:10 -0500 Subject: move the vol_info to an optional parameter --- fortran/src/H5Pff.F90 | 21 ++++++++++++++------- fortran/test/vol_connector.F90 | 12 +++++------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index 8ad3573..0c0500d 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -9,7 +9,7 @@ ! COPYRIGHT ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * -! Copyright by the Board of Trustees of the University of Illinois. *S +! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * ! * ! This file is part of HDF5. The full HDF5 copyright notice, including * @@ -8125,25 +8125,29 @@ END SUBROUTINE h5pget_virtual_dsetname_f ! INPUTS ! plist_id - access property list identifier. ! new_vol_id - VOL connector id. -! new_vol_info - VOL connector info. ! ! OUTPUTS -! hdferr - error code: -! 0 on success and -1 on failure +! hdferr - error code: +! 0 on success and -1 on failure +! +! OPTIONAL +! new_vol_info - VOL connector info. ! ! AUTHOR ! M.S. Breitenfeld ! May 2019 ! ! Fortran Interface: - SUBROUTINE h5pset_vol_f(plist_id, new_vol_id, new_vol_info, hdferr) + SUBROUTINE h5pset_vol_f(plist_id, new_vol_id, hdferr, new_vol_info) IMPLICIT NONE INTEGER(HID_T) , INTENT(IN) :: plist_id INTEGER(HID_T) , INTENT(IN) :: new_vol_id - TYPE(C_PTR) , INTENT(IN) :: new_vol_info INTEGER , INTENT(OUT) :: hdferr + TYPE(C_PTR) , OPTIONAL :: new_vol_info !***** + TYPE(C_PTR) :: new_vol_info_default + INTERFACE INTEGER FUNCTION h5pset_vol(plist_id, new_vol_id, new_vol_info) BIND(C, NAME='H5Pset_vol') IMPORT :: HID_T, C_PTR @@ -8154,7 +8158,10 @@ END SUBROUTINE h5pget_virtual_dsetname_f END FUNCTION h5pset_vol END INTERFACE - hdferr = INT(h5pset_vol(plist_id, new_vol_id, new_vol_info)) + new_vol_info_default = C_NULL_PTR + IF(PRESENT(new_vol_info)) new_vol_info_default=new_vol_info + + hdferr = INT(h5pset_vol(plist_id, new_vol_id, new_vol_info_default)) END SUBROUTINE h5pset_vol_f diff --git a/fortran/test/vol_connector.F90 b/fortran/test/vol_connector.F90 index c2ee6dd..62e3f8d 100644 --- a/fortran/test/vol_connector.F90 +++ b/fortran/test/vol_connector.F90 @@ -188,23 +188,21 @@ CONTAINS CALL check("H5Pcreate_f",error,total_error) f_ptr = C_NULL_PTR - CALL H5Pset_vol_f(fapl_id, vol_id, f_ptr, error) + CALL H5Pset_vol_f(fapl_id, vol_id, error) CALL check("H5Pset_vol_f",error,total_error) CALL H5Pget_vol_id_f(fapl_id, vol_id_out, error) CALL check("H5Pget_vol_id_f",error,total_error) CALL VERIFY("H5Pget_vol_id_f", vol_id_out, vol_id, total_error) -#if 0 - CALL H5Pcreate_f(H5P_FILE_ACCESS_F, under_fapl, error) - CALL check("H5Pcreate_f",error,total_error) - f_ptr = C_LOC(under_fapl) - CALL H5Pset_vol_f(fapl_id, vol_id, f_ptr, error) + + f_ptr = C_NULL_PTR + CALL H5Pset_vol_f(fapl_id, vol_id, error, f_ptr) CALL check("H5Pset_vol_f",error,total_error) CALL H5Pget_vol_id_f(fapl_id, vol_id_out, error) CALL check("H5Pget_vol_id_f",error,total_error) CALL VERIFY("H5Pget_vol_id_f", vol_id_out, vol_id, total_error) -#endif + CALL H5VLget_connector_id_f(NATIVE_VOL_CONNECTOR_NAME, vol_id_out, error) CALL check("H5VLget_connector_id_f",error,total_error) CALL VERIFY("H5VLget_connector_id_f", vol_id_out, vol_id, total_error) -- cgit v0.12 From 0cf52525d5b45cc7cf6f89267da76b46ffa75f90 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 11 Jun 2019 14:14:13 -0700 Subject: H5A__free() was renamed to H5A__shared_free() and now requires attr->shared to not be NULL. --- src/H5Adense.c | 5 +++-- src/H5Aint.c | 26 +++++++++++++------------- src/H5Apkg.h | 2 +- src/H5Oattr.c | 5 +++-- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/H5Adense.c b/src/H5Adense.c index ceac7d9..bddfe31 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -327,8 +327,9 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) H5A_t *old_attr = *user_attr; /* Free any dynamically allocated items */ - if(H5A__free(old_attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info") + if(old_attr->shared) + if(H5A__shared_free(old_attr) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info") old_attr = H5FL_FREE(H5A_t, old_attr); } /* end if */ diff --git a/src/H5Aint.c b/src/H5Aint.c index 2240657..2126444 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -1092,29 +1092,29 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__free + * Function: H5A__shared_free * - * Purpose: Frees all memory associated with an attribute, but does not - * free the H5A_t structure (which should be done in H5T_close). + * Purpose: Cleans up the shared attribute data. This will free + * the attribute's shared structure as well. + * + * attr and attr->shared must not be NULL * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, November 15, 2004 + * Programmer: Quincey Koziol + * Monday, November 15, 2004 * *------------------------------------------------------------------------- */ herr_t -H5A__free(H5A_t *attr) +H5A__shared_free(H5A_t *attr) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE HDassert(attr); - - if(!attr->shared) - HGOTO_DONE(SUCCEED) + HDassert(attr->shared); /* Free dynamically allocated items. * When possible, keep trying to shut things down (via HDONE_ERROR). @@ -1139,9 +1139,8 @@ H5A__free(H5A_t *attr) /* Destroy shared attribute struct */ attr->shared = H5FL_FREE(H5A_shared_t, attr->shared); -done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5A__free() */ +} /* end H5A__shared_free() */ /*------------------------------------------------------------------------- @@ -1205,8 +1204,9 @@ H5A__close(H5A_t *attr) /* Reference count can be 0. It only happens when H5A__create fails. */ if(attr->shared->nrefs <= 1) { /* Free dynamically allocated items */ - if(H5A__free(attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info") + if(attr->shared) + if(H5A__shared_free(attr) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info") } /* end if */ else { /* There are other references to the shared part of the attribute. diff --git a/src/H5Apkg.h b/src/H5Apkg.h index 91061cd..f3870c0 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -196,7 +196,7 @@ H5_DLL H5A_t *H5A__copy(H5A_t *new_attr, const H5A_t *old_attr); H5_DLL hid_t H5A__get_type(H5A_t *attr); H5_DLL herr_t H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo); H5_DLL hid_t H5A__get_create_plist(H5A_t* attr); -H5_DLL herr_t H5A__free(H5A_t *attr); +H5_DLL herr_t H5A__shared_free(H5A_t *attr); H5_DLL herr_t H5A__close(H5A_t *attr); H5_DLL herr_t H5A__close_cb(H5VL_object_t *attr_vol_obj); H5_DLL htri_t H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo); diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 653c23a..f685a00c 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -254,8 +254,9 @@ done: if(NULL == ret_value) if(attr) { /* Free any dynamically allocated items */ - if(H5A__free(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't release attribute info") + if(attr->shared) + if(H5A__shared_free(attr) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't release attribute info") attr = H5FL_FREE(H5A_t, attr); } /* end if */ -- cgit v0.12 From bb5e7822f447b8a175e807e2e7bad5e0192394e5 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 11 Jun 2019 14:39:39 -0700 Subject: Fixed an error string typo --- src/H5F.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5F.c b/src/H5F.c index e123d0b..d216cd2 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -867,7 +867,7 @@ H5Fdelete(const char *filename, hid_t fapl_id) fapl_id = H5P_FILE_ACCESS_DEFAULT; else if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) -- cgit v0.12 From 0742c15fca95965ed4eb87c6d54f41bb07bd4526 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Wed, 12 Jun 2019 09:21:59 -0500 Subject: makefile clean-up --- fortran/test/Makefile.am | 2 -- 1 file changed, 2 deletions(-) diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index 9e03996..f0d7f03 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -34,8 +34,6 @@ else AM_LDFLAGS+=-static endif -check_SCRIPTS = $(TEST_SCRIPT) - # Our main targets, the tests themselves TEST_PROG=fortranlib_test fflush1 fflush2 fortranlib_test_1_8 fortranlib_test_F03 vol_connector -- cgit v0.12 From 5385f032dd5aaf9a09c2a86374c0d3a826e41010 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Wed, 12 Jun 2019 10:21:41 -0500 Subject: Modified Makefile.ams for h5repack, h5watch and gif2h5 to allow disabling tests. Moved h5cc.in from tools/src/misc to src directory to always create h5cc whether or not tools are enabled. Added configuration status of tools and tests to libhdf5.settings. --- MANIFEST | 2 +- configure.ac | 4 +- hl/tools/gif2h5/Makefile.am | 12 +- hl/tools/h5watch/Makefile.am | 27 +-- src/Makefile.am | 18 +- src/h5cc.in | 399 +++++++++++++++++++++++++++++++++++++++++ src/libhdf5.settings.in | 2 + tools/src/h5repack/Makefile.am | 2 +- tools/src/misc/Makefile.am | 13 -- tools/src/misc/h5cc.in | 399 ----------------------------------------- 10 files changed, 444 insertions(+), 434 deletions(-) create mode 100644 src/h5cc.in delete mode 100644 tools/src/misc/h5cc.in diff --git a/MANIFEST b/MANIFEST index c3dc0e9..dbdbcff 100644 --- a/MANIFEST +++ b/MANIFEST @@ -934,6 +934,7 @@ ./src/H5Ztrans.c ./src/Makefile.am ./src/hdf5.h +./src/h5cc.in ./src/libhdf5.settings.in ./src/H5win32defs.h @@ -1538,7 +1539,6 @@ ./tools/lib/io_timer.h ./tools/src/misc/Makefile.am -./tools/src/misc/h5cc.in ./tools/src/misc/h5clear.c ./tools/src/misc/h5debug.c ./tools/src/misc/h5mkgrp.c diff --git a/configure.ac b/configure.ac index 7846357..9cfb9a1 100644 --- a/configure.ac +++ b/configure.ac @@ -3518,6 +3518,7 @@ AM_CONDITIONAL([HAVE_SHARED_CONDITIONAL], [test "X$enable_shared" = "Xyes"]) AC_CONFIG_FILES([src/libhdf5.settings Makefile src/Makefile + src/h5cc test/Makefile test/H5srcdir_str.h test/testabort_fail.sh @@ -3546,7 +3547,6 @@ AC_CONFIG_FILES([src/libhdf5.settings tools/src/h5ls/Makefile tools/src/h5copy/Makefile tools/src/misc/Makefile - tools/src/misc/h5cc tools/src/h5stat/Makefile tools/test/Makefile tools/test/h5dump/Makefile @@ -3648,7 +3648,7 @@ AC_CONFIG_COMMANDS([.classes], [], [$MKDIR_P java/src/.classes; AC_OUTPUT -chmod 755 tools/src/misc/h5cc +chmod 755 src/h5cc if test "X$HDF_CXX" = "Xyes"; then chmod 755 c++/src/h5c++ fi diff --git a/hl/tools/gif2h5/Makefile.am b/hl/tools/gif2h5/Makefile.am index d30d66a..9ffde58 100644 --- a/hl/tools/gif2h5/Makefile.am +++ b/hl/tools/gif2h5/Makefile.am @@ -23,11 +23,7 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/sr # These are our main targets, the tools -TEST_SCRIPT=h52giftest.sh -check_SCRIPTS=$(TEST_SCRIPT) - bin_PROGRAMS=gif2h5 h52gif -noinst_PROGRAMS=h52gifgentst # Add h52gif and gif2h5 specific linker flags here h52gif_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) @@ -37,12 +33,18 @@ gif2h5_SOURCES=gif2hdf.c gif2mem.c decompress.c gifread.c writehdf.c h52gif_SOURCES=hdf2gif.c hdfgifwr.c -h52gifgentst_SOURCES=h52gifgentst.c # Programs all depend on the hdf5 library, the tools library, and the HL # library. LDADD=$(LIBH5_HL) $(LIBH5TOOLS) $(LIBHDF5) +if BUILD_TESTS_CONDITIONAL + TEST_SCRIPT=h52giftest.sh + check_SCRIPTS=$(TEST_SCRIPT) + noinst_PROGRAMS=h52gifgentst + h52gifgentst_SOURCES=h52gifgentst.c +endif + CHECK_CLEANFILES+=*.h5 CHECK_CLEANFILES+=*.gif diff --git a/hl/tools/h5watch/Makefile.am b/hl/tools/h5watch/Makefile.am index c60fceb..0bf265e 100644 --- a/hl/tools/h5watch/Makefile.am +++ b/hl/tools/h5watch/Makefile.am @@ -19,15 +19,12 @@ include $(top_srcdir)/config/commence.am # Include src and tools/lib directories -AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/src -I$(top_srcdir)/hl/test +AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/src # These are our main targets, the tools -TEST_SCRIPT=testh5watch.sh -check_SCRIPTS=$(TEST_SCRIPT) -SCRIPT_DEPEND=swmr_check_compat_vfd$(EXEEXT) extend_dset$(EXEEXT) h5watch$(EXEEXT) bin_PROGRAMS=h5watch -noinst_PROGRAMS=swmr_check_compat_vfd h5watchgentest extend_dset +noinst_PROGRAMS=swmr_check_compat_vfd # Add h5watch specific linker flags here h5watch_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) @@ -36,13 +33,19 @@ h5watch_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) # library. LDADD=$(LIBH5_HL) $(LIBH5TOOLS) $(LIBHDF5) -# Add extend_dset specific preprocessor flags here -# (add the main test subdirectory to the include file path) -extend_dset_CPPFLAGS=$(AM_CPPFLAGS) -I$(top_srcdir)/test -# Add extend_dset specific library flags here -# (add the main test library to the list of libraries) -extend_dset_LDADD=$(LDADD) $(LIBH5TEST) $(LIBHDF5) - +if BUILD_TESTS_CONDITIONAL + AM_CPPFLAGS+=-I$(top_srcdir)/hl/test + TEST_SCRIPT=testh5watch.sh + check_SCRIPTS=$(TEST_SCRIPT) + SCRIPT_DEPEND=swmr_check_compat_vfd$(EXEEXT) extend_dset$(EXEEXT) h5watch$(EXEEXT) + noinst_PROGRAMS+=h5watchgentest extend_dset + # Add extend_dset specific preprocessor flags here + # (add the main test subdirectory to the include file path) + extend_dset_CPPFLAGS=$(AM_CPPFLAGS) -I$(top_srcdir)/test + # Add extend_dset specific library flags here + # (add the main test library to the list of libraries) + extend_dset_LDADD=$(LDADD) $(LIBH5TEST) $(LIBHDF5) +endif # CHECK_CLEANFILES+=*.h5 DISTCLEANFILES=testh5watch.sh diff --git a/src/Makefile.am b/src/Makefile.am index 378e390..f74d18f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,10 +32,18 @@ lib_LTLIBRARIES=libhdf5.la # Add libtool numbers to the HDF5 library (from config/lt_vers.am) libhdf5_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS) +# h5cc needs custom install and uninstall rules, since it may be +# named h5pcc if hdf5 is being built in parallel mode. +if BUILD_PARALLEL_CONDITIONAL + H5CC_NAME=h5pcc +else + H5CC_NAME=h5cc +endif + # H5Tinit.c and H5lib_settings.c are generated files and should be cleaned. MOSTLYCLEANFILES=H5Tinit.c H5lib_settings.c # H5pubconf.h is generated by configure, and should be cleaned. -DISTCLEANFILES=H5pubconf.h +DISTCLEANFILES=H5pubconf.h $(H5CC_NAME) # library sources libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ @@ -150,6 +158,8 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers settingsdir=$(libdir) settings_DATA=libhdf5.settings +bin_SCRIPTS=$(H5CC_NAME) + # Number format detection # The LD_LIBRARY_PATH setting is a kludge. # Things should have been all set during H5detect making. @@ -208,4 +218,10 @@ trace: $(libhdf5_la_SOURCES) fi; \ done +#install-exec-local: +# @$(INSTALL) h5cc $(DESTDIR)$(bindir)/$(H5CC_NAME) +#uninstall-local: +# @$(RM) $(DESTDIR)$(bindir)/$(H5CC_NAME) + include $(top_srcdir)/config/conclude.am + diff --git a/src/h5cc.in b/src/h5cc.in new file mode 100644 index 0000000..9c4e3ca --- /dev/null +++ b/src/h5cc.in @@ -0,0 +1,399 @@ +#! /bin/sh +## +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +## + +# This tool is adapted from the mpicc command of the MPICH Software. + +############################################################################ +## ## +## Things You May Have to Modify: ## +## ## +## If the following paths don't point to the place were HDF5 is installed ## +## on your system (i.e., you received a binary distribution or moved the ## +## files from the originally installed directory to another directory) ## +## then modify them accordingly to represent the new paths. ## +## ## +############################################################################ +prefix="@prefix@" +exec_prefix="@exec_prefix@" +libdir="@libdir@" +includedir="@includedir@" +HL="@HL@" + +############################################################################ +## ## +## Things You Can Modify to Override HDF5 Library Build Components: ## +## ## +## (Advanced usage - know what you're doing - you're on your own here.) ## +## The four variables below can be used to insert paths and flags in ## +## CPPFLAGS, CFLAGS, LDFLAGS, or LIBS in the h5cc compile line: ## +## $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS ## +## $LIBS $clibpath $link_objs $link_args $shared_link ## +## ## +## These settings can be overriden by setting HDF5_CFLAGS, ## +## HDF5_CPPFLAGS, HDF5_LDFLAGS, or HDF5_LIBS in the environment. ## +## ## +############################################################################ +CFLAGSBASE="" +CPPFLAGSBASE="" +LDFLAGSBASE="" +LIBSBASE="" + +############################################################################ +## ## +## You shouldn't have to modify anything below this line. ## +## ## +############################################################################ + +# Constants definitions +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +host_os="@host_os@" + +prog_name="`basename $0`" + +allargs="" +compile_args="" +libraries="" +link_args="" +link_objs="" +clibpath="" + +do_link="yes" +do_compile="no" +dash_o="no" +dash_c="no" +get_output_file="no" + +SHOW="eval" +CCBASE="@CC@" +CLINKERBASE="@CC@" + +# CFLAGS, CPPFLAGS and LDFLAGS are reserved for use by the script user. +# FLAGS brought from the hdf5 build are put in H5BLD_*FLAGS. + +# User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's +# LDFLAGS come just before clibpath, user's LIBS come after $link_objs and +# before the hdf5 libraries in $link_args, followed by any external library +# paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in +# from the hdf5 build. The order of the flags is intended to give precedence +# to the user's flags. +H5BLD_CFLAGS="@AM_CFLAGS@ @CFLAGS@" +H5BLD_CPPFLAGS="@AM_CPPFLAGS@ @CPPFLAGS@" +H5BLD_LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@" +H5BLD_LIBS="@LIBS@" + +CC="${HDF5_CC:-$CCBASE}" +CLINKER="${HDF5_CLINKER:-$CLINKERBASE}" +CFLAGS="${HDF5_CFLAGS:-$CFLAGSBASE}" +CPPFLAGS="${HDF5_CPPFLAGS:-$CPPFLAGSBASE}" +LDFLAGS="${HDF5_LDFLAGS:-$LDFLAGSBASE}" +LIBS="${HDF5_LIBS:-$LIBSBASE}" + +# If a static library is available, the default will be to use it. If the only +# available library is shared, it will be used by default. The user can +# override either default, although choosing an unavailable library will result +# in link errors. +STATIC_AVAILABLE="@enable_static@" +if test "${STATIC_AVAILABLE}" = "yes"; then + USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}" +else + USE_SHARED_LIB="${HDF5_USE_SHLIB:-yes}" +fi + + +usage() { + # A wonderfully informative "usage" message. + echo "usage: $prog_name [OPTIONS] " + echo " OPTIONS:" + echo " -help This help message." + echo " -echo Show all the shell commands executed" + echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/" + echo " subdirectories [default: $prefix]" + # A wonderfully informative "usage" message. + echo "usage: $prog_name [OPTIONS] " + echo " OPTIONS:" + echo " -help This help message." + echo " -echo Show all the shell commands executed" + echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/" + echo " subdirectories [default: $prefix]" + echo " -show Show the commands without executing them" + echo " -showconfig Show the HDF5 library configuration summary" + echo " -shlib Compile with shared HDF5 libraries [default for hdf5 built" + echo " without static libraries]" + echo " -noshlib Compile with static HDF5 libraries [default for hdf5 built" + echo " with static libraries]" + echo " " + echo " - the normal compile line options for your compiler." + echo " $prog_name uses the same compiler you used to compile" + echo " HDF5. Check with your compiler's man pages for more" + echo " information on which options are needed." + echo " " + echo " You can override the compiler, linker, and whether or not to use static" + echo " or shared libraries to compile your program by setting the following" + echo " environment variables accordingly:" + echo " " + echo " HDF5_CC - use a different C compiler" + echo " HDF5_CLINKER - use a different linker" + echo " HDF5_USE_SHLIB=[yes|no] - use shared or static version of the HDF5 library" + echo " [default: no except when built with only" + echo " shared libraries]" + echo " " + echo " You can also add or change paths and flags to the compile line using" + echo " the following environment varibles or by assigning them to their counterparts" + echo " in the 'Things You Can Modify to Override...'" section of $prog_name + echo " " + echo " Variable Current value to be replaced" + echo " HDF5_CPPFLAGS \"$CPPFLAGSBASE\"" + echo " HDF5_CFLAGS \"$CFLAGSBASE\"" + echo " HDF5_LDFLAGS \"$LDFLAGSBASE\"" + echo " HDF5_LIBS \"$LIBSBASE\"" + echo " " + echo " Note that adding library paths to HDF5_LDFLAGS where another hdf5 version" + echo " is located may link your program with that other hdf5 library version." + echo " " + exit $EXIT_FAILURE +} + +# Show the configuration summary of the library recorded in the +# libhdf5.settings file reside in the lib directory. +showconfigure() +{ + cat ${libdir}/libhdf5.settings + status=$? +} + +# Main +status=$EXIT_SUCCESS + +if test "$#" = "0"; then + # No parameters specified, issue usage statement and exit. + usage +fi + +case "$CC" in + gcc) + kind="gcc" + ;; + mpicc|mpcc|mpicc_r) + # Is this gcc masquarading as an MPI compiler? + if test "`${CC} -v 2>&1 | sed -n 2p | cut -c1-3`" = "gcc"; then + kind="gcc" + else + # Nope + kind="$host_os" + fi + ;; + *) + kind="$host_os" + ;; +esac + +for arg in $@ ; do + if test "x$get_output_file" = "xyes"; then + link_args="$link_args $arg" + output_file="$arg" + get_output_file="no" + continue + fi + + case "$arg" in + -c) + allargs="$allargs $arg" + compile_args="$compile_args $arg" + + if test "x$do_link" = "xyes" -a -n "$output_file"; then + compile_args="$compile_args -o $output_file" + fi + + do_link="no" + dash_c="yes" + ;; + -o) + allargs="$allargs $arg" + dash_o="yes" + + if test "x$dash_c" = "xyes"; then + compile_args="$compile_args $arg" + else + link_args="$link_args $arg" + do_link="yes" + get_output_file="yes" + fi + ;; + -E|-M|-MT) + allargs="$allargs $arg" + compile_args="$compile_args $arg" + dash_c="yes" + do_link="no" + ;; + -l*) + libraries=" $libraries $arg " + allargs="$allargs $arg" + ;; + -prefix=*) + prefix="`expr "$arg" : '-prefix=\(.*\)'`" + ;; + -echo) + set -x + ;; + -show) + SHOW="echo" + ;; + -showconfig) + showconfigure + exit $status + ;; + -shlib) + USE_SHARED_LIB="yes" + ;; + -noshlib) + USE_SHARED_LIB="no" + ;; + -help) + usage + ;; + *\"*) + qarg="'"$arg"'" + allargs="$allargs $qarg" + ;; + *\'*) + qarg='\"'"$arg"'\"' + allargs="$allargs $qarg" + ;; + *) + allargs="$allargs $qarg" + + if test -s "$arg"; then + ext=`expr "$arg" : '.*\(\..*\)'` + + if test "x$ext" = "x.c"; then + do_compile="yes" + compile_args="$compile_args $arg" + fname=`basename $arg .c` + link_objs="$link_objs $fname.o" + elif test "x$ext" = "x.o"; then + if test "x$dash_c" = "xyes"; then + compile_args="$compile_args $arg" + else + do_link="yes" + link_objs="$link_objs $arg" + fi + elif test "x$ext" = "x.a"; then + # This is an archive that we're linking in + libraries=" $libraries $arg " + else + compile_args="$compile_args $arg" + link_args="$link_args $arg" + fi + else + compile_args="$compile_args $arg" + link_args="$link_args $arg" + fi + ;; + esac +done + +if test "$dash_c" = "yes" -a "$do_compile" = no -a "$do_link" = no ; then + # -c was specified. Force do_compile on. + do_compile=yes +fi + +if test "x$do_compile" = "xyes"; then + if test "x$dash_c" != "xyes"; then + compile_args="-c $compile_args" + fi + + $SHOW $CC -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $compile_args + status=$? + + if test "$status" != "0"; then + exit $status + fi +fi + +if test "x$do_link" = "xyes"; then + shared_link="" +# conditionnaly link with the hl library + if test "X$HL" = "Xhl"; then + libraries=" $libraries -lhdf5_hl -lhdf5 " + else + libraries=" $libraries -lhdf5 " + fi + link_args="$link_args -L${libdir}" + + case "$kind" in + gcc|linux*) + # MacOS X doesn't support the "-Wl,-rpath -Wl," style of linker flags. + # It appears to want none of them specified. + case "$host_os" in + darwin*) flag="" ;; + *) flag="-Wl,-rpath -Wl," ;; + esac + ;; + hpux*) flag="-Wl,+b -Wl," ;; + freebsd*|solaris*) flag="-R" ;; + rs6000*|aix*) flag="-L" ;; + sgi) flag="-rpath " ;; + *) flag="" ;; + esac + + if test -n "$flag"; then + shared_link="${flag}${libdir}" + fi + + if test "x$USE_SHARED_LIB" != "xyes"; then + # The "-lhdf5" & "-lhdf5_hl" flags are in here already...This is a static + # compile though, so change it to the static version (.a) of the library. + new_libraries="" + for lib in $libraries; do + case "$lib" in + -lhdf5) + new_libraries="$new_libraries ${libdir}/libhdf5.a" + ;; + -lhdf5_hl) + new_libraries="$new_libraries ${libdir}/libhdf5_hl.a" + ;; + *) + new_libraries="$new_libraries $lib" + ;; + esac + done + libraries="$new_libraries" + fi + + for lib in $libraries; do + if echo $link_args | grep " $lib " > /dev/null || + echo $link_args | grep " $lib$" > /dev/null; then + : + else + link_args="$link_args $lib " + fi + done + + # The LIBS are just a bunch of -l* libraries necessary for the HDF5 + # module. It's okay if they're included twice in the compile line. + link_args="$link_args $H5BLD_LDFLAGS $H5BLD_LIBS" + + # User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's + # LDFLAGS come just before clibpath, user's LIBS come after $link_objs and + # before the hdf5 libraries in $link_args, followed by any external library + # paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in + # from the hdf5 build. The order of the flags is intended to give precedence + # to the user's flags. + $SHOW $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS $clibpath $link_objs $LIBS $link_args $shared_link + status=$? +fi + +exit $status diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 9d0e29f..37957a2 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -71,6 +71,8 @@ Features: Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@ Large Parallel I/O: @LARGE_PARALLEL_IO@ High-level library: @HDF5_HL@ + Build HDF5 Tests: @HDF5_TESTS@ + Build HDF5 TOOLS: @HDF5_TOOLS@ Threadsafety: @THREADSAFE@ Default API mapping: @DEFAULT_API_VERSION@ With deprecated public symbols: @DEPRECATED_SYMBOLS@ diff --git a/tools/src/h5repack/Makefile.am b/tools/src/h5repack/Makefile.am index c71e65b..925b8a7 100644 --- a/tools/src/h5repack/Makefile.am +++ b/tools/src/h5repack/Makefile.am @@ -28,7 +28,7 @@ libh5repack_la_SOURCES=h5repack.c h5repack_copy.c h5repack_filters.c \ h5repack_opttable.c h5repack_parse.c h5repack_refs.c \ h5repack_verify.c libh5repack_la_LDFLAGS = $(AM_LDFLAGS) -libh5repack_la_LIBADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5) +libh5repack_la_LIBADD=$(LIBH5TOOLS) $(LIBHDF5) # Our main target, h5repack tool diff --git a/tools/src/misc/Makefile.am b/tools/src/misc/Makefile.am index 64c5ee5..1353021 100644 --- a/tools/src/misc/Makefile.am +++ b/tools/src/misc/Makefile.am @@ -40,19 +40,6 @@ DISTCLEANFILES=h5cc # All programs rely on hdf5 library and h5tools library LDADD=$(LIBH5TOOLS) $(LIBHDF5) -# h5cc needs custom install and uninstall rules, since it may be -# named h5pcc if hdf5 is being built in parallel mode. -if BUILD_PARALLEL_CONDITIONAL - H5CC_NAME=h5pcc -else - H5CC_NAME=h5cc -endif - -install-exec-local: - @$(INSTALL) h5cc $(DESTDIR)$(bindir)/$(H5CC_NAME) -uninstall-local: - @$(RM) $(DESTDIR)$(bindir)/$(H5CC_NAME) - # How to build h5redeploy script h5redeploy: h5redeploy.in @cp $(srcdir)/$@.in $@ diff --git a/tools/src/misc/h5cc.in b/tools/src/misc/h5cc.in deleted file mode 100644 index 9c4e3ca..0000000 --- a/tools/src/misc/h5cc.in +++ /dev/null @@ -1,399 +0,0 @@ -#! /bin/sh -## -# Copyright by The HDF Group. -# Copyright by the Board of Trustees of the University of Illinois. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the COPYING file, which can be found at the root of the source code -# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. -## - -# This tool is adapted from the mpicc command of the MPICH Software. - -############################################################################ -## ## -## Things You May Have to Modify: ## -## ## -## If the following paths don't point to the place were HDF5 is installed ## -## on your system (i.e., you received a binary distribution or moved the ## -## files from the originally installed directory to another directory) ## -## then modify them accordingly to represent the new paths. ## -## ## -############################################################################ -prefix="@prefix@" -exec_prefix="@exec_prefix@" -libdir="@libdir@" -includedir="@includedir@" -HL="@HL@" - -############################################################################ -## ## -## Things You Can Modify to Override HDF5 Library Build Components: ## -## ## -## (Advanced usage - know what you're doing - you're on your own here.) ## -## The four variables below can be used to insert paths and flags in ## -## CPPFLAGS, CFLAGS, LDFLAGS, or LIBS in the h5cc compile line: ## -## $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS ## -## $LIBS $clibpath $link_objs $link_args $shared_link ## -## ## -## These settings can be overriden by setting HDF5_CFLAGS, ## -## HDF5_CPPFLAGS, HDF5_LDFLAGS, or HDF5_LIBS in the environment. ## -## ## -############################################################################ -CFLAGSBASE="" -CPPFLAGSBASE="" -LDFLAGSBASE="" -LIBSBASE="" - -############################################################################ -## ## -## You shouldn't have to modify anything below this line. ## -## ## -############################################################################ - -# Constants definitions -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -host_os="@host_os@" - -prog_name="`basename $0`" - -allargs="" -compile_args="" -libraries="" -link_args="" -link_objs="" -clibpath="" - -do_link="yes" -do_compile="no" -dash_o="no" -dash_c="no" -get_output_file="no" - -SHOW="eval" -CCBASE="@CC@" -CLINKERBASE="@CC@" - -# CFLAGS, CPPFLAGS and LDFLAGS are reserved for use by the script user. -# FLAGS brought from the hdf5 build are put in H5BLD_*FLAGS. - -# User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's -# LDFLAGS come just before clibpath, user's LIBS come after $link_objs and -# before the hdf5 libraries in $link_args, followed by any external library -# paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in -# from the hdf5 build. The order of the flags is intended to give precedence -# to the user's flags. -H5BLD_CFLAGS="@AM_CFLAGS@ @CFLAGS@" -H5BLD_CPPFLAGS="@AM_CPPFLAGS@ @CPPFLAGS@" -H5BLD_LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@" -H5BLD_LIBS="@LIBS@" - -CC="${HDF5_CC:-$CCBASE}" -CLINKER="${HDF5_CLINKER:-$CLINKERBASE}" -CFLAGS="${HDF5_CFLAGS:-$CFLAGSBASE}" -CPPFLAGS="${HDF5_CPPFLAGS:-$CPPFLAGSBASE}" -LDFLAGS="${HDF5_LDFLAGS:-$LDFLAGSBASE}" -LIBS="${HDF5_LIBS:-$LIBSBASE}" - -# If a static library is available, the default will be to use it. If the only -# available library is shared, it will be used by default. The user can -# override either default, although choosing an unavailable library will result -# in link errors. -STATIC_AVAILABLE="@enable_static@" -if test "${STATIC_AVAILABLE}" = "yes"; then - USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}" -else - USE_SHARED_LIB="${HDF5_USE_SHLIB:-yes}" -fi - - -usage() { - # A wonderfully informative "usage" message. - echo "usage: $prog_name [OPTIONS] " - echo " OPTIONS:" - echo " -help This help message." - echo " -echo Show all the shell commands executed" - echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/" - echo " subdirectories [default: $prefix]" - # A wonderfully informative "usage" message. - echo "usage: $prog_name [OPTIONS] " - echo " OPTIONS:" - echo " -help This help message." - echo " -echo Show all the shell commands executed" - echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/" - echo " subdirectories [default: $prefix]" - echo " -show Show the commands without executing them" - echo " -showconfig Show the HDF5 library configuration summary" - echo " -shlib Compile with shared HDF5 libraries [default for hdf5 built" - echo " without static libraries]" - echo " -noshlib Compile with static HDF5 libraries [default for hdf5 built" - echo " with static libraries]" - echo " " - echo " - the normal compile line options for your compiler." - echo " $prog_name uses the same compiler you used to compile" - echo " HDF5. Check with your compiler's man pages for more" - echo " information on which options are needed." - echo " " - echo " You can override the compiler, linker, and whether or not to use static" - echo " or shared libraries to compile your program by setting the following" - echo " environment variables accordingly:" - echo " " - echo " HDF5_CC - use a different C compiler" - echo " HDF5_CLINKER - use a different linker" - echo " HDF5_USE_SHLIB=[yes|no] - use shared or static version of the HDF5 library" - echo " [default: no except when built with only" - echo " shared libraries]" - echo " " - echo " You can also add or change paths and flags to the compile line using" - echo " the following environment varibles or by assigning them to their counterparts" - echo " in the 'Things You Can Modify to Override...'" section of $prog_name - echo " " - echo " Variable Current value to be replaced" - echo " HDF5_CPPFLAGS \"$CPPFLAGSBASE\"" - echo " HDF5_CFLAGS \"$CFLAGSBASE\"" - echo " HDF5_LDFLAGS \"$LDFLAGSBASE\"" - echo " HDF5_LIBS \"$LIBSBASE\"" - echo " " - echo " Note that adding library paths to HDF5_LDFLAGS where another hdf5 version" - echo " is located may link your program with that other hdf5 library version." - echo " " - exit $EXIT_FAILURE -} - -# Show the configuration summary of the library recorded in the -# libhdf5.settings file reside in the lib directory. -showconfigure() -{ - cat ${libdir}/libhdf5.settings - status=$? -} - -# Main -status=$EXIT_SUCCESS - -if test "$#" = "0"; then - # No parameters specified, issue usage statement and exit. - usage -fi - -case "$CC" in - gcc) - kind="gcc" - ;; - mpicc|mpcc|mpicc_r) - # Is this gcc masquarading as an MPI compiler? - if test "`${CC} -v 2>&1 | sed -n 2p | cut -c1-3`" = "gcc"; then - kind="gcc" - else - # Nope - kind="$host_os" - fi - ;; - *) - kind="$host_os" - ;; -esac - -for arg in $@ ; do - if test "x$get_output_file" = "xyes"; then - link_args="$link_args $arg" - output_file="$arg" - get_output_file="no" - continue - fi - - case "$arg" in - -c) - allargs="$allargs $arg" - compile_args="$compile_args $arg" - - if test "x$do_link" = "xyes" -a -n "$output_file"; then - compile_args="$compile_args -o $output_file" - fi - - do_link="no" - dash_c="yes" - ;; - -o) - allargs="$allargs $arg" - dash_o="yes" - - if test "x$dash_c" = "xyes"; then - compile_args="$compile_args $arg" - else - link_args="$link_args $arg" - do_link="yes" - get_output_file="yes" - fi - ;; - -E|-M|-MT) - allargs="$allargs $arg" - compile_args="$compile_args $arg" - dash_c="yes" - do_link="no" - ;; - -l*) - libraries=" $libraries $arg " - allargs="$allargs $arg" - ;; - -prefix=*) - prefix="`expr "$arg" : '-prefix=\(.*\)'`" - ;; - -echo) - set -x - ;; - -show) - SHOW="echo" - ;; - -showconfig) - showconfigure - exit $status - ;; - -shlib) - USE_SHARED_LIB="yes" - ;; - -noshlib) - USE_SHARED_LIB="no" - ;; - -help) - usage - ;; - *\"*) - qarg="'"$arg"'" - allargs="$allargs $qarg" - ;; - *\'*) - qarg='\"'"$arg"'\"' - allargs="$allargs $qarg" - ;; - *) - allargs="$allargs $qarg" - - if test -s "$arg"; then - ext=`expr "$arg" : '.*\(\..*\)'` - - if test "x$ext" = "x.c"; then - do_compile="yes" - compile_args="$compile_args $arg" - fname=`basename $arg .c` - link_objs="$link_objs $fname.o" - elif test "x$ext" = "x.o"; then - if test "x$dash_c" = "xyes"; then - compile_args="$compile_args $arg" - else - do_link="yes" - link_objs="$link_objs $arg" - fi - elif test "x$ext" = "x.a"; then - # This is an archive that we're linking in - libraries=" $libraries $arg " - else - compile_args="$compile_args $arg" - link_args="$link_args $arg" - fi - else - compile_args="$compile_args $arg" - link_args="$link_args $arg" - fi - ;; - esac -done - -if test "$dash_c" = "yes" -a "$do_compile" = no -a "$do_link" = no ; then - # -c was specified. Force do_compile on. - do_compile=yes -fi - -if test "x$do_compile" = "xyes"; then - if test "x$dash_c" != "xyes"; then - compile_args="-c $compile_args" - fi - - $SHOW $CC -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $compile_args - status=$? - - if test "$status" != "0"; then - exit $status - fi -fi - -if test "x$do_link" = "xyes"; then - shared_link="" -# conditionnaly link with the hl library - if test "X$HL" = "Xhl"; then - libraries=" $libraries -lhdf5_hl -lhdf5 " - else - libraries=" $libraries -lhdf5 " - fi - link_args="$link_args -L${libdir}" - - case "$kind" in - gcc|linux*) - # MacOS X doesn't support the "-Wl,-rpath -Wl," style of linker flags. - # It appears to want none of them specified. - case "$host_os" in - darwin*) flag="" ;; - *) flag="-Wl,-rpath -Wl," ;; - esac - ;; - hpux*) flag="-Wl,+b -Wl," ;; - freebsd*|solaris*) flag="-R" ;; - rs6000*|aix*) flag="-L" ;; - sgi) flag="-rpath " ;; - *) flag="" ;; - esac - - if test -n "$flag"; then - shared_link="${flag}${libdir}" - fi - - if test "x$USE_SHARED_LIB" != "xyes"; then - # The "-lhdf5" & "-lhdf5_hl" flags are in here already...This is a static - # compile though, so change it to the static version (.a) of the library. - new_libraries="" - for lib in $libraries; do - case "$lib" in - -lhdf5) - new_libraries="$new_libraries ${libdir}/libhdf5.a" - ;; - -lhdf5_hl) - new_libraries="$new_libraries ${libdir}/libhdf5_hl.a" - ;; - *) - new_libraries="$new_libraries $lib" - ;; - esac - done - libraries="$new_libraries" - fi - - for lib in $libraries; do - if echo $link_args | grep " $lib " > /dev/null || - echo $link_args | grep " $lib$" > /dev/null; then - : - else - link_args="$link_args $lib " - fi - done - - # The LIBS are just a bunch of -l* libraries necessary for the HDF5 - # module. It's okay if they're included twice in the compile line. - link_args="$link_args $H5BLD_LDFLAGS $H5BLD_LIBS" - - # User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's - # LDFLAGS come just before clibpath, user's LIBS come after $link_objs and - # before the hdf5 libraries in $link_args, followed by any external library - # paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in - # from the hdf5 build. The order of the flags is intended to give precedence - # to the user's flags. - $SHOW $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS $clibpath $link_objs $LIBS $link_args $shared_link - status=$? -fi - -exit $status -- cgit v0.12 From 6e1dc507240fba447c79827897b099e91b9dd5c1 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Wed, 12 Jun 2019 14:13:48 -0500 Subject: Add release note for enable-tools and enable-tests options. --- release_docs/RELEASE.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 6d1c8b2..afce83f 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -48,6 +48,18 @@ New Features Configuration: ------------- + - Add options to enable or disable building tools and tests + + Configure options --enable-tests and --enable-tools were added for + autotools configure. These options are enabled by default, and can be + disabled with either --disable-tests (or tools) or --enable-tests=no + (or --enable-tools=no). Build time is reduced ~20% when tools are + disabled, 35% when tests are disabled, 45% when both are disabled. + Reenabling them after the initial build requires running configure + again with the option(s) enabled. + + (LRK - 2019/06/12, HDFFV-9976) + - Change tools test that test the error stack There are some use cases which can cause the error stack of tools to be -- cgit v0.12 From 46a62130faf4ac168a4b33e3d5551446c73fa4e6 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 13 Jun 2019 09:23:12 -0500 Subject: fix for cycle dependency --- fortran/test/CMakeTests.cmake | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index 306a3f8..baefb8f 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -215,6 +215,7 @@ if (BUILD_SHARED_LIBS) endif () # set_tests_properties (FORTRAN_testhdf5_fortran_1_8-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") set_tests_properties (FORTRAN_testhdf5_fortran_1_8-shared PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8) + #-- Adding test for fortranlib_test_F03 if (HDF5_ENABLE_USING_MEMCHECKER) @@ -236,6 +237,26 @@ if (BUILD_SHARED_LIBS) # set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES DEPENDS FORTRAN_fortranlib_test_F03) + #-- Adding test for vol_connector + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME FORTRAN_vol_connector-shared COMMAND $) + else () + add_test (NAME FORTRAN_vol_connector-shared COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_REGEX= 0 error.s." + -D "TEST_MATCH= 0 error(s)" + -D "TEST_OUTPUT=vol_connector.txt" + #-D "TEST_REFERENCE=vol_connector.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () +# set_tests_properties (FORTRAN_vol_connector-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") + set_tests_properties (FORTRAN_vol_connector-shared PROPERTIES DEPENDS FORTRAN_vol_connector) + #-- Adding test for fflush1 add_test (NAME FORTRAN_fflush1-shared COMMAND $) set_tests_properties (FORTRAN_fflush1-shared PROPERTIES DEPENDS FORTRAN_fflush2) -- cgit v0.12 From c348d7d6062f34554f8d432ea9d80bf2c936c734 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 13 Jun 2019 09:56:50 -0500 Subject: removed unregistering native vol --- fortran/test/vol_connector.F90 | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/fortran/test/vol_connector.F90 b/fortran/test/vol_connector.F90 index 62e3f8d..94f572b 100644 --- a/fortran/test/vol_connector.F90 +++ b/fortran/test/vol_connector.F90 @@ -93,10 +93,6 @@ CONTAINS CALL H5VLclose_f(vol_id_out, error) CALL check("H5VLclose_f",error, total_error) - ! Unregister the connector - CALL H5VLunregister_connector_f(vol_id, error) - CALL check("H5VLunregister_connector_f", error, total_error) - END SUBROUTINE test_registration_by_name !------------------------------------------------------------------------- @@ -132,10 +128,6 @@ CONTAINS CALL check("H5VLis_connector_registered_f",error,total_error) CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error) - ! Unregister the connector - CALL H5VLunregister_connector_f(vol_id, error) - CALL check("H5VLunregister_connector_f", error, total_error) - END SUBROUTINE test_registration_by_value @@ -216,10 +208,6 @@ CONTAINS CALL H5VLclose_f(vol_id, error) CALL check("H5VLclose_f",error, total_error) - ! Unregister the connector - CALL H5VLunregister_connector_f(vol_id, error) - CALL check("H5VLunregister_connector_f", error, total_error) - CALL H5Fclose_f(file_id, error) CALL check("H5Fclose_f",error,total_error) -- cgit v0.12 From e5d1da02244603f19e165c573326835f7a634b47 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 13 Jun 2019 10:31:14 -0500 Subject: fixed invalid pointer --- fortran/src/H5VLff.F90 | 3 ++- fortran/test/vol_connector.F90 | 27 ++++++++++++++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/fortran/src/H5VLff.F90 b/fortran/src/H5VLff.F90 index 0c5e8fd..9abc157 100644 --- a/fortran/src/H5VLff.F90 +++ b/fortran/src/H5VLff.F90 @@ -232,7 +232,8 @@ CONTAINS hdferr = 0 IF(PRESENT(name_len))THEN - name_len = INT(H5VLget_connector_name(obj_id, c_name, 0_SIZE_T), SIZE_T) + c_name(1:1)(1:1) = C_NULL_CHAR + name_len = INT(H5VLget_connector_name(obj_id, c_name, 1_SIZE_T), SIZE_T) IF(name_len.LT.0) hdferr = H5I_INVALID_HID_F ELSE l = INT(LEN(name)+1,SIZE_T) diff --git a/fortran/test/vol_connector.F90 b/fortran/test/vol_connector.F90 index 94f572b..623767b 100644 --- a/fortran/test/vol_connector.F90 +++ b/fortran/test/vol_connector.F90 @@ -55,9 +55,10 @@ CONTAINS LOGICAL :: is_registered = .FALSE. INTEGER(hid_t) :: vol_id = 0, vol_id_out = 1 CHARACTER(LEN=64) :: name + CHARACTER(LEN=1) :: name_null + CHARACTER(LEN=6) :: name_exact INTEGER(SIZE_T) :: name_len INTEGER(hid_t) :: file_id - INTEGER :: cmp = -1 ! The null VOL connector should not be registered at the start of the test CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) @@ -87,6 +88,22 @@ CONTAINS CALL check("H5VLget_connector_name_f",error,total_error) CALL VERIFY("H5VLget_connector_name_f", name, NATIVE_VOL_CONNECTOR_NAME, total_error) + CALL H5VLget_connector_name_f(file_id, name_null, error, name_len) + CALL check("H5VLget_connector_name_f",error,total_error) + CALL VERIFY("H5VLget_connector_name_f", INT(name_len), LEN_TRIM(NATIVE_VOL_CONNECTOR_NAME), total_error) + + CALL H5VLget_connector_name_f(file_id, name_null, error) + CALL check("H5VLget_connector_name_f",error,total_error) + CALL VERIFY("H5VLget_connector_name_f", name_null, NATIVE_VOL_CONNECTOR_NAME(1:1), total_error) + + CALL H5VLget_connector_name_f(file_id, name_exact, error, name_len) + CALL check("H5VLget_connector_name_f",error,total_error) + CALL VERIFY("H5VLget_connector_name_f", INT(name_len), LEN_TRIM(NATIVE_VOL_CONNECTOR_NAME), total_error) + + CALL H5VLget_connector_name_f(file_id, name_exact, error) + CALL check("H5VLget_connector_name_f",error,total_error) + CALL VERIFY("H5VLget_connector_name_f", name_exact, NATIVE_VOL_CONNECTOR_NAME, total_error) + CALL H5Fclose_f(file_id, error) CALL check("H5Fclose_f",error,total_error) @@ -149,19 +166,15 @@ CONTAINS LOGICAL :: is_registered = .FALSE. INTEGER(hid_t) :: vol_id = 0, vol_id_out = 1 - CHARACTER(LEN=64) :: name - INTEGER(SIZE_T) :: name_len INTEGER(hid_t) :: file_id - INTEGER :: cmp = -1 INTEGER(hid_t) :: fapl_id TYPE(C_PTR) :: f_ptr - INTEGER(hid_t), TARGET :: under_fapl CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) - ! The null VOL connector should not be registered at the start of the test CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) CALL check("H5VLis_connector_registered_f",error,total_error) @@ -169,7 +182,7 @@ CONTAINS CALL H5VLregister_connector_by_name_f(NATIVE_VOL_CONNECTOR_NAME, vol_id, error) CALL check("H5VLregister_connector_by_name_f",error,total_error) - + ! The connector should be registered now CALL H5VLis_connector_registered_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error) CALL check("H5VLis_connector_registered_f",error,total_error) -- cgit v0.12 From 92bebb782e7bdfb604079430c005dd8513272eb6 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 13 Jun 2019 10:41:31 -0500 Subject: fixed dependencies --- fortran/test/CMakeLists.txt | 11 +++++++++-- fortran/test/CMakeTests.cmake | 3 --- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 719a9f3..921e29a 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -570,7 +570,11 @@ if (BUILD_SHARED_LIBS) endif () #-- Adding test for vol_connector -add_executable (vol_connector vol_connector.F90) +add_executable (vol_connector + vol_connector.F90 + tH5L_F03.F90 + tHDF5_F03.F90) + target_include_directories (vol_connector PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static @@ -600,7 +604,10 @@ set_target_properties (vol_connector PROPERTIES add_dependencies (vol_connector ${HDF5_F90_TEST_LIB_TARGET}) if (BUILD_SHARED_LIBS) - add_executable (vol_connector-shared vol_connector.F90) + add_executable (vol_connector-shared + vol_connector.F90 + tH5L_F03.F90 + tHDF5_F03.F90) target_include_directories (vol_connector-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index baefb8f..3b313a7 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -265,7 +265,4 @@ if (BUILD_SHARED_LIBS) add_test (NAME FORTRAN_fflush2-shared COMMAND $) set_tests_properties (FORTRAN_fflush2-shared PROPERTIES DEPENDS FORTRAN_fflush1-shared) - #-- Adding test for vol_connector - add_test (NAME FORTRAN_vol_connector-shared COMMAND $) - set_tests_properties (FORTRAN_vol_connector-shared PROPERTIES DEPENDS FORTRAN_vol_connector-shared) endif () -- cgit v0.12 From b08685f5036e21cbce0227797d9bc3e00a36c2ff Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 13 Jun 2019 15:47:55 -0500 Subject: updated static vol_connector build --- fortran/test/CMakeTests.cmake | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index baefb8f..45f14d1 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -131,8 +131,24 @@ add_test (NAME FORTRAN_fflush2 COMMAND $) set_tests_properties (FORTRAN_fflush2 PROPERTIES DEPENDS FORTRAN_fflush1) #-- Adding test for vol_connector -add_test (NAME FORTRAN_vol_connector COMMAND $) -set_tests_properties (FORTRAN_vol_connector PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME FORTRAN_vol_connector COMMAND $) +else () + add_test (NAME FORTRAN_vol_connector COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_REGEX= 0 error.s." + -D "TEST_MATCH= 0 error(s)" + -D "TEST_OUTPUT=vol_connector.txt" + #-D "TEST_REFERENCE=vol_connector.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () +# set_tests_properties (FORTRAN_vol_connector PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") + set_tests_properties (FORTRAN_vol_connector PROPERTIES DEPENDS FORTRAN_fortranlib_test_F03) if (BUILD_SHARED_LIBS) add_test ( -- cgit v0.12 From d754a86c2412747be587633fb7e7180570b3f82a Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 13 Jun 2019 16:23:55 -0500 Subject: updated static vol_connector build --- fortran/test/CMakeTests.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index bba9ee6..a63a201 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -148,7 +148,7 @@ else () ) endif () # set_tests_properties (FORTRAN_vol_connector PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") - set_tests_properties (FORTRAN_vol_connector PROPERTIES DEPENDS FORTRAN_fortranlib_test_F03) + set_tests_properties (FORTRAN_vol_connector PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects) if (BUILD_SHARED_LIBS) add_test ( -- cgit v0.12 From 0f947f953d5c1556217a3a4b7bae73b84e8b28fe Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Fri, 14 Jun 2019 09:39:18 -0500 Subject: added missing MOD dependency --- fortran/test/vol_connector.F90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/fortran/test/vol_connector.F90 b/fortran/test/vol_connector.F90 index 623767b..0394188 100644 --- a/fortran/test/vol_connector.F90 +++ b/fortran/test/vol_connector.F90 @@ -28,7 +28,6 @@ MODULE VOL_TMOD USE HDF5 - USE THDF5_F03 IMPLICIT NONE INTEGER, PARAMETER :: NATIVE_VOL_CONNECTOR_VALUE = 0 @@ -236,7 +235,6 @@ END MODULE VOL_TMOD PROGRAM vol_connector USE HDF5 - USE THDF5_F03 USE VOL_TMOD IMPLICIT NONE -- cgit v0.12 From 79916da3036f94a368ba8b29cb18c507e9939e16 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Fri, 14 Jun 2019 09:48:27 -0500 Subject: added missing MOD dependency --- fortran/test/CMakeLists.txt | 8 ++------ fortran/test/Makefile.am | 2 +- fortran/test/vol_connector.F90 | 2 ++ 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 921e29a..c5a47c0 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -571,9 +571,7 @@ endif () #-- Adding test for vol_connector add_executable (vol_connector - vol_connector.F90 - tH5L_F03.F90 - tHDF5_F03.F90) + vol_connector.F90) target_include_directories (vol_connector PRIVATE @@ -605,9 +603,7 @@ add_dependencies (vol_connector ${HDF5_F90_TEST_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_executable (vol_connector-shared - vol_connector.F90 - tH5L_F03.F90 - tHDF5_F03.F90) + vol_connector.F90) target_include_directories (vol_connector-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index f0d7f03..30bb2a0 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -50,7 +50,7 @@ fortranlib_test_1_8_SOURCES = tH5O.F90 tH5A_1_8.F90 tH5G_1_8.F90 tH5MISC_1_8.F90 fortranlib_test_F03_SOURCES = tH5E_F03.F90 tH5F_F03.F90 tH5L_F03.F90 \ tH5O_F03.F90 tH5P_F03.F90 tH5T_F03.F90 tHDF5_F03.F90 fortranlib_test_F03.F90 -vol_connector_SOURCES=vol_connector.F90 +vol_connector_SOURCES=tf_gen.F90 tf.F90 vol_connector.F90 fflush1_SOURCES=fflush1.F90 fflush2_SOURCES=fflush2.F90 diff --git a/fortran/test/vol_connector.F90 b/fortran/test/vol_connector.F90 index 0394188..655b690 100644 --- a/fortran/test/vol_connector.F90 +++ b/fortran/test/vol_connector.F90 @@ -28,6 +28,8 @@ MODULE VOL_TMOD USE HDF5 + USE TH5_MISC + USE TH5_MISC_GEN IMPLICIT NONE INTEGER, PARAMETER :: NATIVE_VOL_CONNECTOR_VALUE = 0 -- cgit v0.12