From ea56d06555d647284c29b70cd69db971b18b7f8c Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Mon, 10 Sep 2018 18:26:08 +0200
Subject: [PATCH] Correctly move the reading pointers for the various chunks in
 the parallel HDF5 i/o module. Increase the hdf5 chunk size to 1MB

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

diff --git a/src/parallel_io.c b/src/parallel_io.c
index 449756293a..00aeb5c321 100644
--- a/src/parallel_io.c
+++ b/src/parallel_io.c
@@ -303,6 +303,8 @@ void readArray(hid_t grp, struct io_props props, size_t N, long long N_total,
       N -= max_chunk_size;
       props.field += max_chunk_size * props.partSize; /* char* on the field */
       props.parts += max_chunk_size;                  /* part* on the part */
+      props.xparts += max_chunk_size;                 /* xpart* on the xpart */
+      props.gparts += max_chunk_size;                 /* gpart* on the gpart */
       offset += max_chunk_size;
       redo = 1;
     } else {
@@ -352,13 +354,13 @@ void prepareArray(struct engine* e, hid_t grp, char* fileName, FILE* xmfFile,
     rank = 2;
     shape[0] = N_total;
     shape[1] = props.dimension;
-    chunk_shape[0] = 1 << 16; /* Just a guess...*/
+    chunk_shape[0] = 1 << 20; /* Just a guess...*/
     chunk_shape[1] = props.dimension;
   } else {
     rank = 1;
     shape[0] = N_total;
     shape[1] = 0;
-    chunk_shape[0] = 1 << 16; /* Just a guess...*/
+    chunk_shape[0] = 1 << 20; /* Just a guess...*/
     chunk_shape[1] = 0;
   }
 
@@ -575,6 +577,8 @@ void writeArray(struct engine* e, hid_t grp, char* fileName,
       N -= max_chunk_size;
       props.field += max_chunk_size * props.partSize; /* char* on the field */
       props.parts += max_chunk_size;                  /* part* on the part */
+      props.xparts += max_chunk_size;                 /* xpart* on the xpart */
+      props.gparts += max_chunk_size;                 /* gpart* on the gpart */
       offset += max_chunk_size;
       redo = 1;
     } else {
-- 
GitLab