From a6aef317f14eaf320c7bbca10c7fd5bc0ce734da Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Fri, 5 Jan 2018 14:05:40 +0000
Subject: [PATCH] Align the runner structures on a memory bound.

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

diff --git a/src/engine.c b/src/engine.c
index ee41d03cef..42532fc67e 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -5450,8 +5450,8 @@ void engine_init(struct engine *e, struct space *s,
       parser_get_opt_param_int(params, "Scheduler:mpi_message_limit", 4) * 1024;
 
   /* Allocate and init the threads. */
-  if ((e->runners = (struct runner *)malloc(sizeof(struct runner) *
-                                            e->nr_threads)) == NULL)
+  if (posix_memalign((void *)&e->runners, SWIFT_STRUCT_ALIGNMENT,
+                     e->nr_threads * sizeof(struct runner)) != 0)
     error("Failed to allocate threads array.");
   for (int k = 0; k < e->nr_threads; k++) {
     e->runners[k].id = k;
-- 
GitLab