Hello,
I have a strange error where HDF5 files written with NetCDF4 and HDF5-1.8.4 on a big endian machine (Power6) could not be read on little endian and vice versa. This isn't a NetCDF issue since pure HDF5 files written with the attached program show the same behaviour. It turned out that the "Fractal Heap ID for Managed Objects" in the "Version 2 B-tree, Type 8 Record Layout" isn't correctly written on big endian. The ID is constructed from version, offset, and length with the macro
#define H5HF_MAN_ID_ENCODE(i, h, o, l) \
*(i) = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_MAN; \
(i)++; \
UINT64ENCODE_VAR((i), (o), (h)->heap_off_size); \
UINT64ENCODE_VAR((i), (l), (h)->heap_len_size)
so offset and length are already encoded. Prior to actually writing the ID, it is encoded again, though:
In H5A_dense_btree2_name_encode():
UINT64ENCODE(raw, nrecord->id);
And this breaks on big endian. Just copying nrecord->id to raw works for me but I don't know if this covers all use cases of H5A_dense_btree2_name_encode().
Cheers,
Mathis
endian_error.c (1.17 KB)
···
--
Mathis Rosenhauer
Application support
German Climate Computing Center