Removed the use of C wrappers from H5P APIs. (#3824)

* fix seg fault on frontier/cray

* fix seg fault on frontier/cray

* fix seg fault on frontier/cray

* removed the use of h5pclose_c

* removed the use of h5pclose_c
This commit is contained in:
Scot Breitenfeld 2023-11-03 08:02:50 -05:00 committed by GitHub
parent 7404b57da6
commit 5e787741cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 107 deletions

View File

@ -1263,7 +1263,7 @@ CONTAINS
INTERFACE
INTEGER FUNCTION h5oget_info_by_idx_c(loc_id, group_name, namelen, &
index_field, order, n, lapl_id_default, object_info, fields) BIND(C, NAME='h5oget_info_by_idx_c')
IMPORT :: c_char, c_ptr, c_funptr
IMPORT :: c_char, c_ptr
IMPORT :: HID_T, SIZE_T, HSIZE_T
INTEGER(HID_T) , INTENT(IN) :: loc_id
CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: group_name

View File

@ -69,30 +69,6 @@ done:
return ret_value;
}
/****if* H5Pf/h5pclose_c
* NAME
* h5pclose_c
* PURPOSE
* Call H5Pclose to close property lis
* INPUTS
* prp_id - identifier of the property list to be closed
* RETURNS
* 0 on success, -1 on failure
* SOURCE
*/
int_f
h5pclose_c(hid_t_f *prp_id)
/******/
{
int_f ret_value = 0;
if (H5Pclose((hid_t)*prp_id) < 0)
ret_value = -1;
return ret_value;
}
/****if* H5Pf/h5pcopy_c
* NAME
* h5pcopy_c
@ -2252,52 +2228,6 @@ h5pget_hyper_vector_size_c(hid_t_f *prp_id, size_t_f *size)
return ret_value;
}
/****if* H5Pf/h5pcreate_class_c
* NAME
* h5pcreate_class_c
* PURPOSE
* Call H5Pcreate_class ito create a new property class
* INPUTS
* parent - property list class identifier
* name - name of the new class
* name_len - length of the "name" buffer
* OUTPUTS
* class - new class identifier
* RETURNS
* 0 on success, -1 on failure
* SOURCE
*/
int_f
h5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *cls, H5P_cls_create_func_t create,
void *create_data, H5P_cls_copy_func_t copy, void *copy_data, H5P_cls_close_func_t close,
void *close_data)
/******/
{
int ret_value = -1;
hid_t c_class;
char *c_name;
c_name = (char *)HD5f2cstring(name, (size_t)*name_len);
if (c_name == NULL)
goto DONE;
/*
* Call H5Pcreate_class function.
*/
c_class =
H5Pcreate_class((hid_t)*parent, c_name, create, create_data, copy, copy_data, close, close_data);
if (c_class < 0)
goto DONE;
*cls = (hid_t_f)c_class;
ret_value = 0;
DONE:
if (c_name != NULL)
free(c_name);
return ret_value;
}
/****if* H5Pf/h5pregister_c
* NAME
* h5pregister_c

View File

@ -400,15 +400,16 @@ CONTAINS
INTEGER(HID_T), INTENT(IN) :: prp_id
INTEGER, INTENT(OUT) :: hdferr
INTERFACE
INTEGER FUNCTION h5pclose_c(prp_id) &
BIND(C,NAME='h5pclose_c')
INTEGER(C_INT) FUNCTION H5Pclose(prp_id) &
BIND(C,NAME='H5Pclose')
IMPORT :: C_INT
IMPORT :: HID_T
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: prp_id
END FUNCTION h5pclose_c
INTEGER(HID_T), VALUE :: prp_id
END FUNCTION H5Pclose
END INTERFACE
hdferr = h5pclose_c(prp_id)
hdferr = INT(H5Pclose(prp_id))
END SUBROUTINE h5pclose_f
!>
@ -5005,31 +5006,32 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr)
INTEGER , INTENT(OUT) :: hdferr
TYPE(C_PTR) , OPTIONAL, INTENT(IN) :: create_data, copy_data, close_data
TYPE(C_FUNPTR) , OPTIONAL, INTENT(IN) :: create, copy, close
INTEGER :: name_len
TYPE(C_PTR) :: create_data_default, copy_data_default, close_data_default
TYPE(C_PTR) :: create_data_default, copy_data_default, close_data_default
TYPE(C_FUNPTR) :: create_default, copy_default, close_default
INTERFACE
INTEGER FUNCTION h5pcreate_class_c(parent, name, name_len, class, &
create, create_data, copy, copy_data, close, close_data) &
BIND(C, NAME='h5pcreate_class_c')
IMPORT :: c_char, c_ptr, c_funptr
IMPORT :: HID_T
INTEGER(HID_T), INTENT(IN) :: parent
CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name
INTEGER, INTENT(IN) :: name_len
INTEGER(HID_T), INTENT(OUT) :: class
TYPE(C_PTR), VALUE :: create_data, copy_data, close_data
TYPE(C_FUNPTR), VALUE :: create, copy, close
END FUNCTION h5pcreate_class_c
END INTERFACE
name_len = LEN(name)
create_default = c_null_funptr !fix:scot
create_data_default = c_null_ptr
copy_default = c_null_funptr !fix:scot
copy_data_default = c_null_ptr
close_default = c_null_funptr !fix:scot
close_data_default = c_null_ptr
CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name
INTERFACE
INTEGER(HID_T) FUNCTION H5Pcreate_class(parent, name, &
create, create_data, copy, copy_data, close, close_data) &
BIND(C, NAME='H5Pcreate_class')
IMPORT :: C_CHAR, C_PTR, C_FUNPTR
IMPORT :: HID_T
INTEGER(HID_T), VALUE :: parent
CHARACTER(KIND=C_CHAR), DIMENSION(*) :: name
TYPE(C_PTR), VALUE :: create_data, copy_data, close_data
TYPE(C_FUNPTR), VALUE :: create, copy, close
END FUNCTION H5Pcreate_class
END INTERFACE
c_name = TRIM(name)//C_NULL_CHAR
create_default = C_NULL_FUNPTR
create_data_default = C_NULL_PTR
copy_default = C_NULL_FUNPTR
copy_data_default = C_NULL_PTR
close_default = C_NULL_FUNPTR
close_data_default = C_NULL_PTR
IF(PRESENT(create)) create_default = create
IF(PRESENT(create_data)) create_data_default = create_data
@ -5038,11 +5040,14 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr)
IF(PRESENT(close)) close_default = close
IF(PRESENT(close_data)) close_data_default = close_data
hdferr = h5pcreate_class_c(parent, name , name_len, class, &
class = H5Pcreate_class(parent, c_name, &
create_default, create_data_default, &
copy_default, copy_data_default, &
close_default, close_data_default)
hdferr = 0
IF(class.LT.0) hdferr = -1
END SUBROUTINE h5pcreate_class_f
!>

View File

@ -368,7 +368,6 @@ H5_FCDLL int_f h5otoken_cmp_c(hid_t_f *loc_id, H5O_token_t *token1, H5O_token_t
* Functions from H5Pf.c
*/
H5_FCDLL int_f h5pcreate_c(hid_t_f *cls, hid_t_f *prp_id);
H5_FCDLL int_f h5pclose_c(hid_t_f *prp_id);
H5_FCDLL int_f h5pcopy_c(hid_t_f *prp_id, hid_t_f *new_prp_id);
H5_FCDLL int_f h5pequal_c(hid_t_f *plist1_id, hid_t_f *plist2_id, int_f *c_flag);
H5_FCDLL int_f h5pget_class_c(hid_t_f *prp_id, hid_t_f *classtype);
@ -451,9 +450,6 @@ H5_FCDLL int_f h5pset_small_data_block_size_c(hid_t_f *plist, hsize_t_f *size);
H5_FCDLL int_f h5pget_small_data_block_size_c(hid_t_f *plist, hsize_t_f *size);
H5_FCDLL int_f h5pset_hyper_vector_size_c(hid_t_f *plist, size_t_f *size);
H5_FCDLL int_f h5pget_hyper_vector_size_c(hid_t_f *plist, size_t_f *size);
H5_FCDLL int_f h5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *cls,
H5P_cls_create_func_t create, void *create_data, H5P_cls_copy_func_t copy,
void *copy_data, H5P_cls_close_func_t close, void *close_data);
H5_FCDLL int_f h5pregister_c(hid_t_f *cls, _fcd name, int_f *name_len, size_t_f *size, void *value);
H5_FCDLL int_f h5pinsert_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, void *value);
H5_FCDLL int_f h5pset_c(hid_t_f *prp_id, _fcd name, int_f *name_len, void *value);

