Skip to content
Snippets Groups Projects
Commit 3cdc0bee authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Correct use of caches in the self-PP gravity task. Make sure we can run...

Correct use of caches in the self-PP gravity task. Make sure we can run without vectorization. Make sure we can run without hydro.
parent 266b6e42
Branches
Tags
No related merge requests found
...@@ -154,7 +154,7 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) { ...@@ -154,7 +154,7 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) {
struct scheduler *s = &e->sched; struct scheduler *s = &e->sched;
const int periodic = e->s->periodic; const int periodic = e->s->periodic;
const int is_hydro = (e->policy & engine_policy_hydro); const int is_with_hydro = (e->policy & engine_policy_hydro);
const int is_self_gravity = (e->policy & engine_policy_self_gravity); const int is_self_gravity = (e->policy & engine_policy_self_gravity);
const int is_with_cooling = (e->policy & engine_policy_cooling); const int is_with_cooling = (e->policy & engine_policy_cooling);
const int is_with_sourceterms = (e->policy & engine_policy_sourceterms); const int is_with_sourceterms = (e->policy & engine_policy_sourceterms);
...@@ -163,15 +163,19 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) { ...@@ -163,15 +163,19 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) {
if (c->super == c) { if (c->super == c) {
/* Add the sort task. */ /* Add the sort task. */
c->sorts = if (is_with_hydro) {
scheduler_addtask(s, task_type_sort, task_subtype_none, 0, 0, c, NULL); c->sorts =
scheduler_addtask(s, task_type_sort, task_subtype_none, 0, 0, c, NULL);
}
/* Local tasks only... */ /* Local tasks only... */
if (c->nodeID == e->nodeID) { if (c->nodeID == e->nodeID) {
/* Add the drift task. */ /* Add the drift task. */
c->drift_part = scheduler_addtask(s, task_type_drift_part, if (is_with_hydro) {
task_subtype_none, 0, 0, c, NULL); c->drift_part = scheduler_addtask(s, task_type_drift_part,
task_subtype_none, 0, 0, c, NULL);
}
/* Add the two half kicks */ /* Add the two half kicks */
c->kick1 = scheduler_addtask(s, task_type_kick1, task_subtype_none, 0, 0, c->kick1 = scheduler_addtask(s, task_type_kick1, task_subtype_none, 0, 0,
...@@ -208,7 +212,7 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) { ...@@ -208,7 +212,7 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) {
} }
/* Generate the ghost tasks. */ /* Generate the ghost tasks. */
if (is_hydro) { if (is_with_hydro) {
c->ghost_in = c->ghost_in =
scheduler_addtask(s, task_type_ghost, task_subtype_none, 0, scheduler_addtask(s, task_type_ghost, task_subtype_none, 0,
/* implicit = */ 1, c, NULL); /* implicit = */ 1, c, NULL);
...@@ -4548,16 +4552,16 @@ void engine_init(struct engine *e, struct space *s, ...@@ -4548,16 +4552,16 @@ void engine_init(struct engine *e, struct space *s,
e->runners[k].qid = k * nr_queues / e->nr_threads; e->runners[k].qid = k * nr_queues / e->nr_threads;
} }
#ifdef WITH_VECTORIZATION
/* Allocate particle caches. */ /* Allocate particle caches. */
e->runners[k].ci_cache.count = 0;
e->runners[k].cj_cache.count = 0;
cache_init(&e->runners[k].ci_cache, CACHE_SIZE);
cache_init(&e->runners[k].cj_cache, CACHE_SIZE);
e->runners[k].ci_gravity_cache.count = 0; e->runners[k].ci_gravity_cache.count = 0;
e->runners[k].cj_gravity_cache.count = 0; e->runners[k].cj_gravity_cache.count = 0;
gravity_cache_init(&e->runners[k].ci_gravity_cache, space_splitsize); gravity_cache_init(&e->runners[k].ci_gravity_cache, space_splitsize);
gravity_cache_init(&e->runners[k].cj_gravity_cache, space_splitsize); gravity_cache_init(&e->runners[k].cj_gravity_cache, space_splitsize);
#ifdef WITH_VECTORIZATION
e->runners[k].ci_cache.count = 0;
e->runners[k].cj_cache.count = 0;
cache_init(&e->runners[k].ci_cache, CACHE_SIZE);
cache_init(&e->runners[k].cj_cache, CACHE_SIZE);
#endif #endif
if (verbose) { if (verbose) {
......
...@@ -936,7 +936,7 @@ void runner_doself_grav_pp_full(struct runner *r, struct cell *c) { ...@@ -936,7 +936,7 @@ void runner_doself_grav_pp_full(struct runner *r, struct cell *c) {
/* Check that we fit in cache */ /* Check that we fit in cache */
if (gcount > ci_cache->count) if (gcount > ci_cache->count)
error("Not enough space in the caches! gcount_i=%d", gcount); error("Not enough space in the cache! gcount=%d", gcount);
/* Computed the padded counts */ /* Computed the padded counts */
const int gcount_padded = gcount - (gcount % VEC_SIZE) + VEC_SIZE; const int gcount_padded = gcount - (gcount % VEC_SIZE) + VEC_SIZE;
...@@ -1032,9 +1032,9 @@ void runner_doself_grav_pp_full(struct runner *r, struct cell *c) { ...@@ -1032,9 +1032,9 @@ void runner_doself_grav_pp_full(struct runner *r, struct cell *c) {
} }
/* Store everything back in cache */ /* Store everything back in cache */
ci_cache->a_x[pid] += a_x; ci_cache->a_x[pid] = a_x;
ci_cache->a_y[pid] += a_y; ci_cache->a_y[pid] = a_y;
ci_cache->a_z[pid] += a_z; ci_cache->a_z[pid] = a_z;
} }
/* Write back to the particles */ /* Write back to the particles */
...@@ -1150,7 +1150,7 @@ void runner_doself_grav_pp_truncated(struct runner *r, struct cell *c) { ...@@ -1150,7 +1150,7 @@ void runner_doself_grav_pp_truncated(struct runner *r, struct cell *c) {
/* Check that we fit in cache */ /* Check that we fit in cache */
if (gcount > ci_cache->count) if (gcount > ci_cache->count)
error("Not enough space in the caches! gcount_i=%d", gcount); error("Not enough space in the caches! gcount=%d", gcount);
/* Computed the padded counts */ /* Computed the padded counts */
const int gcount_padded = gcount - (gcount % VEC_SIZE) + VEC_SIZE; const int gcount_padded = gcount - (gcount % VEC_SIZE) + VEC_SIZE;
...@@ -1251,9 +1251,9 @@ void runner_doself_grav_pp_truncated(struct runner *r, struct cell *c) { ...@@ -1251,9 +1251,9 @@ void runner_doself_grav_pp_truncated(struct runner *r, struct cell *c) {
} }
/* Store everything back in cache */ /* Store everything back in cache */
ci_cache->a_x[pid] += a_x; ci_cache->a_x[pid] = a_x;
ci_cache->a_y[pid] += a_y; ci_cache->a_y[pid] = a_y;
ci_cache->a_z[pid] += a_z; ci_cache->a_z[pid] = a_z;
} }
/* Write back to the particles */ /* Write back to the particles */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment