Skip to content

Commit 7dd3067

Browse files
author
Martin D. Weinberg
committed
Merge branch 'InitFromHDF5' of github.com:EXP-code/EXP into InitFromHDF5
2 parents b8e2546 + f18ed1f commit 7dd3067

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/Component.H

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,10 @@ struct loadb_datum
216216
217217
<li> The datatype for the <code>m</code>, <code>x</code>,
218218
<code>y</code>, <code>z</code>, <code>u</code>, <code>v</code>,
219-
<code>w</code> and <code>aux_float_*</code> datasets maybe float or
220-
double (i.e. float32 or float64) but they all must are assumed to
221-
have the same datatype as <code>m</code>.
219+
<code>w</code> and <code>aux_float_*</code> datasets may be float or
220+
double (i.e. float32 or float64). Each dataset's precision is
221+
detected independently, so datasets may have mixed precision within
222+
the same file.
222223
223224
</ol>
224225
*/

src/Component.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,16 +1699,21 @@ void Component::read_bodies_and_distribute_hdf5(void)
16991699
// Offset into the next node's data in the HDF5 datasets
17001700
offset += nbodies_table[0];
17011701

1702-
unsigned icount, ibufcount;
17031702
for (int n=1; n<numprocs; n++) {
17041703

1704+
// Some ranks may legitimately receive 0 particles (e.g., more ranks than particles).
1705+
// In that case, ship an empty batch and skip all dataset reads.
1706+
if (nbodies_table[n] == 0) {
1707+
pf->ShipParticles(n, 0, 0);
1708+
continue;
1709+
}
1710+
17051711
// Read core PSP fields
17061712
if (has_index) {
17071713
index = particles_group.getDataSet("index")
17081714
.select({offset}, {nbodies_table[n]}).read<std::vector<unsigned long>>();
17091715
}
17101716
m = read_dataset("m", offset, nbodies_table[n]);
1711-
17121717
x = read_dataset("x", offset, nbodies_table[n]);
17131718
y = read_dataset("y", offset, nbodies_table[n]);
17141719
z = read_dataset("z", offset, nbodies_table[n]);

utils/PhaseSpace/hdf5bods.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,11 @@ createFilterProps(const std::vector<hsize_t>& chunk_dims,
116116
HighFive::DataSetCreateProps props;
117117
props.add(HighFive::Chunking(chunk_dims));
118118

119+
// For most compressors, applying shuffle improves compression for floating-point data.
120+
// (Blosc can do its own shuffling internally; shuffle-only/checksum-only are handled below.)
119121
if (filter_id != 3 && filter_id != 4 && filter_id != 32001) {
122+
props.add(HighFive::Shuffle());
120123
}
121-
122124
hid_t plist_id = props.getId();
123125
std::vector<unsigned int> cd_values;
124126

0 commit comments

Comments
 (0)