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

Added checks to make sure the foreign cells are part of an existing proxy when building pair tasks.

parent 4b8025dc
No related branches found
No related tags found
1 merge request!673Reduce the number of proxies constructed in the case with gravity
......@@ -877,6 +877,48 @@ void engine_make_self_gravity_tasks_mapper(void *map_data, int num_elements,
scheduler_addtask(sched, task_type_pair, task_subtype_grav, 0, 0,
ci, cj);
#ifdef WITH_MPI
/* Let's cross-check that we had a proxy for that cell */
if (ci->nodeID == nodeID && cj->nodeID != engine_rank) {
/* Find the proxy for this node */
const int proxy_id = e->proxy_ind[cj->nodeID];
if (proxy_id < 0)
error("No proxy exists for that foreign node %d!", cj->nodeID);
const struct proxy *p = &e->proxies[proxy_id];
/* Check whether the cell exists in the proxy */
int n = 0;
for (n = 0; n < p->nr_cells_in; n++)
if(p->cells_in[n] == cj)
break;
if(n == p->nr_cells_in)
error("Cell %d not found in the proxy but trying to construct grav task!",
cjd);
}
else if(cj->nodeID == nodeID && ci->nodeID != engine_rank) {
/* Find the proxy for this node */
const int proxy_id = e->proxy_ind[ci->nodeID];
if (proxy_id < 0)
error("No proxy exists for that foreign node %d!", ci->nodeID);
const struct proxy *p = &e->proxies[proxy_id];
/* Check whether the cell exists in the proxy */
int n = 0;
for (n = 0; n < p->nr_cells_in; n++)
if(p->cells_in[n] == ci)
break;
if(n == p->nr_cells_in)
error("Cell %d not found in the proxy but trying to construct grav task!",
cid);
}
#endif
if(ci->nodeID == nodeID && cj->nodeID != engine_rank)
atomic_inc(&ci->num_foreign_pair_grav);
if(cj->nodeID == nodeID && ci->nodeID != engine_rank)
......@@ -1796,6 +1838,47 @@ void engine_make_hydroloop_tasks_mapper(void *map_data, int num_elements,
const int sid = sortlistID[(kk + 1) + 3 * ((jj + 1) + 3 * (ii + 1))];
scheduler_addtask(sched, task_type_pair, task_subtype_density, sid, 0,
ci, cj);
#ifdef WITH_MPI
/* Let's cross-check that we had a proxy for that cell */
if (ci->nodeID == nodeID && cj->nodeID != engine_rank) {
/* Find the proxy for this node */
const int proxy_id = e->proxy_ind[cj->nodeID];
if (proxy_id < 0)
error("No proxy exists for that foreign node %d!", cj->nodeID);
const struct proxy *p = &e->proxies[proxy_id];
/* Check whether the cell exists in the proxy */
int n = 0;
for (n = 0; n < p->nr_cells_in; n++)
if(p->cells_in[n] == cj)
break;
if(n == p->nr_cells_in)
error("Cell %d not found in the proxy but trying to construct hydro task!",
cjd);
}
else if(cj->nodeID == nodeID && ci->nodeID != engine_rank) {
/* Find the proxy for this node */
const int proxy_id = e->proxy_ind[ci->nodeID];
if (proxy_id < 0)
error("No proxy exists for that foreign node %d!", ci->nodeID);
const struct proxy *p = &e->proxies[proxy_id];
/* Check whether the cell exists in the proxy */
int n = 0;
for (n = 0; n < p->nr_cells_in; n++)
if(p->cells_in[n] == ci)
break;
if(n == p->nr_cells_in)
error("Cell %d not found in the proxy but trying to construct hydro task!",
cid);
}
#endif
if(ci->nodeID == nodeID && cj->nodeID != engine_rank)
atomic_inc(&ci->num_foreign_pair_hydro);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment