Skip to content

Commit

Permalink
Merge pull request #3516 from guj/h5vol_update
Browse files Browse the repository at this point in the history
Hdf5 vol support will require latest hdf5 1.14
  • Loading branch information
guj authored Mar 2, 2023
2 parents 007a94a + 41a03f8 commit df38d8a
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 36 deletions.
4 changes: 3 additions & 1 deletion source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
69 changes: 41 additions & 28 deletions source/h5vol/H5Vol_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}

Expand Down
17 changes: 10 additions & 7 deletions source/h5vol/H5Vol_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit df38d8a

Please sign in to comment.