From c7065bef2853ef6203e78a7da7079634326b5c5a Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Wed, 4 Mar 2015 17:20:45 +0000
Subject: [PATCH] Merged symmetric cell-monopole calls into one single task.

---
 examples/test_fmm.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/examples/test_fmm.c b/examples/test_fmm.c
index 1e65935..5aa7e19 100644
--- a/examples/test_fmm.c
+++ b/examples/test_fmm.c
@@ -635,6 +635,7 @@ static inline int are_neighbours(struct cell *ci, struct cell *cj) {
 static inline void iact_pair_pc(struct cell *ci, struct cell *cj) {
 
   make_interact_pc(ci->parts, ci->count, ci->loc, cj);
+  make_interact_pc(cj->parts, cj->count, cj->loc, ci);
 
 }
 
@@ -773,7 +774,6 @@ void iact_pair(struct cell *ci, struct cell *cj) {
 	}
 	else { /* Otherwise do cell-mulitpole interactions */
 	  iact_pair_pc(cp, cps);
-	  iact_pair_pc(cps, cp);
 	}
       }
     }
@@ -945,26 +945,28 @@ void create_tasks(struct qsched *s, struct cell *ci, struct cell *cj) {
       data[0] = ci;
       data[1] = cj;
       tid = qsched_addtask(s, task_type_pair_pc, task_flag_none, data,
-			   sizeof(struct cell *) * 2, ci->count);
+			   sizeof(struct cell *) * 2, ci->count + cj->count);
 
       /* Add the resource and dependance */
       qsched_addlock(s, tid, ci->res);
+      qsched_addlock(s, tid, cj->res);
 #ifdef COM_AS_TASK
       qsched_addunlock(s, cj->com_tid, tid);
+      qsched_addunlock(s, ci->com_tid, tid);
 #endif
 
 
-      /* Create the other task. */
-      data[1] = ci;
-      data[0] = cj;
-      tid = qsched_addtask(s, task_type_pair_pc, task_flag_none, data,
-			   sizeof(struct cell *) * 2, cj->count);
+/*       /\* Create the other task. *\/ */
+/*       data[1] = ci; */
+/*       data[0] = cj; */
+/*       tid = qsched_addtask(s, task_type_pair_pc, task_flag_none, data, */
+/* 			   sizeof(struct cell *) * 2, cj->count); */
 
-      /* Add the resource and dependance */
-      qsched_addlock(s, tid, cj->res);
-#ifdef COM_AS_TASK
-      qsched_addunlock(s, ci->com_tid, tid);
-#endif
+/*       /\* Add the resource and dependance *\/ */
+/*       qsched_addlock(s, tid, cj->res); */
+/* #ifdef COM_AS_TASK */
+/*       qsched_addunlock(s, ci->com_tid, tid); */
+/* #endif */
 
     } else {/* Cells are direct neighbours */
 
-- 
GitLab