Commit d8ff8f33 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Handle more types/subtypes explicitly in scheduler_reweight()

parent d5ae23d4
......@@ -1366,21 +1366,35 @@ void scheduler_reweight(struct scheduler *s, int verbose) {
(sizeof(int) * 8 - intrinsics_clz(t->ci->stars.count));
break;
case task_type_stars_resort:
cost = wscale * intrinsics_popcount(t->flags) * scount_i *
(sizeof(int) * 8 - intrinsics_clz(t->ci->stars.count));
break;
case task_type_self:
if (t->subtype == task_subtype_grav) {
cost = 1.f * (wscale * gcount_i) * gcount_i;
} else if (t->subtype == task_subtype_external_grav)
cost = 1.f * wscale * gcount_i;
else if (t->subtype == task_subtype_stars_density)
cost = 1.f * wscale * scount_i * count_i;
else if (t->subtype == task_subtype_stars_feedback)
else if (t->subtype == task_subtype_stars_density ||
t->subtype == task_subtype_stars_feedback)
cost = 1.f * wscale * scount_i * count_i;
else if (t->subtype == task_subtype_bh_density)
else if (t->subtype == task_subtype_bh_density ||
t->subtype == task_subtype_bh_swallow ||
t->subtype == task_subtype_bh_feedback)
cost = 1.f * wscale * bcount_i * count_i;
else if (t->subtype == task_subtype_bh_feedback)
cost = 1.f * wscale * bcount_i * count_i;
else // hydro loops
else if (t->subtype == task_subtype_do_gas_swallow)
cost = 1.f * wscale * count_i;
else if (t->subtype == task_subtype_do_bh_swallow)
cost = 1.f * wscale * bcount_i;
else if (t->subtype == task_subtype_density ||
t->subtype == task_subtype_gradient ||
t->subtype == task_subtype_force ||
t->subtype == task_subtype_limiter)
cost = 1.f * (wscale * count_i) * count_i;
else
error("Untreated sub-type for selfs: %s",
subtaskID_names[t->subtype]);
break;
case task_type_pair:
......@@ -1401,6 +1415,7 @@ void scheduler_reweight(struct scheduler *s, int verbose) {
sid_scale[t->flags];
} else if (t->subtype == task_subtype_bh_density ||
t->subtype == task_subtype_bh_swallow ||
t->subtype == task_subtype_bh_feedback) {
if (t->ci->nodeID != nodeID)
cost = 3.f * wscale * count_i * bcount_j * sid_scale[t->flags];
......@@ -1410,11 +1425,24 @@ void scheduler_reweight(struct scheduler *s, int verbose) {
cost = 2.f * wscale * (bcount_i * count_j + bcount_j * count_i) *
sid_scale[t->flags];
} else { // hydro loops
} else if (t->subtype == task_subtype_do_gas_swallow) {
cost = 1.f * wscale * (count_i + count_j);
} else if (t->subtype == task_subtype_do_bh_swallow) {
cost = 1.f * wscale * (bcount_i + bcount_j);
} else if (t->subtype == task_subtype_density ||
t->subtype == task_subtype_gradient ||
t->subtype == task_subtype_force ||
t->subtype == task_subtype_limiter) {
if (t->ci->nodeID != nodeID || t->cj->nodeID != nodeID)
cost = 3.f * (wscale * count_i) * count_j * sid_scale[t->flags];
else
cost = 2.f * (wscale * count_i) * count_j * sid_scale[t->flags];
} else {
error("Untreated sub-type for pairs: %s",
subtaskID_names[t->subtype]);
}
break;
......@@ -1434,6 +1462,7 @@ void scheduler_reweight(struct scheduler *s, int verbose) {
}
} else if (t->subtype == task_subtype_bh_density ||
t->subtype == task_subtype_bh_swallow ||
t->subtype == task_subtype_bh_feedback) {
if (t->ci->nodeID != nodeID) {
cost = 3.f * (wscale * count_i) * bcount_j * sid_scale[t->flags];
......@@ -1444,26 +1473,48 @@ void scheduler_reweight(struct scheduler *s, int verbose) {
sid_scale[t->flags];
}
} else { // hydro loops
} else if (t->subtype == task_subtype_do_gas_swallow) {
cost = 1.f * wscale * (count_i + count_j);
} else if (t->subtype == task_subtype_do_bh_swallow) {
cost = 1.f * wscale * (bcount_i + bcount_j);
} else if (t->subtype == task_subtype_density ||
t->subtype == task_subtype_gradient ||
t->subtype == task_subtype_force ||
t->subtype == task_subtype_limiter) {
if (t->ci->nodeID != nodeID || t->cj->nodeID != nodeID) {
cost = 3.f * (wscale * count_i) * count_j * sid_scale[t->flags];
} else {
cost = 2.f * (wscale * count_i) * count_j * sid_scale[t->flags];
}
} else {
error("Untreated sub-type for sub-pairs: %s",
subtaskID_names[t->subtype]);
}
break;
case task_type_sub_self:
if (t->subtype == task_subtype_stars_density) {
cost = 1.f * (wscale * scount_i) * count_i;
} else if (t->subtype == task_subtype_stars_feedback) {
if (t->subtype == task_subtype_stars_density ||
t->subtype == task_subtype_stars_feedback) {
cost = 1.f * (wscale * scount_i) * count_i;
} else if (t->subtype == task_subtype_bh_density) {
cost = 1.f * (wscale * bcount_i) * count_i;
} else if (t->subtype == task_subtype_bh_feedback) {
} else if (t->subtype == task_subtype_bh_density ||
t->subtype == task_subtype_bh_swallow ||
t->subtype == task_subtype_bh_feedback) {
cost = 1.f * (wscale * bcount_i) * count_i;
} else {
} else if (t->subtype == task_subtype_do_gas_swallow) {
cost = 1.f * wscale * count_i;
} else if (t->subtype == task_subtype_do_bh_swallow) {
cost = 1.f * wscale * bcount_i;
} else if (t->subtype == task_subtype_density ||
t->subtype == task_subtype_gradient ||
t->subtype == task_subtype_force ||
t->subtype == task_subtype_limiter) {
cost = 1.f * (wscale * count_i) * count_i;
} else {
error("Untreated sub-type for sub-selfs: %s",
subtaskID_names[t->subtype]);
}
break;
case task_type_ghost:
......@@ -1478,6 +1529,9 @@ void scheduler_reweight(struct scheduler *s, int verbose) {
case task_type_bh_density_ghost:
if (t->ci == t->ci->hydro.super) cost = wscale * bcount_i;
break;
case task_type_bh_swallow_ghost2:
if (t->ci == t->ci->hydro.super) cost = wscale * bcount_i;
break;
case task_type_drift_part:
cost = wscale * count_i;
break;
......@@ -1499,6 +1553,9 @@ void scheduler_reweight(struct scheduler *s, int verbose) {
case task_type_grav_long_range:
cost = wscale * gcount_i;
break;
case task_type_grav_mesh:
cost = wscale * gcount_i;
break;
case task_type_grav_mm:
cost = wscale * (gcount_i + gcount_j);
break;
......@@ -1523,6 +1580,12 @@ void scheduler_reweight(struct scheduler *s, int verbose) {
case task_type_timestep:
cost = wscale * (count_i + gcount_i + scount_i + bcount_i);
break;
case task_type_timestep_limiter:
cost = wscale * count_i;
break;
case task_type_timestep_sync:
cost = wscale * count_i;
break;
case task_type_send:
if (count_i < 1e5)
cost = 10.f * (wscale * count_i) * count_i;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment