From 405d0fba63408bb7e12d2cd10097a04cd0896da7 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Sun, 21 Jan 2018 14:08:34 +0000
Subject: [PATCH] For parallel-hdf5 correctly compute the offsets of the next
 chunk when the i/o is larger than 2GB.

---
 src/parallel_io.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/parallel_io.c b/src/parallel_io.c
index a960b72708..603dd8a944 100644
--- a/src/parallel_io.c
+++ b/src/parallel_io.c
@@ -212,7 +212,8 @@ void readArray(hid_t grp, struct io_props props, size_t N, long long N_total,
     /* Compute how many items are left */
     if (N > max_chunk_size) {
       N -= max_chunk_size;
-      props.field += max_chunk_size * props.partSize;
+      props.field += max_chunk_size * props.partSize; /* char* on the field */
+      props.parts += max_chunk_size;                  /* part* on the part */
       offset += max_chunk_size;
       redo = 1;
     } else {
@@ -463,7 +464,8 @@ void writeArray(struct engine* e, hid_t grp, char* fileName, FILE* xmfFile,
     /* Compute how many items are left */
     if (N > max_chunk_size) {
       N -= max_chunk_size;
-      props.field += max_chunk_size * props.partSize;
+      props.field += max_chunk_size * props.partSize; /* char* on the field */
+      props.parts += max_chunk_size;                  /* part* on the part */
       offset += max_chunk_size;
       redo = 1;
     } else {
-- 
GitLab