diff --git a/examples/main.c b/examples/main.c index 69b0fcd55c4508af1825954b7a3088c258f9353a..df2b30c743759273d3f8958ee17eb2abbb923eee 100644 --- a/examples/main.c +++ b/examples/main.c @@ -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. */ diff --git a/src/scheduler.c b/src/scheduler.c index d4ac89ddca85b9acefee3ac5acd85d073f3666d9..1cd65bc154af1099522a4ec749df78540c9502dc 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -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; diff --git a/src/task.c b/src/task.c index 62e00d976582766e8ff9b1b7ebb408ca11c373a4..51998182ab79c2f07f218f0e0aa9066a73e06f92 100644 --- a/src/task.c +++ b/src/task.c @@ -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 }