From ae75140eaf5bb0fb6f8db433add40729501274cc Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Mon, 7 Mar 2016 19:01:04 +0000 Subject: [PATCH] Make sure the HDF5 dataset chunks are smaller than the dataset itself. --- src/serial_io.c | 3 +++ src/single_io.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/serial_io.c b/src/serial_io.c index 1bf43a3432..b189df53c0 100644 --- a/src/serial_io.c +++ b/src/serial_io.c @@ -201,6 +201,9 @@ void prepareArray(hid_t grp, char* fileName, FILE* xmfFile, char* name, chunk_shape[1] = 0; } + /* Make sure the chunks are not larger than the dataset */ + if (chunk_shape[0] > N) chunk_shape[0] = N; + /* Change shape of data space */ h_err = H5Sset_extent_simple(h_space, rank, shape, NULL); if (h_err < 0) { diff --git a/src/single_io.c b/src/single_io.c index 6547b417c8..f3225ecf48 100644 --- a/src/single_io.c +++ b/src/single_io.c @@ -199,6 +199,9 @@ void writeArrayBackEnd(hid_t grp, char* fileName, FILE* xmfFile, char* name, chunk_shape[1] = 0; } + /* Make sure the chunks are not larger than the dataset */ + if (chunk_shape[0] > N) chunk_shape[0] = N; + /* Change shape of data space */ h_err = H5Sset_extent_simple(h_space, rank, shape, NULL); if (h_err < 0) { -- GitLab