Skip to content

Commit

Permalink
Update connector for HDF5 1.13.3 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jhendersonHDF committed Dec 20, 2022
1 parent b329c24 commit 0c9d05c
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 36 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ installation of the DAOS VOL connector on a DAOS-enabled system.
To build the DAOS VOL connector, the following libraries are required:

+ `libhdf5` - The [HDF5](https://www.hdfgroup.org/downloads/hdf5/) library.
Minimum version required is 1.13.0, compiled with
Minimum version required is 1.13.3, compiled with
support for both parallel I/O and map objects.

+ `libdaos` - The [DAOS](https://github.com/daos-stack/daos) library.
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ set(HDF5_VOL_DAOS_EXT_LIB_DEPENDENCIES
)

# HDF5
find_package(HDF5 1.13.0 NO_MODULE NAMES hdf5 COMPONENTS C shared)
find_package(HDF5 1.13.3 NO_MODULE NAMES hdf5 COMPONENTS C shared)
if(HDF5_FOUND)
set(HDF5_C_SHARED_LIBRARY hdf5-shared)
if(NOT TARGET ${HDF5_C_SHARED_LIBRARY})
Expand All @@ -40,7 +40,7 @@ if(HDF5_FOUND)
set(HDF5_VOL_DAOS_USE_SYSTEM_CMAKE_HDF5 1 PARENT_SCOPE)
else()
# Allow for HDF5 autotools builds
find_package(HDF5 1.13.0 MODULE REQUIRED)
find_package(HDF5 1.13.3 MODULE REQUIRED)
set(HDF5_VOL_DAOS_EXT_INCLUDE_DEPENDENCIES
${HDF5_VOL_DAOS_EXT_INCLUDE_DEPENDENCIES}
${HDF5_INCLUDE_DIRS}
Expand Down
44 changes: 39 additions & 5 deletions src/daos_vol.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ static herr_t H5_daos_fill_def_plist_cache(void);
static void * H5_daos_faccess_info_copy(const void *_old_fa);
static herr_t H5_daos_faccess_info_free(void *_fa);
static herr_t H5_daos_get_conn_cls(void *item, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls);
static herr_t H5_daos_get_cap_flags(const void *info, unsigned *cap_flags);

#if H5VL_VERSION >= 3
static herr_t H5_daos_get_cap_flags(const void *info, uint64_t *cap_flags);
#else
static herr_t H5_daos_get_cap_flags(const void *info, unsigned *cap_flags);
#endif

static herr_t H5_daos_opt_query(void *item, H5VL_subclass_t cls, int opt_type,
H5_DAOS_OPT_QUERY_OUT_TYPE *supported);
static herr_t H5_daos_optional(void *item, H5VL_optional_args_t *opt_args, hid_t dxpl_id, void **req);
Expand All @@ -113,6 +119,28 @@ static int H5_daos_task_wait_task(tse_task_t *task);
static int H5_daos_collective_error_check_prep_cb(tse_task_t *task, void *args);
static int H5_daos_collective_error_check_comp_cb(tse_task_t *task, void *args);

#if H5VL_VERSION >= 3

#define H5VL_DAOS_CAP_FLAGS \
(H5VL_CAP_FLAG_ASYNC | H5VL_CAP_FLAG_ATTR_BASIC | H5VL_CAP_FLAG_ATTR_MORE | \
H5VL_CAP_FLAG_DATASET_BASIC | H5VL_CAP_FLAG_DATASET_MORE | H5VL_CAP_FLAG_FILE_BASIC | \
H5VL_CAP_FLAG_FILE_MORE | H5VL_CAP_FLAG_GROUP_BASIC | H5VL_CAP_FLAG_GROUP_MORE | \
H5VL_CAP_FLAG_LINK_BASIC | H5VL_CAP_FLAG_LINK_MORE | H5VL_CAP_FLAG_MAP_BASIC | \
H5VL_CAP_FLAG_MAP_MORE | H5VL_CAP_FLAG_OBJECT_BASIC | H5VL_CAP_FLAG_OBJECT_MORE | \
H5VL_CAP_FLAG_REF_BASIC | H5VL_CAP_FLAG_REF_MORE | H5VL_CAP_FLAG_OBJ_REF | \
H5VL_CAP_FLAG_REG_REF | H5VL_CAP_FLAG_ATTR_REF | H5VL_CAP_FLAG_STORED_DATATYPES | \
H5VL_CAP_FLAG_CREATION_ORDER | H5VL_CAP_FLAG_ITERATE | H5VL_CAP_FLAG_STORAGE_SIZE | \
H5VL_CAP_FLAG_BY_IDX | H5VL_CAP_FLAG_GET_PLIST | H5VL_CAP_FLAG_FLUSH_REFRESH | \
H5VL_CAP_FLAG_EXTERNAL_LINKS | H5VL_CAP_FLAG_HARD_LINKS | H5VL_CAP_FLAG_SOFT_LINKS | \
H5VL_CAP_FLAG_UD_LINKS | H5VL_CAP_FLAG_TRACK_TIMES | H5VL_CAP_FLAG_FILL_VALUES)

#else

#define H5VL_DAOS_CAP_FLAGS H5VL_CAP_FLAG_NONE

#endif


/*******************/
/* Local Variables */
/*******************/
Expand All @@ -125,9 +153,9 @@ static const H5VL_class_t H5_daos_g = {
#if H5VL_VERSION >= 1
HDF5_VOL_DAOS_VERSION_1, /* Connector Version number */
#endif
H5VL_CAP_FLAG_NONE, /* Connector capability flags */
H5_daos_init, /* Connector initialize */
H5_daos_term, /* Connector terminate */
H5VL_DAOS_CAP_FLAGS, /* Connector capability flags */
H5_daos_init, /* Connector initialize */
H5_daos_term, /* Connector terminate */
{
sizeof(H5_daos_acc_params_t), /* Connector Info size */
H5_daos_faccess_info_copy, /* Connector Info copy */
Expand Down Expand Up @@ -1865,7 +1893,13 @@ H5_daos_get_conn_cls(void *item, H5VL_get_conn_lvl_t H5VL_DAOS_UNUSED lvl, const
*---------------------------------------------------------------------------
*/
static herr_t
H5_daos_get_cap_flags(const void H5VL_DAOS_UNUSED *info, unsigned *cap_flags)
H5_daos_get_cap_flags(const void H5VL_DAOS_UNUSED *info,
#if H5VL_VERSION >= 3
uint64_t *cap_flags
#else
unsigned *cap_flags
#endif
)
{
herr_t ret_value = SUCCEED;

Expand Down
104 changes: 82 additions & 22 deletions src/daos_vol_dset.c
Original file line number Diff line number Diff line change
Expand Up @@ -3479,35 +3479,65 @@ H5_daos_dataset_read_int(H5_daos_dset_t *dset, hid_t mem_type_id, hid_t mem_spac
*
*-------------------------------------------------------------------------
*/
#if H5VL_VERSION >= 3
herr_t
H5_daos_dataset_read(size_t count, void *_dset[], hid_t mem_type_id[], hid_t mem_space_id[], hid_t file_space_id[],
hid_t dxpl_id, void *buf[], void **req)
#else
herr_t
H5_daos_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
void *buf, void **req)
#endif
{
H5_daos_dset_t * dset = (H5_daos_dset_t *)_dset;
H5_daos_dset_t * dset = NULL;
H5_daos_io_task_ud_t *task_ud = NULL;
tse_task_t * io_task = NULL;
tse_task_t * first_task = NULL;
tse_task_t * dep_task = NULL;
H5_daos_req_t * int_req = NULL;
htri_t need_tconv = FALSE;
hid_t req_dxpl_id;
hid_t local_mem_type_id = H5I_INVALID_HID;
hid_t local_mem_space_id = H5I_INVALID_HID;
hid_t local_file_space_id = H5I_INVALID_HID;
void * local_buf = NULL;
int ret;
herr_t ret_value = SUCCEED;

H5_daos_inc_api_cnt();

if (!_dset)
/* Set convenience variables to handle VOL structure versioning */
#if H5VL_VERSION >= 3
dset = (H5_daos_dset_t *)_dset[0];
local_mem_type_id = mem_type_id[0];
local_mem_space_id = mem_space_id[0];
local_file_space_id = file_space_id[0];
local_buf = buf[0];
#else
dset = (H5_daos_dset_t *)_dset;
local_mem_type_id = mem_type_id;
local_mem_space_id = mem_space_id;
local_file_space_id = file_space_id;
local_buf = buf;
#endif

if (!dset)
D_GOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataset object is NULL");
if (H5I_DATASET != dset->obj.item.type)
D_GOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "object is not a dataset");

#if H5VL_VERSION >= 3
if (count != 1)
D_GOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "multi-dataset I/O is currently unsupported");
#endif

H5_DAOS_MAKE_ASYNC_PROGRESS(FAIL);

/* If the dataset's datatype is complete, check if type conversion is needed
*/
if (dset->obj.item.open_req->status == 0 || dset->obj.item.created) {
/* Check if datatype conversion is needed */
if ((need_tconv = H5_daos_need_tconv(dset->file_type_id, mem_type_id)) < 0)
if ((need_tconv = H5_daos_need_tconv(dset->file_type_id, local_mem_type_id)) < 0)
D_GOTO_ERROR(H5E_DATASET, H5E_CANTCOMPARE, FAIL, "can't check if type conversion is needed");
req_dxpl_id = need_tconv ? dxpl_id : H5P_DATASET_XFER_DEFAULT;
} /* end if */
Expand All @@ -3523,8 +3553,8 @@ H5_daos_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, hid_t f
* must be complete and there must not be an in-flight set_extent. */
if ((dset->obj.item.open_req->status == 0) && (dset->cur_set_extent_space_id == H5I_INVALID_HID)) {
/* Call internal routine */
if (H5_daos_dataset_read_int(dset, mem_type_id, mem_space_id, file_space_id, need_tconv, buf, NULL,
int_req, &first_task, &dep_task) < 0)
if (H5_daos_dataset_read_int(dset, local_mem_type_id, local_mem_space_id, local_file_space_id,
need_tconv, local_buf, NULL, int_req, &first_task, &dep_task) < 0)
D_GOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "failed to read data from dataset");
} /* end if */
else {
Expand All @@ -3537,18 +3567,18 @@ H5_daos_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, hid_t f
task_ud->mem_type_id = H5I_INVALID_HID;
task_ud->mem_space_id = H5I_INVALID_HID;
task_ud->file_space_id = H5I_INVALID_HID;
task_ud->buf.rbuf = buf;
task_ud->buf.rbuf = local_buf;

/* Copy dataspaces and datatype */
if ((task_ud->mem_type_id = H5Tcopy(mem_type_id)) < 0)
if ((task_ud->mem_type_id = H5Tcopy(local_mem_type_id)) < 0)
D_GOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy memory type ID");
if (mem_space_id == H5S_ALL)
if (local_mem_space_id == H5S_ALL)
task_ud->mem_space_id = H5S_ALL;
else if ((task_ud->mem_space_id = H5Scopy(mem_space_id)) < 0)
else if ((task_ud->mem_space_id = H5Scopy(local_mem_space_id)) < 0)
D_GOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy memory space ID");
if (file_space_id == H5S_ALL)
if (local_file_space_id == H5S_ALL)
task_ud->file_space_id = H5S_ALL;
else if ((task_ud->file_space_id = H5Scopy(file_space_id)) < 0)
else if ((task_ud->file_space_id = H5Scopy(local_file_space_id)) < 0)
D_GOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy file space ID");

/* Create end task for reading data */
Expand Down Expand Up @@ -3815,28 +3845,58 @@ H5_daos_dataset_write_int(H5_daos_dset_t *dset, hid_t mem_type_id, hid_t mem_spa
*
*-------------------------------------------------------------------------
*/
#if H5VL_VERSION >= 3
herr_t
H5_daos_dataset_write(size_t count, void *_dset[], hid_t mem_type_id[], hid_t mem_space_id[], hid_t file_space_id[],
hid_t dxpl_id, const void *buf[], void **req)
#else
herr_t
H5_daos_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
const void *buf, void **req)
#endif
{
H5_daos_dset_t * dset = (H5_daos_dset_t *)_dset;
H5_daos_dset_t * dset = NULL;
H5_daos_io_task_ud_t *task_ud = NULL;
tse_task_t * io_task = NULL;
tse_task_t * first_task = NULL;
tse_task_t * dep_task = NULL;
H5_daos_req_t * int_req = NULL;
htri_t need_tconv = FALSE;
hid_t req_dxpl_id;
hid_t local_mem_type_id = H5I_INVALID_HID;
hid_t local_mem_space_id = H5I_INVALID_HID;
hid_t local_file_space_id = H5I_INVALID_HID;
const void * local_buf = NULL;
int ret;
herr_t ret_value = SUCCEED;

H5_daos_inc_api_cnt();

if (!_dset)
/* Set convenience variables to handle VOL structure versioning */
#if H5VL_VERSION >= 3
dset = (H5_daos_dset_t *)_dset[0];
local_mem_type_id = mem_type_id[0];
local_mem_space_id = mem_space_id[0];
local_file_space_id = file_space_id[0];
local_buf = buf[0];
#else
dset = (H5_daos_dset_t *)_dset;
local_mem_type_id = mem_type_id;
local_mem_space_id = mem_space_id;
local_file_space_id = file_space_id;
local_buf = buf;
#endif

if (!dset)
D_GOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataset object is NULL");
if (H5I_DATASET != dset->obj.item.type)
D_GOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "object is not a dataset");

#if H5VL_VERSION >= 3
if (count != 1)
D_GOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "multi-dataset I/O is currently unsupported");
#endif

H5_DAOS_MAKE_ASYNC_PROGRESS(FAIL);

/* Check for write access */
Expand All @@ -3847,7 +3907,7 @@ H5_daos_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, hid_t
*/
if (dset->obj.item.open_req->status == 0 || dset->obj.item.created) {
/* Check if datatype conversion is needed */
if ((need_tconv = H5_daos_need_tconv(dset->file_type_id, mem_type_id)) < 0)
if ((need_tconv = H5_daos_need_tconv(dset->file_type_id, local_mem_type_id)) < 0)
D_GOTO_ERROR(H5E_DATASET, H5E_CANTCOMPARE, FAIL, "can't check if type conversion is needed");
req_dxpl_id = need_tconv ? dxpl_id : H5P_DATASET_XFER_DEFAULT;
} /* end if */
Expand All @@ -3863,8 +3923,8 @@ H5_daos_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, hid_t
* must be complete and there must not be an in-flight set_extent. */
if ((dset->obj.item.open_req->status == 0) && (dset->cur_set_extent_space_id == H5I_INVALID_HID)) {
/* Call internal routine */
if (H5_daos_dataset_write_int(dset, mem_type_id, mem_space_id, file_space_id, need_tconv, buf, NULL,
int_req, &first_task, &dep_task) < 0)
if (H5_daos_dataset_write_int(dset, local_mem_type_id, local_mem_space_id, local_file_space_id,
need_tconv, local_buf, NULL, int_req, &first_task, &dep_task) < 0)
D_GOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "failed to write data to dataset");
} /* end if */
else {
Expand All @@ -3877,18 +3937,18 @@ H5_daos_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, hid_t
task_ud->mem_type_id = H5I_INVALID_HID;
task_ud->mem_space_id = H5I_INVALID_HID;
task_ud->file_space_id = H5I_INVALID_HID;
task_ud->buf.wbuf = buf;
task_ud->buf.wbuf = local_buf;

/* Copy dataspaces and datatype */
if ((task_ud->mem_type_id = H5Tcopy(mem_type_id)) < 0)
if ((task_ud->mem_type_id = H5Tcopy(local_mem_type_id)) < 0)
D_GOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy memory type ID");
if (mem_space_id == H5S_ALL)
if (local_mem_space_id == H5S_ALL)
task_ud->mem_space_id = H5S_ALL;
else if ((task_ud->mem_space_id = H5Scopy(mem_space_id)) < 0)
else if ((task_ud->mem_space_id = H5Scopy(local_mem_space_id)) < 0)
D_GOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy memory space ID");
if (file_space_id == H5S_ALL)
if (local_file_space_id == H5S_ALL)
task_ud->file_space_id = H5S_ALL;
else if ((task_ud->file_space_id = H5Scopy(file_space_id)) < 0)
else if ((task_ud->file_space_id = H5Scopy(local_file_space_id)) < 0)
D_GOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy file space ID");

/* Create end task for writing data */
Expand Down
24 changes: 18 additions & 6 deletions src/daos_vol_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ typedef d_sg_list_t daos_sg_list_t;
#endif

/* Check for unknown H5VL_VERSION */
#if H5VL_VERSION > 2
#if H5VL_VERSION > 3
#error Unknown H5VL_VERSION - HDF5 library is probably too new or connector is too old
#endif

Expand Down Expand Up @@ -1264,11 +1264,23 @@ H5VL_DAOS_PRIVATE void * H5_daos_dataset_create(void *_item, const H5VL_loc_para
hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
H5VL_DAOS_PRIVATE void * H5_daos_dataset_open(void *_item, const H5VL_loc_params_t *loc_params,
const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
H5VL_DAOS_PRIVATE herr_t H5_daos_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t dxpl_id, void *buf, void **req);
H5VL_DAOS_PRIVATE herr_t H5_daos_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t dxpl_id, const void *buf,
void **req);

#if H5VL_VERSION >= 3
herr_t
H5_daos_dataset_read(size_t count, void *_dset[], hid_t mem_type_id[], hid_t mem_space_id[], hid_t file_space_id[],
hid_t dxpl_id, void *buf[], void **req);
herr_t
H5_daos_dataset_write(size_t count, void *_dset[], hid_t mem_type_id[], hid_t mem_space_id[], hid_t file_space_id[],
hid_t dxpl_id, const void *buf[], void **req);
#else
herr_t
H5_daos_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
void *buf, void **req);
herr_t
H5_daos_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
const void *buf, void **req);
#endif

H5VL_DAOS_PRIVATE herr_t H5_daos_dataset_get(void *_dset, H5VL_dataset_get_args_t *get_args, hid_t dxpl_id,
void **req);
H5VL_DAOS_PRIVATE herr_t H5_daos_dataset_specific(void *_item, H5VL_dataset_specific_args_t *specific_args,
Expand Down

0 comments on commit 0c9d05c

Please sign in to comment.