diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index d304f47548..a79c4d8527 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -8,14 +8,16 @@ add_subdirectory(utils) # HDF5 VOL requires 1.13+ if(ADIOS2_HAVE_HDF5) - if(HDF5_VERSION VERSION_LESS 1.13) + if(HDF5_VERSION VERSION_LESS 1.14) set(ADIOS2_HAVE_HDF5_VOL OFF CACHE INTERNAL "") + message(STATUS "[ADIOS2 WARNING] To enable ADIOS VOL for HDF5, please use the version 1.14+ ") else() set(ADIOS2_HAVE_HDF5_VOL ON CACHE INTERNAL "") endif() else() set(ADIOS2_HAVE_HDF5_VOL OFF CACHE INTERNAL "") endif() + if(ADIOS2_HAVE_HDF5_VOL) add_subdirectory(h5vol) endif() diff --git a/source/h5vol/H5Vol_dataset.c b/source/h5vol/H5Vol_dataset.c index bf78e4d6a3..1a969db85e 100644 --- a/source/h5vol/H5Vol_dataset.c +++ b/source/h5vol/H5Vol_dataset.c @@ -85,20 +85,29 @@ void *H5VL_adios2_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, return result; } -herr_t H5VL_adios2_dataset_read(void *dset, hid_t mem_type_id, - hid_t mem_space_id, hid_t file_space_id, - hid_t plist_id, void *buf, void **req) +herr_t H5VL_adios2_dataset_read(size_t count, void *dset_array[], + hid_t mem_type_id_array[], + hid_t mem_space_id_array[], + hid_t file_space_id_array[], hid_t dxpl_id, + void *buf_array[], + void **req) // last parameter is unused as in h5 { - REQUIRE_NOT_NULL_ERR(dset, -1); - H5VL_ObjDef_t *vol = (H5VL_ObjDef_t *)dset; + herr_t returnValue = 0; + for (size_t i = 0; i < count; i++) + { + REQUIRE_NOT_NULL_ERR(dset_array[i], -1); + H5VL_ObjDef_t *vol = (H5VL_ObjDef_t *)(dset_array[i]); - H5VL_VarDef_t *var = (H5VL_VarDef_t *)(vol->m_ObjPtr); + H5VL_VarDef_t *var = (H5VL_VarDef_t *)(vol->m_ObjPtr); - var->m_HyperSlabID = file_space_id; - var->m_MemSpaceID = mem_space_id; + var->m_HyperSlabID = file_space_id_array[i]; + var->m_MemSpaceID = mem_space_id_array[i]; - var->m_Data = buf; - return gADIOS2ReadVar(var); + var->m_Data = buf_array[i]; + if (gADIOS2ReadVar(var) < 0) + returnValue = -1; + } + return returnValue; } herr_t H5VL_adios2_dataset_get(void *dset, H5VL_dataset_get_args_t *args, @@ -130,30 +139,34 @@ herr_t H5VL_adios2_dataset_get(void *dset, H5VL_dataset_get_args_t *args, return 0; } -herr_t H5VL_adios2_dataset_write(void *dset, hid_t mem_type_id, - hid_t mem_space_id, hid_t file_space_id, - hid_t plist_id, const void *buf, void **req) +herr_t H5VL_adios2_dataset_write(size_t count, void *dset_array[], + hid_t mem_type_id_array[], + hid_t mem_space_id_array[], + hid_t file_space_id_array[], hid_t dxpl_id, + const void *buf_array[], void **req) { - REQUIRE_NOT_NULL_ERR(dset, -1); - H5VL_ObjDef_t *vol = (H5VL_ObjDef_t *)dset; - H5VL_VarDef_t *varDef = (H5VL_VarDef_t *)(vol->m_ObjPtr); + for (size_t i = 0; i < count; i++) + { + REQUIRE_NOT_NULL_ERR(dset_array[0], -1); + H5VL_ObjDef_t *vol = (H5VL_ObjDef_t *)(dset_array[0]); + H5VL_VarDef_t *varDef = (H5VL_VarDef_t *)(vol->m_ObjPtr); - // H5VL_VarDef_t *varDef = (H5VL_VarDef_t *)dset; - varDef->m_Data = (void *)buf; + varDef->m_Data = (void *)(buf_array[i]); - if (file_space_id > 0) - varDef->m_HyperSlabID = file_space_id; - else - varDef->m_HyperSlabID = varDef->m_ShapeID; + if (file_space_id_array[i] > 0) + varDef->m_HyperSlabID = file_space_id_array[i]; + else + varDef->m_HyperSlabID = varDef->m_ShapeID; - if (mem_space_id > 0) - varDef->m_MemSpaceID = mem_space_id; - else - varDef->m_MemSpaceID = varDef->m_ShapeID; + if (mem_space_id_array[i] > 0) + varDef->m_MemSpaceID = mem_space_id_array[i]; + else + varDef->m_MemSpaceID = varDef->m_ShapeID; - varDef->m_PropertyID = plist_id; + varDef->m_PropertyID = dxpl_id; // plist_id; - gADIOS2CreateVar(vol->m_FileIO, varDef); + gADIOS2CreateVar(vol->m_FileIO, varDef); + } return 0; } diff --git a/source/h5vol/H5Vol_def.h b/source/h5vol/H5Vol_def.h index e84056cee6..72e789a0cb 100644 --- a/source/h5vol/H5Vol_def.h +++ b/source/h5vol/H5Vol_def.h @@ -167,17 +167,20 @@ extern void *H5VL_adios2_dataset_open(void *obj, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -extern herr_t H5VL_adios2_dataset_read(void *dset, hid_t mem_type_id, - hid_t mem_space_id, hid_t file_space_id, - hid_t plist_id, void *buf, void **req); +extern herr_t H5VL_adios2_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); extern herr_t H5VL_adios2_dataset_get(void *dset, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req); -extern herr_t H5VL_adios2_dataset_write(void *dset, hid_t mem_type_id, - hid_t mem_space_id, hid_t file_space_id, - hid_t plist_id, const void *buf, - void **req); +extern herr_t H5VL_adios2_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); extern herr_t H5VL_adios2_dataset_close(void *dset, hid_t dxpl_id, void **req);