From 034b04416cde11dd8908cfc1c8e65097ce0e66dd Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Fri, 14 Oct 2016 14:46:38 +0100
Subject: [PATCH] Remove the individual task counters.

---
 src/cell.c   |  7 -------
 src/cell.h   |  1 -
 src/engine.c | 34 ----------------------------------
 src/space.c  |  4 ----
 4 files changed, 46 deletions(-)

diff --git a/src/cell.c b/src/cell.c
index 640a87cc64..f6ac46083b 100644
--- a/src/cell.c
+++ b/src/cell.c
@@ -756,16 +756,9 @@ void cell_convert_hydro(struct cell *c, void *data) {
  */
 void cell_clean_links(struct cell *c, void *data) {
   c->density = NULL;
-  c->nr_density = 0;
-
   c->gradient = NULL;
-  c->nr_gradient = 0;
-
   c->force = NULL;
-  c->nr_force = 0;
-
   c->grav = NULL;
-  c->nr_grav = 0;
 }
 
 /**
diff --git a/src/cell.h b/src/cell.h
index 104b743128..b84243d457 100644
--- a/src/cell.h
+++ b/src/cell.h
@@ -139,7 +139,6 @@ struct cell {
 
   /* The tasks computing this cell's density. */
   struct link *density, *gradient, *force, *grav;
-  int nr_density, nr_gradient, nr_force, nr_grav;
 
   /* The hierarchical tasks. */
   struct task *extra_ghost, *ghost, *init, *kick;
diff --git a/src/engine.c b/src/engine.c
index d61dcd0b97..67e4feeeee 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -1361,15 +1361,12 @@ void engine_count_and_link_tasks(struct engine *e) {
       atomic_inc(&ci->nr_tasks);
       if (t->subtype == task_subtype_density) {
         engine_addlink(e, &ci->density, t);
-        atomic_inc(&ci->nr_density);
       }
       if (t->subtype == task_subtype_grav) {
         engine_addlink(e, &ci->grav, t);
-        atomic_inc(&ci->nr_grav);
       }
       if (t->subtype == task_subtype_external_grav) {
         engine_addlink(e, &ci->grav, t);
-        atomic_inc(&ci->nr_grav);
       }
 
       /* Link pair tasks to cells. */
@@ -1378,15 +1375,11 @@ void engine_count_and_link_tasks(struct engine *e) {
       atomic_inc(&cj->nr_tasks);
       if (t->subtype == task_subtype_density) {
         engine_addlink(e, &ci->density, t);
-        atomic_inc(&ci->nr_density);
         engine_addlink(e, &cj->density, t);
-        atomic_inc(&cj->nr_density);
       }
       if (t->subtype == task_subtype_grav) {
         engine_addlink(e, &ci->grav, t);
-        atomic_inc(&ci->nr_grav);
         engine_addlink(e, &cj->grav, t);
-        atomic_inc(&cj->nr_grav);
       }
 
       /* Link sub-self tasks to cells. */
@@ -1394,15 +1387,12 @@ void engine_count_and_link_tasks(struct engine *e) {
       atomic_inc(&ci->nr_tasks);
       if (t->subtype == task_subtype_density) {
         engine_addlink(e, &ci->density, t);
-        atomic_inc(&ci->nr_density);
       }
       if (t->subtype == task_subtype_grav) {
         engine_addlink(e, &ci->grav, t);
-        atomic_inc(&ci->nr_grav);
       }
       if (t->subtype == task_subtype_external_grav) {
         engine_addlink(e, &ci->grav, t);
-        atomic_inc(&ci->nr_grav);
       }
 
       /* Link sub-pair tasks to cells. */
@@ -1411,22 +1401,16 @@ void engine_count_and_link_tasks(struct engine *e) {
       atomic_inc(&cj->nr_tasks);
       if (t->subtype == task_subtype_density) {
         engine_addlink(e, &ci->density, t);
-        atomic_inc(&ci->nr_density);
         engine_addlink(e, &cj->density, t);
-        atomic_inc(&cj->nr_density);
       }
       if (t->subtype == task_subtype_grav) {
         engine_addlink(e, &ci->grav, t);
-        atomic_inc(&ci->nr_grav);
         engine_addlink(e, &cj->grav, t);
-        atomic_inc(&cj->nr_grav);
       }
       if (t->subtype == task_subtype_external_grav) {
         error("Found a sub-pair/external-gravity task...");
         engine_addlink(e, &ci->grav, t);
-        atomic_inc(&ci->nr_grav);
         engine_addlink(e, &cj->grav, t);
-        atomic_inc(&cj->nr_grav);
       }
     }
   }
@@ -1658,9 +1642,7 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
 
       /* Add the link between the new loops and the cell */
       engine_addlink(e, &t->ci->gradient, t2);
-      atomic_inc(&t->ci->nr_gradient);
       engine_addlink(e, &t->ci->force, t3);
-      atomic_inc(&t->ci->nr_force);
 
       /* Now, build all the dependencies for the hydro */
       engine_make_hydro_loops_dependencies(sched, t, t2, t3, t->ci);
@@ -1673,7 +1655,6 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
 
       /* Add the link between the new loop and the cell */
       engine_addlink(e, &t->ci->force, t2);
-      atomic_inc(&t->ci->nr_force);
 
       /* Now, build all the dependencies for the hydro */
       engine_make_hydro_loops_dependencies(sched, t, t2, t->ci);
@@ -1692,13 +1673,9 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
 
       /* Add the link between the new loop and both cells */
       engine_addlink(e, &t->ci->gradient, t2);
-      atomic_inc(&t->ci->nr_gradient);
       engine_addlink(e, &t->cj->gradient, t2);
-      atomic_inc(&t->cj->nr_gradient);
       engine_addlink(e, &t->ci->force, t3);
-      atomic_inc(&t->ci->nr_force);
       engine_addlink(e, &t->cj->force, t3);
-      atomic_inc(&t->cj->nr_force);
 
       /* Now, build all the dependencies for the hydro for the cells */
       /* that are local and are not descendant of the same super-cells */
@@ -1717,9 +1694,7 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
 
       /* Add the link between the new loop and both cells */
       engine_addlink(e, &t->ci->force, t2);
-      atomic_inc(&t->ci->nr_force);
       engine_addlink(e, &t->cj->force, t2);
-      atomic_inc(&t->cj->nr_force);
 
       /* Now, build all the dependencies for the hydro for the cells */
       /* that are local and are not descendant of the same super-cells */
@@ -1750,9 +1725,7 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
 
       /* Add the link between the new loop and the cell */
       engine_addlink(e, &t->ci->gradient, t2);
-      atomic_inc(&t->ci->nr_gradient);
       engine_addlink(e, &t->ci->force, t3);
-      atomic_inc(&t->ci->nr_force);
 
       /* Now, build all the dependencies for the hydro for the cells */
       /* that are local and are not descendant of the same super-cells */
@@ -1768,7 +1741,6 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
 
       /* Add the link between the new loop and the cell */
       engine_addlink(e, &t->ci->force, t2);
-      atomic_inc(&t->ci->nr_force);
 
       /* Now, build all the dependencies for the hydro for the cells */
       /* that are local and are not descendant of the same super-cells */
@@ -1794,13 +1766,9 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
 
       /* Add the link between the new loop and both cells */
       engine_addlink(e, &t->ci->gradient, t2);
-      atomic_inc(&t->ci->nr_gradient);
       engine_addlink(e, &t->cj->gradient, t2);
-      atomic_inc(&t->cj->nr_gradient);
       engine_addlink(e, &t->ci->force, t3);
-      atomic_inc(&t->ci->nr_force);
       engine_addlink(e, &t->cj->force, t3);
-      atomic_inc(&t->cj->nr_force);
 
       /* Now, build all the dependencies for the hydro for the cells */
       /* that are local and are not descendant of the same super-cells */
@@ -1819,9 +1787,7 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) {
 
       /* Add the link between the new loop and both cells */
       engine_addlink(e, &t->ci->force, t2);
-      atomic_inc(&t->ci->nr_force);
       engine_addlink(e, &t->cj->force, t2);
-      atomic_inc(&t->cj->nr_force);
 
       /* Now, build all the dependencies for the hydro for the cells */
       /* that are local and are not descendant of the same super-cells */
diff --git a/src/space.c b/src/space.c
index b7cf7b0b55..0701c4a797 100644
--- a/src/space.c
+++ b/src/space.c
@@ -392,10 +392,6 @@ void space_regrid(struct space *s, double cell_max, int verbose) {
       space_rebuild_recycle(s, &s->cells_top[k]);
       s->cells_top[k].sorts = NULL;
       s->cells_top[k].nr_tasks = 0;
-      s->cells_top[k].nr_density = 0;
-      s->cells_top[k].nr_gradient = 0;
-      s->cells_top[k].nr_force = 0;
-      s->cells_top[k].nr_grav = 0;
       s->cells_top[k].density = NULL;
       s->cells_top[k].gradient = NULL;
       s->cells_top[k].force = NULL;
-- 
GitLab