Skip to content
Snippets Groups Projects
Commit 1592b255 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Now we have ticks all the time the statistics and fixed costs estimates can be...

Now we have ticks all the time the statistics and fixed costs estimates can be permanently available

Switch costs to time based, rather than some arbitrary scaling, makes comparisons more straight-forward
parent 84830f45
Branches
Tags
1 merge request!707Repart by CPU ticks with optional fixed costs
......@@ -328,9 +328,11 @@ int main(int argc, char *argv[]) {
}
#ifndef SWIFT_DEBUG_TASKS
if (dump_tasks) {
error(
"Task dumping is only possible if SWIFT was configured with the "
"--enable-task-debugging option.");
if (myrank == 0) {
message("WARNING: complete task dumps are only created when "
"configured with --enable-task-debugging. "
"Basic task statistics will be output.");
}
}
#endif
break;
......@@ -1085,15 +1087,15 @@ int main(int argc, char *argv[]) {
if (force_stop || (e.restart_onexit && e.step - 1 == nsteps))
engine_dump_restarts(&e, 0, 1);
#ifdef SWIFT_DEBUG_TASKS
/* Dump the task data using the given frequency. */
if (dump_tasks && (dump_tasks == 1 || j % dump_tasks == 1)) {
#ifdef SWIFT_DEBUG_TASKS
task_dump_all(&e, j + 1);
#endif
/* Generate the task statistics. */
task_dump_stats(&e, j + 1);
}
#endif
#ifdef SWIFT_DEBUG_THREADPOOL
/* Dump the task data using the given frequency. */
......
......@@ -1816,13 +1816,12 @@ void scheduler_reweight(struct scheduler *s, int verbose) {
/* Run through the tasks backwards and set their weights. */
for (int k = nr_tasks - 1; k >= 0; k--) {
struct task *t = &tasks[tid[k]];
float cost;
float cost = 0.f;
t->weight = 0.f;
for (int j = 0; j < t->nr_unlock_tasks; j++)
if (t->unlock_tasks[j]->weight > t->weight)
t->weight = t->unlock_tasks[j]->weight;
float cost = 0.f;
const float count_i = (t->ci != NULL) ? t->ci->hydro.count : 0.f;
const float count_j = (t->cj != NULL) ? t->cj->hydro.count : 0.f;
......
......@@ -702,7 +702,6 @@ void task_dump_all(struct engine *e, int step) {
*/
void task_dump_stats(struct engine *e, int step) {
#ifdef SWIFT_DEBUG_TASKS
char dumpfile[40];
snprintf(dumpfile, 40, "thread_stats-step%d.dat", step);
......@@ -725,7 +724,6 @@ void task_dump_stats(struct engine *e, int step) {
}
double total[1] = {0.0};
double minmin[1] = {DBL_MAX};
for (int l = 0; l < e->sched.nr_tasks; l++) {
int type = e->sched.tasks[l].type;
......@@ -745,7 +743,6 @@ void task_dump_stats(struct engine *e, int step) {
max[type][subtype] = dt;
}
total[0] += dt;
if (dt < minmin[0]) minmin[0] = dt;
}
}
......@@ -773,10 +770,6 @@ void task_dump_stats(struct engine *e, int step) {
MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
if (res != MPI_SUCCESS) mpi_error(res, "Failed to reduce task total time");
res = MPI_Reduce((engine_rank == 0 ? MPI_IN_PLACE : minmin), minmin, 1,
MPI_DOUBLE, MPI_MIN, 0, MPI_COMM_WORLD);
if (res != MPI_SUCCESS) mpi_error(res, "Failed to reduce task global min");
if (engine_rank == 0) {
#endif
......@@ -790,7 +783,10 @@ void task_dump_stats(struct engine *e, int step) {
if (sum[j][k] > 0.0) {
double mean = sum[j][k] / (double)count[j][k];
double perc = 100.0 * sum[j][k] / total[0];
int fixed_cost = (int)mean / minmin[0];
/* Fixed cost is in .1ns as we want to compare between runs in
* some absolute units. */
int fixed_cost = (int)(clocks_from_ticks(mean) * 10000.f);
fprintf(dfile,
"%15s/%-10s %10d %14.2f %14.2f %14.2f %14.2f %14.2f %10d\n",
taskID, subtaskID_names[k], count[j][k], min[j][k], max[j][k],
......@@ -806,5 +802,4 @@ void task_dump_stats(struct engine *e, int step) {
}
#endif
#endif // SWIFT_DEBUG_TASKS
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment