diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2009-04-17 19:09:35 (GMT) |
---|---|---|
committer | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2009-04-17 19:09:35 (GMT) |
commit | 3577791dcc55259829af881545db3482d6dc9405 (patch) | |
tree | 859d733570b3beea0a019a6ca6d6031e29374a3f /fortran | |
parent | ccb31223c4156ef0dbe025435ee859d9d76e64d8 (diff) | |
download | hdf5-3577791dcc55259829af881545db3482d6dc9405.zip hdf5-3577791dcc55259829af881545db3482d6dc9405.tar.gz hdf5-3577791dcc55259829af881545db3482d6dc9405.tar.bz2 |
[svn-r16782] Description:
Merged the changes from the trunk/fortran into the branch:
used:
svn merge -r 16362:16781 https://svn.hdfgroup.uiuc.edu/hdf5/trunk/fortran
Platforms tested: smirom (pgf90, ifort)
linew
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/src/H5Df.c | 28 | ||||
-rw-r--r-- | fortran/src/H5Dff.f90 | 46 | ||||
-rw-r--r-- | fortran/src/H5If.c | 30 | ||||
-rw-r--r-- | fortran/src/H5Iff.f90 | 42 | ||||
-rw-r--r-- | fortran/src/H5Pf.c | 67 | ||||
-rw-r--r-- | fortran/src/H5Pff.f90 | 118 | ||||
-rw-r--r-- | fortran/src/H5Sff.f90 | 2 | ||||
-rw-r--r-- | fortran/src/H5_f.c | 3 | ||||
-rw-r--r-- | fortran/src/H5f90global.f90 | 12 | ||||
-rw-r--r-- | fortran/src/H5f90proto.h | 9 | ||||
-rw-r--r-- | fortran/src/hdf5_fortrandll.def | 4 | ||||
-rw-r--r-- | fortran/test/fortranlib_test.f90 | 5 | ||||
-rw-r--r-- | fortran/test/tH5I.f90 | 24 | ||||
-rw-r--r-- | fortran/test/tH5P.f90 | 275 |
14 files changed, 656 insertions, 9 deletions
diff --git a/fortran/src/H5Df.c b/fortran/src/H5Df.c index 58f3ce2..a7c6e75 100644 --- a/fortran/src/H5Df.c +++ b/fortran/src/H5Df.c @@ -1992,4 +1992,32 @@ nh5dcreate_anon_c (hid_t_f *loc_id, hid_t_f *type_id, hid_t_f *space_id, return ret_value; } +/*---------------------------------------------------------------------------- + * Name: h5dget_access_plist_c + * Purpose: Call H5Dget_access_plist + * Inputs: + * dset_id - dataset identifier + * Outputs: + * plist_id - the dataset access property list identifier. + * + * Returns: 0 on success, -1 on failure + * Programmer: M.S. Breitenfeld + * April 13, 2009 + *---------------------------------------------------------------------------*/ +int_f +nh5dget_access_plist_c (hid_t_f *dset_id, hid_t_f *plist_id) +{ + int ret_value = -1; + /* + * Call H5Dget_access_plist function. + */ + if((*plist_id = (hid_t_f)H5Dget_access_plist((hid_t)*dset_id)) < 0) + goto DONE; + + ret_value = 0; + + DONE: + return ret_value; +} + diff --git a/fortran/src/H5Dff.f90 b/fortran/src/H5Dff.f90 index b170408..f06f5a5 100644 --- a/fortran/src/H5Dff.f90 +++ b/fortran/src/H5Dff.f90 @@ -220,7 +220,7 @@ CONTAINS ! port). February 28, 2001 ! ! -Added 1.8 (optional) parameter dapl_id -! February, 2008, M.S. Breitenfeld +! February, 2008, M. Scot Breitenfeld ! ! Comment: !---------------------------------------------------------------------- @@ -4276,7 +4276,7 @@ CONTAINS ! dcpl_id - Dataset creation property list identifier. ! dapl_id - Dataset access property list identifier. ! -! Programmer: M.S. Breitenfeld +! Programmer: M. Scot Breitenfeld ! February 11, 2008 ! ! Modifications: @@ -4325,6 +4325,48 @@ CONTAINS END SUBROUTINE h5dcreate_anon_f +!---------------------------------------------------------------------- +! Name: h5dget_access_plist_f +! +! Purpose: Returns a copy of the dataset creation property list. +! +! Inputs: +! dset_id - dataset identifier. +! Outputs: +! plist_id - the dataset access property list identifier. +! hdferr: - error code +! Success: 0 +! Failure: -1 +! +! Programmer: M. Scot Breitenfeld +! April 13, 2009 +! +! Modifications: +! +! Comment: +!---------------------------------------------------------------------- + + SUBROUTINE h5dget_access_plist_f(dset_id, plist_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id + INTEGER(HID_T), INTENT(OUT) :: plist_id + INTEGER, INTENT(OUT) :: hdferr ! Error code. + + INTERFACE + INTEGER FUNCTION h5dget_access_plist_c(dset_id, plist_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5DGET_ACCESS_PLIST_C'::h5dget_access_plist_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: dset_id + INTEGER(HID_T), INTENT(OUT) :: plist_id + END FUNCTION h5dget_access_plist_c + END INTERFACE + + hdferr = h5dget_access_plist_c(dset_id, plist_id) + + END SUBROUTINE h5dget_access_plist_f + END MODULE H5D diff --git a/fortran/src/H5If.c b/fortran/src/H5If.c index 5368861..e8b54f0 100644 --- a/fortran/src/H5If.c +++ b/fortran/src/H5If.c @@ -211,3 +211,33 @@ nh5iget_file_id_c(hid_t_f *obj_id, hid_t_f *file_id) done: return ret_value; } + +/*---------------------------------------------------------------------------- + * Name: h5iis_valid_c + * Purpose: Calls H5Iis_valid + * Inputs: obj_id - object identifier + * Outputs: 0 = false, 1 = true + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Tuesday, August 24, 2004 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5iis_valid_c(hid_t_f *obj_id, int_f *c_valid) +{ + int ret_value; + htri_t c_ret_value; + + /* + * Call H5Iis_valid + */ + if ((c_ret_value = H5Iis_valid(*obj_id)) < 0) + HGOTO_DONE(FAIL); + + /* Set output & return values */ + *c_valid = (int_f)c_ret_value; + ret_value=0; + +done: + return ret_value; +} diff --git a/fortran/src/H5Iff.f90 b/fortran/src/H5Iff.f90 index 0b70f8b..83587ce 100644 --- a/fortran/src/H5Iff.f90 +++ b/fortran/src/H5Iff.f90 @@ -306,5 +306,47 @@ hdferr = h5iget_file_id_c(obj_id, file_id) END SUBROUTINE h5iget_file_id_f +!---------------------------------------------------------------------- +! Name: H5Iis_valid_f +! +! Purpose: Check if an ID is valid without producing an error message +! +! Inputs: id - identifier +! Outputs: +! valid - status of id as a valid identifier +! hdferr: - error code +! Success: 0 +! Failure: -1 +! Programmer: M. Scot Breitenfeld +! April 13, 2009 +! +! Comment: +!---------------------------------------------------------------------- + SUBROUTINE h5iis_valid_f(id, valid, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: id ! Identifier + LOGICAL, INTENT(OUT) :: valid ! Status of id as a valid identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: c_valid ! 0 = .false, 1 = .true. + + INTERFACE + INTEGER FUNCTION h5iis_valid_c(id, c_valid) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5IIS_VALID_C':: h5iis_valid_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: id ! Identifier + INTEGER :: c_valid + END FUNCTION h5iis_valid_c + END INTERFACE + + hdferr = h5iis_valid_c(id, c_valid) + + valid = .FALSE. ! Default + IF(c_valid.EQ.1) valid = .TRUE. + + END SUBROUTINE h5iis_valid_f + + END MODULE H5I diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index ef38b31..95616db 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -4439,3 +4439,70 @@ nh5pget_create_inter_group_c(hid_t_f *lcpl_id, int_f *crt_intermed_group) ret_value = 0; return ret_value; } + +/*---------------------------------------------------------------------------- + * Name: h5pset_chunk_cache_c + * Purpose: Calls H5Pset_chunk_cache + * + * Inputs: dapl_id - Link creation property list identifier + * rdcc_nslots - + * rdcc_nbytes - + * rdcc_w0 - + * + * Returns: 0 on success, -1 on failure + * Programmer: M.S. Breitenfeld + * April 13, 2009 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5pset_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes, real_f *rdcc_w0) +{ + int ret_value = -1; + + /* + * Call H5Pset_chunk_cache function. + */ + if( (H5Pset_chunk_cache((hid_t)*dapl_id, (size_t)*rdcc_nslots, (size_t)*rdcc_nbytes, (double)*rdcc_w0)) <0 ) + return ret_value; /* error occurred */ + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_chunk_cache_c + * Purpose: Calls H5Pget_chunk_cache + * + * Inputs: dapl_id - Link creation property list identifier + * Outputs: + * rdcc_nslots - + * rdcc_nbytes - + * rdcc_w0 - + * + * Returns: 0 on success, -1 on failure + * Programmer: M.S. Breitenfeld + * April 13, 2009 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5pget_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes, real_f *rdcc_w0) +{ + int ret_value = -1; + size_t c_rdcc_nslots; + size_t c_rdcc_nbytes; + double c_rdcc_w0; + /* + * Call H5Pget_chunk_cache function. + */ + if( (H5Pget_chunk_cache((hid_t)*dapl_id, &c_rdcc_nslots, &c_rdcc_nbytes, &c_rdcc_w0)) <0 ) + return ret_value; /* error occurred */ + + *rdcc_nslots=(size_t_f)c_rdcc_nslots; + *rdcc_nbytes=(size_t_f)c_rdcc_nbytes; + *rdcc_w0=(real_f)c_rdcc_w0; + + ret_value = 0; + return ret_value; +} diff --git a/fortran/src/H5Pff.f90 b/fortran/src/H5Pff.f90 index 9d4ef67..499ae3f 100644 --- a/fortran/src/H5Pff.f90 +++ b/fortran/src/H5Pff.f90 @@ -7034,6 +7034,124 @@ END SUBROUTINE h5pget_create_inter_group_f +!---------------------------------------------------------------------- +! Name: H5Pset_chunk_cache_f +! +! Purpose: Set the number of objects in the meta data cache and the +! maximum number of chunks and bytes in the raw data chunk cache. +! Once set, these values will override the values in the file access +! property list. Each of these values can be individually unset +! (or not set at all) by passing the macros: +! H5D_CHUNK_CACHE_NSLOTS_DEFAULT, +! H5D_CHUNK_CACHE_NBYTES_DEFAULT, and/or +! H5D_CHUNK_CACHE_W0_DEFAULT +! as appropriate. +! +! The RDCC_W0 value should be between 0 and 1 inclusive and +! indicates how much chunks that have been fully read or fully +! written are favored for preemption. A value of zero means +! fully read or written chunks are treated no differently than +! other chunks (the preemption is strictly LRU) while a value +! of one means fully read chunks are always preempted before +! other chunks. +! +! Inputs: +! dapl_id - Link creation property list identifier +! rdcc_nslots - +! rdcc_nbytes - +! rdcc_w0 - +! Outputs: +! hdferr: - error code +! Success: 0 +! Failure: -1 +! Optional parameters: +! NONE +! +! Programmer: M.S. Breitenfeld +! April 13, 2009 +! +! Modifications: +!-------------------------------------------------------------------------------------- + + SUBROUTINE h5pset_chunk_cache_f(dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dapl_id + INTEGER(SIZE_T), INTENT(IN) :: rdcc_nslots + INTEGER(SIZE_T), INTENT(IN) :: rdcc_nbytes + REAL, INTENT(IN) :: rdcc_w0 + INTEGER, INTENT(OUT) :: hdferr + + + INTERFACE + INTEGER FUNCTION h5pset_chunk_cache_c(dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5PSET_CHUNK_CACHE_C'::h5pset_chunk_cache_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: dapl_id + INTEGER(SIZE_T), INTENT(IN) :: rdcc_nslots + INTEGER(SIZE_T), INTENT(IN) :: rdcc_nbytes + REAL, INTENT(IN) :: rdcc_w0 + END FUNCTION h5pset_chunk_cache_c + END INTERFACE + + hdferr = h5pset_chunk_cache_c(dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0) + + END SUBROUTINE h5pset_chunk_cache_f + +!---------------------------------------------------------------------- +! Name: H5Pget_chunk_cache_f +! +! Purpose: Retrieves the maximum possible number of elements in the meta +! data cache and the maximum possible number of elements and +! bytes and the RDCC_W0 value in the raw data chunk cache. Any +! (or all) arguments may be null pointers in which case the +! corresponding datum is not returned. If these properties have +! not been set on this property list, the default values for a +! file access property list are returned. +! +! Inputs: +! dapl_id - Link creation property list identifier +! rdcc_nslots - +! rdcc_nbytes - +! rdcc_w0 - +! Outputs: +! hdferr: - error code +! Success: 0 +! Failure: -1 +! Optional parameters: +! NONE +! +! Programmer: M.S. Breitenfeld +! April 13, 2009 +! +! Modifications: +!-------------------------------------------------------------------------------------- + + SUBROUTINE h5pget_chunk_cache_f(dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dapl_id + INTEGER(SIZE_T), INTENT(OUT) :: rdcc_nslots + INTEGER(SIZE_T), INTENT(OUT) :: rdcc_nbytes + REAL, INTENT(OUT) :: rdcc_w0 + INTEGER, INTENT(OUT) :: hdferr + + INTERFACE + INTEGER FUNCTION h5pget_chunk_cache_c(dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5PGET_CHUNK_CACHE_C'::h5pget_chunk_cache_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: dapl_id + INTEGER(SIZE_T), INTENT(OUT) :: rdcc_nslots + INTEGER(SIZE_T), INTENT(OUT) :: rdcc_nbytes + REAL, INTENT(OUT) :: rdcc_w0 + END FUNCTION h5pget_chunk_cache_c + END INTERFACE + + hdferr = h5pget_chunk_cache_c(dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0) + + END SUBROUTINE h5pget_chunk_cache_f END MODULE H5P diff --git a/fortran/src/H5Sff.f90 b/fortran/src/H5Sff.f90 index 35b18a6..7cabb00 100644 --- a/fortran/src/H5Sff.f90 +++ b/fortran/src/H5Sff.f90 @@ -570,7 +570,7 @@ ! coord(rank, num_elements) INTEGER, INTENT(OUT) :: hdferr ! Error code INTEGER(HSIZE_T), ALLOCATABLE, DIMENSION(:,:) :: c_coord - INTEGER :: error, i,j + INTEGER :: error, i INTERFACE INTEGER FUNCTION h5sselect_elements_c(space_id, OPERATOR,& diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index d7bb3d8..a8b2d95 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -338,6 +338,9 @@ nh5init_flags_c( int_f *h5d_flags, int_f *h5f_flags, h5d_flags[16] = (int_f)H5D_FILL_VALUE_UNDEFINED; h5d_flags[17] = (int_f)H5D_FILL_VALUE_DEFAULT; h5d_flags[18] = (int_f)H5D_FILL_VALUE_USER_DEFINED; + h5d_flags[19] = (int_f)H5D_CHUNK_CACHE_NSLOTS_DEFAULT; + h5d_flags[20] = (int_f)H5D_CHUNK_CACHE_NBYTES_DEFAULT; + h5d_flags[21] = (int_f)H5D_CHUNK_CACHE_W0_DEFAULT; /* * H5F flags diff --git a/fortran/src/H5f90global.f90 b/fortran/src/H5f90global.f90 index 2d50f4f..fd234c7 100644 --- a/fortran/src/H5f90global.f90 +++ b/fortran/src/H5f90global.f90 @@ -317,7 +317,7 @@ MODULE H5GLOBAL ! H5D flags declaration ! - INTEGER, PARAMETER :: H5D_FLAGS_LEN = 19 + INTEGER, PARAMETER :: H5D_FLAGS_LEN = 22 INTEGER H5D_flags(H5D_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) !DEC$ATTRIBUTES DLLEXPORT :: /H5D_FLAGS/ @@ -348,6 +348,10 @@ MODULE H5GLOBAL INTEGER :: H5D_FILL_VALUE_DEFAULT_F INTEGER :: H5D_FILL_VALUE_USER_DEFINED_F + INTEGER :: H5D_CHUNK_CACHE_NSLOTS_DEFAULT_F + INTEGER :: H5D_CHUNK_CACHE_NBYTES_DEFAULT_F + INTEGER :: H5D_CHUNK_CACHE_W0_DEFAULT_F + EQUIVALENCE(H5D_flags(1), H5D_COMPACT_F) EQUIVALENCE(H5D_flags(2), H5D_CONTIGUOUS_F) EQUIVALENCE(H5D_flags(3), H5D_CHUNKED_F) @@ -370,7 +374,11 @@ MODULE H5GLOBAL EQUIVALENCE(H5D_flags(16), H5D_FILL_VALUE_ERROR_F) EQUIVALENCE(H5D_flags(17), H5D_FILL_VALUE_UNDEFINED_F) EQUIVALENCE(H5D_flags(18), H5D_FILL_VALUE_DEFAULT_F) - EQUIVALENCE(H5D_flags(19), H5D_FILL_VALUE_USER_DEFINED_F) + EQUIVALENCE(H5D_flags(19), H5D_FILL_VALUE_USER_DEFINED_F) + + EQUIVALENCE(H5D_flags(20), H5D_CHUNK_CACHE_NSLOTS_DEFAULT_F) + EQUIVALENCE(H5D_flags(21), H5D_CHUNK_CACHE_NBYTES_DEFAULT_F) + EQUIVALENCE(H5D_flags(22), H5D_CHUNK_CACHE_W0_DEFAULT_F) ! ! H5FD flags declaration diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index b29af89..15dc41d 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -229,6 +229,7 @@ H5_FCDLL int_f nh5sextent_equal_c ( hid_t_f * space1_id, hid_t_f *space2_id, hid # define nh5dfill_double_c H5_FC_FUNC_(h5dfill_double_c, H5DFILL_DOUBLE_C) # define nh5dget_space_status_c H5_FC_FUNC_(h5dget_space_status_c, H5DGET_SPACE_STATUS_C) # define nh5dcreate_anon_c H5_FC_FUNC_(h5dcreate_anon_c, H5DCREATE_ANON_C) +# define nh5dget_access_plist_c H5_FC_FUNC_(h5dget_access_plist_c, H5DGET_ACCESS_PLIST_C) H5_FCDLL int_f nh5dcreate_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *space_id, @@ -325,6 +326,8 @@ H5_FCDLL int_f nh5dreadc_4_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *m H5_FCDLL int_f nh5dreadc_5_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims); H5_FCDLL int_f nh5dreadc_6_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims); H5_FCDLL int_f nh5dreadc_7_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims); +H5_FCDLL int_f nh5dget_access_plist_c (hid_t_f *dset_id, hid_t_f *plist_id); + H5_FCDLL int_f nh5dget_space_c ( hid_t_f *dset_id , hid_t_f *space_id); H5_FCDLL int_f nh5dget_type_c ( hid_t_f *dset_id , hid_t_f *type_id); @@ -900,6 +903,8 @@ H5_FCDLL int_f nh5olink_c (hid_t_f *object_id, hid_t_f *new_loc_id, _fcd name, s # define nh5pset_scaleoffset_c H5_FC_FUNC_(h5pset_scaleoffset_c, H5PSET_SCALEOFFSET_C) # define nh5pset_nlinks_c H5_FC_FUNC_(h5pset_nlinks_c, H5PSET_NLINKS_C) # define nh5pget_nlinks_c H5_FC_FUNC_(h5pget_nlinks_c, H5PGET_NLINKS_C) +# define nh5pset_chunk_cache_c H5_FC_FUNC_(h5pset_chunk_cache_c, H5PSET_CHUNK_CACHE_C) +# define nh5pget_chunk_cache_c H5_FC_FUNC_(h5pget_chunk_cache_c, H5PGET_CHUNK_CACHE_C) H5_FCDLL int_f nh5pcreate_c ( hid_t_f *class, hid_t_f *prp_id ); H5_FCDLL int_f nh5pclose_c ( hid_t_f *prp_id ); @@ -1056,6 +1061,8 @@ H5_FCDLL int_f nh5pset_nbit_c(hid_t_f *plist_id ); H5_FCDLL int_f nh5pset_scaleoffset_c(hid_t_f *plist_id, int_f *scale_type, int_f *scale_factor ); H5_FCDLL int_f nh5pset_nlinks_c(hid_t_f *lapl_id, size_t_f *nlinks); H5_FCDLL int_f nh5pget_nlinks_c(hid_t_f *lapl_id, size_t_f *nlinks); +H5_FCDLL int_f nh5pset_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes, real_f *rdcc_w0); +H5_FCDLL int_f nh5pget_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes, real_f *rdcc_w0); /* * Functions frome H5Rf.c */ @@ -1086,6 +1093,7 @@ H5_FCDLL int_f nh5rget_name_region_c (hid_t_f *loc_id, int_f *ref, _fcd name, si # define nh5idec_ref_c H5_FC_FUNC_(h5idec_ref_c, H5IDEC_REF_C) # define nh5iget_ref_c H5_FC_FUNC_(h5iget_ref_c, H5IGET_REF_C) # define nh5iget_file_id_c H5_FC_FUNC_(h5iget_file_id_c, H5IGET_FILE_ID_C) +# define nh5iis_valid_c H5_FC_FUNC_(h5iis_valid_c, H5IIS_VALID_C) H5_FCDLL int_f nh5iget_type_c(hid_t_f *obj_id, int_f *type); H5_FCDLL int_f nh5iget_name_c(hid_t_f *obj_id, _fcd buf, size_t_f *buf_size, size_t_f *name_size); @@ -1093,6 +1101,7 @@ H5_FCDLL int_f nh5iinc_ref_c(hid_t_f *obj_id, int_f *ref_count); H5_FCDLL int_f nh5idec_ref_c(hid_t_f *obj_id, int_f *ref_count); H5_FCDLL int_f nh5iget_ref_c(hid_t_f *obj_id, int_f *ref_count); H5_FCDLL int_f nh5iget_file_id_c(hid_t_f *obj_id, hid_t_f *file_id); +H5_FCDLL int_f nh5iis_valid_c(hid_t_f *obj_id, int_f *c_valid); /* * Functions from H5Ef.c diff --git a/fortran/src/hdf5_fortrandll.def b/fortran/src/hdf5_fortrandll.def index 501570b..057dc13 100644 --- a/fortran/src/hdf5_fortrandll.def +++ b/fortran/src/hdf5_fortrandll.def @@ -199,6 +199,7 @@ H5D_mp_H5DSET_EXTENT_F H5D_mp_H5DGET_CREATE_PLIST_F
H5D_mp_H5DGET_STORAGE_SIZE_F
H5D_mp_H5DVLEN_GET_MAX_LEN_F
+H5D_mp_H5DGET_ACCESS_PLIST_F
; H5E
H5E_mp_H5ECLEAR_F
H5E_mp_H5EPRINT_F
@@ -268,6 +269,7 @@ H5I_mp_H5IINC_REF_F H5I_mp_H5IDEC_REF_F
H5I_mp_H5IGET_REF_F
H5I_mp_H5IGET_FILE_ID_F
+H5I_mp_H5IIS_VALID_F
; H5L
H5L_mp_H5LCOPY_F
H5L_mp_H5LDELETE_F
@@ -418,6 +420,8 @@ H5P_mp_H5PSET_SCALEOFFSET_F H5P_mp_H5PSET_NLINKS_F
H5P_mp_H5PGET_NLINKS_F
H5P_mp_H5PGET_CREATE_INTER_GROUP_F
+H5P_mp_H5PSET_CHUNK_CACHE_F
+H5P_mp_H5PGET_CHUNK_CACHE_F
; H5R
H5R_mp_H5RCREATE_OBJECT_F
H5R_mp_H5RCREATE_REGION_F
diff --git a/fortran/test/fortranlib_test.f90 b/fortran/test/fortranlib_test.f90 index 12c3af8..a544339 100644 --- a/fortran/test/fortranlib_test.f90 +++ b/fortran/test/fortranlib_test.f90 @@ -175,6 +175,9 @@ PROGRAM fortranlibtest CALL multi_file_test(cleanup, ret_total_error) CALL write_test_status(ret_total_error, ' Multi file driver test', total_error) + CALL test_chunk_cache (cleanup, ret_total_error) + CALL write_test_status(ret_total_error, ' Dataset chunk cache configuration', total_error) + ! write(*,*) ! write(*,*) '=========================================' ! write(*,*) 'Testing ATTRIBUTE interface ' @@ -239,5 +242,3 @@ PROGRAM fortranlibtest IF (total_error .NE. 0) CALL h5_exit_f (1) END PROGRAM fortranlibtest - - diff --git a/fortran/test/tH5I.f90 b/fortran/test/tH5I.f90 index 1ef7ba2..c34bd09 100644 --- a/fortran/test/tH5I.f90 +++ b/fortran/test/tH5I.f90 @@ -60,6 +60,30 @@ INTEGER :: ref_count ! Reference count for IDs + INTEGER(hid_t) :: dtype ! datatype id + LOGICAL :: tri_ret ! value + + ! + ! Tests the function H5Iis_valid_f + ! + ! check that the ID is not valid + dtype = -1 + CALL H5Iis_valid_f(dtype, tri_ret, error) + CALL check("H5Iis_valid_f", error, total_error) + CALL VerifyLogical("H5Iis_valid_f", tri_ret, .FALSE., total_error) + + ! Create a datatype id + CALL H5Tcopy_f(H5T_NATIVE_INTEGER,dtype,error) + CALL check("H5Tcopy_f", error, total_error) + + ! Check that the ID is valid + CALL H5Iis_valid_f(dtype, tri_ret, error) + CALL check("H5Iis_valid_f", error, total_error) + CALL VerifyLogical("H5Tequal_f", tri_ret, .TRUE., total_error) + + CALL H5Tclose_f(dtype, error) + CALL check("H5Tclose_f", error, total_error) + ! ! Create a new file using default properties. ! diff --git a/fortran/test/tH5P.f90 b/fortran/test/tH5P.f90 index 7e6c8de..cfa6f9b 100644 --- a/fortran/test/tH5P.f90 +++ b/fortran/test/tH5P.f90 @@ -49,8 +49,6 @@ buf_size = 4*1024*1024 - - ! !Create file "external.h5" using default properties. ! @@ -395,3 +393,276 @@ RETURN END SUBROUTINE multi_file_test + +!------------------------------------------------------------------------- +! Function: test_chunk_cache +! +! Purpose: Tests APIs: +! H5P_H5PSET_CHUNK_CACHE_F +! H5P_H5PGET_CHUNK_CACHE_F +! H5D_H5DGET_ACCESS_PLIST_F +! +! Return: Success: 0 +! Failure: -1 +! +! C Programmer: Neil Fortner +! Wednesday, October 29, 2008 +! +! FORTRAN Programmer: M. Scot Breitenfeld +! April 16, 2009 +!------------------------------------------------------------------------- +! +SUBROUTINE test_chunk_cache(cleanup, total_error) + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup + INTEGER, INTENT(OUT) :: total_error + + CHARACTER(LEN=14), PARAMETER :: filename="chunk_cache" + CHARACTER(LEN=80) :: fix_filename + INTEGER(hid_t) :: fid = -1 ! /* File ID */ + INTEGER(hid_t) :: file + INTEGER(hid_t) :: fapl_local = -1 ! /* Local fapl */ + INTEGER(hid_t) :: fapl_def = -1 ! /* Default fapl */ + INTEGER(hid_t) :: dcpl = -1 !/* Dataset creation property list ID */ + INTEGER(hid_t) :: dapl1 = -1 !/* Dataset access property list ID */ + INTEGER(hid_t) :: dapl2 = -1 !/* Dataset access property list ID */ + INTEGER(hid_t) :: sid = -1 !/* Dataspace ID */ + INTEGER(hid_t) :: dsid = -1 !/* Dataset ID */ + INTEGER(hsize_t), DIMENSION(1:1) :: chunk_dim, NDIM = (/100/) !/* Dataset and chunk dimensions */ + INTEGER(size_t) :: nslots_1, nslots_2, nslots_3, nslots_4 !/* rdcc number of elements */ + INTEGER(size_t) :: nbytes_1, nbytes_2, nbytes_3, nbytes_4 !/* rdcc number of bytes */ + INTEGER :: mdc_nelmts + INTEGER(size_t) ::nlinks !/* Number of link traversals */ + REAL :: w0_1, w0_2, w0_3, w0_4; !/* rdcc preemption policy */ + INTEGER :: error + INTEGER(size_t) rdcc_nelmts + INTEGER(size_t) rdcc_nbytes + REAL :: rdcc_w0 + + + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + IF (error .NE. 0) THEN + WRITE(*,*) "Cannot modify filename" + STOP + ENDIF + + !/* Create a default fapl and dapl */ + CALL H5Pcreate_f(H5P_FILE_ACCESS_F, fapl_def, error) + CALL check("H5Pcreate_f", error, total_error) + CALL H5Pcreate_f(H5P_DATASET_ACCESS_F, dapl1, error) + CALL check("H5Pcreate_f", error, total_error) + + ! Verify that H5Pget_chunk_cache(dapl) returns the same values as are in + ! the default fapl. + ! + CALL H5Pget_cache_f(fapl_def, mdc_nelmts, nslots_1, nbytes_1, w0_1, error) + CALL check("H5Pget_cache_f", error, total_error) + CALL H5Pget_chunk_cache_f(dapl1, nslots_4, nbytes_4, w0_4, error) + CALL check("H5Pget_chunk_cache_f", error, total_error) + CALL VERIFY("H5Pget_chunk_cache_f", INT(nslots_1), INT(nslots_4), total_error) + CALL VERIFY("H5Pget_chunk_cache_f", INT(nbytes_1), INT(nbytes_4), total_error) + IF(w0_1.NE.w0_4)THEN + CALL VERIFYlogical("H5Pget_chunk_cache_f", .TRUE., .FALSE., total_error) + ENDIF + + ! /* Set a lapl property on dapl1 (to verify inheritance) */ + CALL H5Pset_nlinks_f(dapl1, 134_size_t , error) + CALL check("H5Pset_nlinks_f", error, total_error) + CALL H5Pget_nlinks_f(dapl1, nlinks, error) + CALL check("H5Pget_nlinks_f", error, total_error) + CALL VERIFY("H5Pget_nlinks_f", INT(nlinks), 134, total_error) + + + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl_local, error) + CALL check("h5pcreate_f", error, total_error) + ! Turn off the chunk cache, so all the chunks are immediately written to disk + CALL H5Pget_cache_f(fapl_local, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0, error) + CALL check("H5Pget_cache_f", error, total_error) + rdcc_nbytes = 0; + CALL H5Pset_cache_f(fapl_local, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0, error) + CALL check("H5Pset_cache_f", error, total_error) + + ! Set new rdcc settings on fapl! + nslots_2 = nslots_1 * 2 + nbytes_2 = nbytes_1 * 2 + w0_2 = w0_1 / 2. + + CALL H5Pset_cache_f(fapl_local, 0, nslots_2, nbytes_2, w0_2, error) + CALL check("H5Pset_cache_f", error, total_error) + + !/* Create file */ + CALL H5Fcreate_f(fix_filename, H5F_ACC_TRUNC_F, fid, error, H5P_DEFAULT_F, fapl_local) + CALL check("H5Fcreate_f", error, total_error) + + !/* Create dataset creation property list */ + CALL H5Pcreate_f(H5P_DATASET_CREATE_F, dcpl, error) + CALL check("H5Pcreate_f", error, total_error) + + !/* Set chunking */ + chunk_dim(1) = 10; + CALL H5Pset_chunk_f(dcpl, 1, chunk_dim, error) + CALL check("H5Pset_chunk_f", error, total_error) + + !/* Create 1-D dataspace */ + ndim(1) = 100 + CALL H5Screate_simple_f(1, ndim, sid, error) + CALL check("H5Pcreate_f", error, total_error) + + ! /* Create dataset with default dapl */ + CALL H5Dcreate_f(fid, "dset", H5T_NATIVE_INTEGER, sid, dsid, error, dcpl, H5P_DEFAULT_F, dapl1) + CALL check("H5Pcreate_f", error, total_error) + + ! /* Retrieve dapl from dataset, verify cache values are the same as on fapl_local */ + CALL H5Dget_access_plist_f(dsid, dapl2, error) + CALL check("H5Dget_access_plist_f", error, total_error) + CALL H5Pget_chunk_cache_f(dapl2, nslots_4, nbytes_4, w0_4, error) + CALL check("H5Pget_chunk_cache_f", error, total_error) + CALL VERIFY("H5Pget_chunk_cache_f", INT(nslots_2), INT(nslots_4), total_error) + CALL VERIFY("H5Pget_chunk_cache_f", INT(nbytes_2), INT(nbytes_4), total_error) + IF(w0_2.NE.w0_4)THEN + CALL VERIFYlogical("H5Pget_chunk_cache_f", .TRUE., .FALSE., total_error) + ENDIF + CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) + + ! Set new values on dapl1. nbytes will be set to default, so the file + ! property will override this setting + + nslots_3 = nslots_2 * 2 + nbytes_3 = H5D_CHUNK_CACHE_NBYTES_DEFAULT_F + w0_3 = w0_2 / 2 + + CALL H5Pset_chunk_cache_f(dapl1, nslots_3, nbytes_3, w0_3, error) + CALL check("H5Pset_chunk_cache_f", error, total_error) + + ! Close dataset, reopen with dapl1. Note the use of a dapl with H5Oopen */ + CALL H5Dclose_f(dsid, error) + CALL H5Oopen_f(fid, "dset", dsid, error, dapl1) + + ! Retrieve dapl from dataset, verfiy cache values are the same as on dapl1 + ! + ! Note we rely on the knowledge that H5Pget_chunk_cache retrieves these + ! values directly from the dataset structure, and not from a copy of the + ! dapl used to open the dataset (which is not preserved). + ! + CALL H5Dget_access_plist_f(dsid, dapl2, error) + CALL check("H5Dget_access_plist_f", error, total_error) + CALL H5Pget_chunk_cache_f(dapl2, nslots_4, nbytes_4, w0_4, error) + CALL check("H5Pget_chunk_cache_f", error, total_error) + CALL VERIFY("H5Pget_chunk_cache_f", INT(nslots_3), INT(nslots_4), total_error) + CALL VERIFY("H5Pget_chunk_cache_f", INT(nbytes_2), INT(nbytes_4), total_error) + IF(w0_3.NE.w0_4)THEN + CALL VERIFYlogical("H5Pget_chunk_cache_f4", .TRUE., .FALSE., total_error) + ENDIF + CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) + + ! Close dataset, reopen with H5P_DEFAULT as dapl + CALL H5Dclose_f(dsid, error); CALL check("H5Dclose_f", error, total_error) + CALL H5Oopen_f(fid, "dset", dsid, error) + CALL check("H5Oopen_f", error, total_error) + + ! Retrieve dapl from dataset, verfiy cache values are the same as on fapl_local + + CALL H5Dget_access_plist_f(dsid, dapl2, error) + CALL check("H5Dget_access_plist_f", error, total_error) + CALL H5Pget_chunk_cache_f(dapl2, nslots_4, nbytes_4, w0_4, error) + CALL check("H5Pget_chunk_cache_f", error, total_error) + CALL VERIFY("H5Pget_chunk_cache_f", INT(nslots_2), INT(nslots_4), total_error) + CALL VERIFY("H5Pget_chunk_cache_f", INT(nbytes_2), INT(nbytes_4), total_error) + IF(w0_2.NE.w0_4)THEN + CALL VERIFYlogical("H5Pget_chunk_cache_f", .TRUE., .FALSE., total_error) + ENDIF + CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) + + ! Similary, test use of H5Dcreate2 with H5P_DEFAULT + CALL H5Dclose_f(dsid, error); CALL check("H5Dclose_f", error, total_error) + + CALL H5Dcreate_f(fid, "dset2", H5T_NATIVE_INTEGER, sid, dsid, error, dcpl, H5P_DEFAULT_F, H5P_DEFAULT_F) + CALL check("H5Pcreate_f", error, total_error) + + CALL H5Dget_access_plist_f(dsid, dapl2, error) + CALL check("H5Dget_access_plist_f", error, total_error) + + CALL H5Pget_chunk_cache_f(dapl2, nslots_4, nbytes_4, w0_4, error) + CALL check("H5Pget_chunk_cache_f", error, total_error) + CALL VERIFY("H5Pget_chunk_cache_f", INT(nslots_2), INT(nslots_4), total_error) + CALL VERIFY("H5Pget_chunk_cache_f", INT(nbytes_2), INT(nbytes_4), total_error) + IF(w0_2.NE.w0_4)THEN + CALL VERIFYlogical("H5Pget_chunk_cache_f", .TRUE., .FALSE., total_error) + ENDIF + ! Don't close dapl2, we will use it in the next section + + ! Modify cache values on fapl_local + nbytes_3 = nbytes_2 * 2 + + CALL H5Pset_cache_f(fapl_local, 0, nslots_3, nbytes_3, w0_3, error) + CALL check("H5Pset_cache_f", error, total_error) + + ! Close and reopen file with new fapl_local + + CALL H5Dclose_f(dsid, error); CALL check("H5Dclose_f", error, total_error) + CALL H5Fclose_f(fid,error); CALL check("h5fclose_f", error, total_error) + + CALL H5Fopen_f (fix_filename, H5F_ACC_RDWR_F, fid, error, fapl_local) + CALL check("h5fopen_f", error, total_error) + + ! Verify that dapl2 retrieved earlier (using values from the old fapl) + ! sets its values in the new file (test use of H5Dopen2 with a dapl) + ! + + CALL h5dopen_f (fid, "dset", dsid, error, dapl2) + CALL check("h5dopen_f", error, total_error) + + CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) ! Close dapl2, to avoid id leak + + CALL H5Dget_access_plist_f(dsid, dapl2, error) + CALL check("H5Dget_access_plist_f", error, total_error) + CALL H5Pget_chunk_cache_f(dapl2, nslots_4, nbytes_4, w0_4, error) + CALL check("H5Pget_chunk_cache_f", error, total_error) + CALL VERIFY("H5Pget_chunk_cache_f", INT(nslots_2), INT(nslots_4), total_error) + CALL VERIFY("H5Pget_chunk_cache_f", INT(nbytes_2), INT(nbytes_4), total_error) + IF(w0_2.NE.w0_4)THEN + CALL VERIFYlogical("H5Pget_chunk_cache_f", .TRUE., .FALSE., total_error) + ENDIF + + ! Test H5D_CHUNK_CACHE_NSLOTS_DEFAULT and H5D_CHUNK_CACHE_W0_DEFAULT + nslots_2 = H5D_CHUNK_CACHE_NSLOTS_DEFAULT_F + w0_2 = H5D_CHUNK_CACHE_W0_DEFAULT_F + + CALL H5Pset_chunk_cache_f(dapl2, nslots_2, nbytes_2, w0_2, error) + CALL check("H5Pset_chunk_cache_f", error, total_error) + + CALL H5Dclose_f(dsid, error); CALL check("H5Dclose_f", error, total_error) + CALL h5dopen_f (fid, "dset", dsid, error, dapl2) + CALL check("h5dopen_f", error, total_error) + + CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) + + CALL H5Dget_access_plist_f(dsid, dapl2, error) + CALL check("H5Dget_access_plist_f", error, total_error) + CALL H5Pget_chunk_cache_f(dapl2, nslots_4, nbytes_4, w0_4, error) + CALL check("H5Pget_chunk_cache_f", error, total_error) + CALL VERIFY("H5Pget_chunk_cache_f", INT(nslots_3), INT(nslots_4), total_error) + CALL VERIFY("H5Pget_chunk_cache_f", INT(nbytes_2), INT(nbytes_4), total_error) + IF(w0_3.NE.w0_4)THEN + CALL VERIFYlogical("H5Pget_chunk_cache_f", .TRUE., .FALSE., total_error) + ENDIF + +! Close + + CALL H5Dclose_f(dsid, error); CALL check("H5Dclose_f", error, total_error) + CALL H5Sclose_f(sid,error); CALL check("H5Sclose_f", error, total_error) + CALL H5Pclose_f(fapl_local,error); CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(fapl_def,error); CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(dapl1,error); CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(dcpl,error); CALL check("H5Pclose_f", error, total_error) + CALL H5Fclose_f(fid,error); CALL check("H5Fclose_f", error, total_error) + + IF(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + +END SUBROUTINE test_chunk_cache + |