Skip to content

Commit

Permalink
Also create key.seq and key.cnt for zero-size groups
Browse files Browse the repository at this point in the history
Also fix fill mode setting
  • Loading branch information
wkliao committed Jan 31, 2020
1 parent 5d395ab commit ed501ff
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
9 changes: 6 additions & 3 deletions file_partition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ int Concatenator::write_partition_key_datasets()
herr_t err;
hsize_t ii, jj, kk, start[2]={0,0}, count[2]={1,1};
hsize_t *seq_offs, *seq_lens, *cnt_offs, *cnt_lens, *extents;
#if defined PROFILE && PROFILE
double ts;
#endif

/* some groups may not contain key-base datasets */
cnt_lens = new hsize_t[num_groups_have_key * 5];
Expand Down Expand Up @@ -160,6 +157,9 @@ int Concatenator::write_partition_key_datasets()
* consecutive elements sharing the same key.
*/
if (set_extent) {
#if defined PROFILE && PROFILE
double ts;
#endif
SET_TIMER(ts)
count[0] = extents[kk];
err = H5Dset_extent(cnt_dset->out_dset_id, count);
Expand All @@ -186,6 +186,9 @@ int Concatenator::write_partition_key_datasets()
* Below, we use a separate loop to call H5Dset_extent() altogether
* after all calls to H5Dwrite() are complete.
*/
#if defined PROFILE && PROFILE
double ts;
#endif
SET_TIMER(ts)
kk = 0;
for (ii=0; ii<num_groups; ii++) {
Expand Down
30 changes: 20 additions & 10 deletions ph5_concat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,14 @@ int Concatenator::create_partition_keys(GrpInfo &grp)
seq.is_key_seq = true;
seq.is_key_cnt = false;
seq.name = part_key_base + ".key.seq";
#ifndef DELAY_KEY_DSET_CREATION
/* delay creation until writing it in write_partition_key_datasets() */
herr_t err = create_dataset(grp.id, seq, true);
if (err < 0) RETURN_ERROR("create_dataset", "key.seq")
#ifdef DELAY_KEY_DSET_CREATION
if (seq.global_dims[0] == 0)
#endif
{
/* delay creation until writing it in write_partition_key_datasets() */
herr_t err = create_dataset(grp.id, seq, false);
if (err < 0) RETURN_ERROR("create_dataset", "key.seq")
}
grp.seq_dset = &seq;
total_num_datasets++;

Expand All @@ -310,11 +313,14 @@ int Concatenator::create_partition_keys(GrpInfo &grp)
cnt.is_key_cnt = true;
cnt.is_key_seq = false;
cnt.name = part_key_base + ".key.cnt";
#ifndef DELAY_KEY_DSET_CREATION
/* delay creation until writing it in write_partition_key_datasets() */
err = create_dataset(grp.id, cnt, true);
if (err < 0) RETURN_ERROR("create_dataset", "key.cnt")
#ifdef DELAY_KEY_DSET_CREATION
if (cnt.global_dims[0] == 0)
#endif
{
/* delay creation until writing it in write_partition_key_datasets() */
herr_t err = create_dataset(grp.id, cnt, !set_extent);
if (err < 0) RETURN_ERROR("create_dataset", "key.cnt")
}
grp.cnt_dset = &cnt;
total_num_datasets++;

Expand Down Expand Up @@ -950,8 +956,12 @@ int Concatenator::create_dataset(hid_t group_id,
if (err < 0) HANDLE_ERROR("H5Pset_deflate")
}

/* HDF5 default fill value is 0 */
if (!toFill) {
if (toFill) {
/* HDF5 default fill value is 0, skip call H5Pset_fill_value() */
err = H5Pset_fill_time(dcpl_id, H5D_FILL_TIME_ALLOC);
if (err < 0) HANDLE_ERROR("H5Pset_fill_time")
}
else {
/* Never fill in the chunk in advance. */
err = H5Pset_fill_time(dcpl_id, H5D_FILL_TIME_NEVER);
if (err < 0) HANDLE_ERROR("H5Pset_fill_time")
Expand Down

0 comments on commit ed501ff

Please sign in to comment.