Skip to content

Commit

Permalink
combine v1 dataset read/write functions
Browse files Browse the repository at this point in the history
  • Loading branch information
brtnfld committed Jun 12, 2024
1 parent 27000bf commit 4ce5aa0
Showing 1 changed file with 82 additions and 17 deletions.
99 changes: 82 additions & 17 deletions src/H5VL_log_dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,36 +387,101 @@ herr_t H5VL_log_dataset_read (size_t count,
void *buf[],
void **req) {
herr_t err = 0;
H5VL_log_dset_t *dp = (H5VL_log_dset_t *)dset;
H5VL_log_dset_info_t *dip = NULL; // Dataset info
hid_t dsid; // Dataset space id
H5VL_log_selections *dsel = NULL; // Selection blocks
size_t i;

for (i = 0; i < count; i++) {
err = H5VL_log_dataset_read_1 (dset[i], mem_type_id[i], mem_space_id[i], file_space_id[i],
plist_id, buf[i], NULL);
CHECK_ERR
err = 0;
H5VL_log_dset_t *dp = (H5VL_log_dset_t *)dset;

H5VL_log_dset_info_t *dip = NULL; // Dataset info
hid_t dsid; // Dataset space id
H5VL_log_selections *dsel = NULL; // Selection blocks

try {
if (!dp->fp->is_log_based_file) {
err = H5VL_log_under_dataset_read (dp->uo, dp->uvlid, mem_type_id[i], mem_space_id[i], file_space_id[i],
plist_id, buf[i], NULL);
CHECK_ERR
} else {
dip = dp->fp->dsets_info[dp->id];
H5VL_LOGI_PROFILING_TIMER_START;
if (file_space_id[i] == H5S_ALL) {
dsid = H5Screate_simple(dip->ndim, dip->dims, dip->mdims);
CHECK_ID(dsid);
} else {
dsid = file_space_id[i];
}
dsel = new H5VL_log_selections(dsid);
H5VL_LOGI_PROFILING_TIMER_STOP(dp->fp, TIMER_H5VL_LOGI_GET_DATASPACE_SELECTION);

// H5S_All means using file space
if (mem_space_id[i] == H5S_ALL) mem_space_id[i] = dsid;

H5VL_log_dataseti_read(dp, mem_type_id[i], mem_space_id[i], dsel, plist_id, buf[i], req);
CHECK_ERR
}
}
H5VL_LOGI_EXP_CATCH_ERR

err_out:;
// Note: dsel should be freed when the read request is deleted
if (dsid != file_space_id[i]) { H5Sclose(dsid); }
CHECK_ERR
}

return err;
}

herr_t H5VL_log_dataset_write (size_t count,
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) {
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 err = 0;
size_t i;

for (i = 0; i < count; i++) {
err = H5VL_log_dataset_write_1 (dset[i], mem_type_id[i], mem_space_id[i], file_space_id[i],
plist_id, buf[i], NULL);
CHECK_ERR
err = 0;
H5VL_log_dset_t *dp = (H5VL_log_dset_t *)dset[i];

H5VL_log_dset_info_t *dip = NULL; // Dataset info
hid_t dsid; // Dataset space id
H5VL_log_selections *dsel = NULL; // Selection blocks

try {
if (!dp->fp->is_log_based_file) {
err = H5VL_log_under_dataset_write(dp->uo, dp->uvlid, mem_type_id[i], mem_space_id[i], file_space_id[i],
plist_id, buf[i], NULL);
CHECK_ERR
} else {
dip = dp->fp->dsets_info[dp->id];
H5VL_LOGI_PROFILING_TIMER_START;
if (file_space_id[i] == H5S_ALL) {
dsid = H5Screate_simple(dip->ndim, dip->dims, dip->mdims);
CHECK_ID(dsid);
} else {
dsid = file_space_id[i];
}
dsel = new H5VL_log_selections(dsid);
H5VL_LOGI_PROFILING_TIMER_STOP(dp->fp, TIMER_H5VL_LOGI_GET_DATASPACE_SELECTION);
CHECK_PTR(dsel)

// H5S_All means using file space
if (mem_space_id[i] == H5S_ALL) mem_space_id[i] = dsid;

H5VL_log_dataseti_write(dp, mem_type_id[i], mem_space_id[i], dsel, plist_id, buf[i], req);
CHECK_ERR
}
}
H5VL_LOGI_EXP_CATCH_ERR

err_out:;
if (dsel) { delete dsel; }
if (dsid != file_space_id[i]) { H5Sclose(dsid); }
CHECK_ERR
}

return err;
Expand Down

0 comments on commit 4ce5aa0

Please sign in to comment.