View File

@ -258,7 +258,6 @@ H5P_mp_H5PSET_PRESERVE_F
H5P_mp_H5PGET_PRESERVE_F
H5P_mp_H5PGET_CLASS_F
H5P_mp_H5PCOPY_F
H5P_mp_H5PCLOSE_F
H5P_mp_H5PSET_CHUNK_F
H5P_mp_H5PGET_CHUNK_F
H5P_mp_H5PSET_DEFLATE_F
@ -331,7 +330,6 @@ H5P_mp_H5PCOPY_PROP_F
H5P_mp_H5PREMOVE_F
H5P_mp_H5PUNREGISTER_F
H5P_mp_H5PCLOSE_CLASS_F
H5P_mp_H5PCREATE_CLASS_F
H5P_mp_H5PREGISTER_INTEGER
H5P_mp_H5PREGISTER_CHAR
H5P_mp_H5PINSERT_CHAR

View File

@ -36,7 +36,7 @@ TEST_PROG_PARA=parallel_test subfiling_test async_test
check_PROGRAMS=$(TEST_PROG_PARA)
# Temporary files
CHECK_CLEANFILES+=parf[12].h5 h5*_tests.h5 subf.h5* test_async_apis.mod
CHECK_CLEANFILES+=parf[12].h5 h5*_tests.h5 subf.h5* *.mod
# Test source files
parallel_test_SOURCES=ptest.F90 hyper.F90 mdset.F90 multidsetrw.F90