diff --git a/examples/main_fof.c b/examples/main_fof.c index f1203745ae2a43d68733dc711cbb1ff30ce7ea14..a4640ebfd934aad2388cdbb852a0c4612284c922 100644 --- a/examples/main_fof.c +++ b/examples/main_fof.c @@ -194,7 +194,7 @@ int main(int argc, char *argv[]) { int with_self_gravity = 0; int with_hydro = 0; int with_stars = 0; - int with_fof = 0; + int with_fof = 1; int with_feedback = 0; int with_fp_exceptions = 0; int with_drift_all = 0; @@ -998,9 +998,17 @@ int main(int argc, char *argv[]) { engine_redistribute(&e); #endif +#ifdef SWIFT_DEBUG_TASKS + e.tic_step = getticks(); +#endif + /* Initialise the particles */ engine_init_particles(&e, flag_entropy_ICs, clean_smoothing_length_values, 0); +#ifdef SWIFT_DEBUG_TASKS + e.toc_step = getticks(); +#endif + /* Perform first FOF search after the first snapshot dump. */ fof_search_tree(&s); @@ -1008,23 +1016,52 @@ int main(int argc, char *argv[]) { MPI_Barrier(MPI_COMM_WORLD); #endif } + +#ifdef SWIFT_DEBUG_TASKS + char dumpfile[32]; + snprintf(dumpfile, sizeof(dumpfile), "thread_info-step%d.dat", 1); + FILE *file_thread; + file_thread = fopen(dumpfile, "w"); + /* Add some information to help with the plots */ + fprintf(file_thread, " %d %d %d %d %lld %lld %lld %lld %lld %d %lld\n", + -2, -1, -1, 1, e.tic_step, e.toc_step, e.updates, e.g_updates, + e.s_updates, 0, cpufreq); + for (int l = 0; l < e.sched.nr_tasks; l++) { + if (!e.sched.tasks[l].implicit && e.sched.tasks[l].toc != 0) { + fprintf( + file_thread, " %i %i %i %i %lli %lli %i %i %i %i %i\n", + e.sched.tasks[l].rid, e.sched.tasks[l].type, + e.sched.tasks[l].subtype, (e.sched.tasks[l].cj == NULL), + e.sched.tasks[l].tic, e.sched.tasks[l].toc, + (e.sched.tasks[l].ci == NULL) ? 0 + : e.sched.tasks[l].ci->hydro.count, + (e.sched.tasks[l].cj == NULL) ? 0 + : e.sched.tasks[l].cj->hydro.count, + (e.sched.tasks[l].ci == NULL) ? 0 + : e.sched.tasks[l].ci->grav.count, + (e.sched.tasks[l].cj == NULL) ? 0 + : e.sched.tasks[l].cj->grav.count, + e.sched.tasks[l].sid); + } + } + fclose(file_thread); +#endif // SWIFT_DEBUG_TASKS #ifdef SWIFT_DEBUG_THREADPOOL /* Dump the task data using the given frequency. */ if (dump_threadpool) { - char dumpfile[52]; + char threadpool_dumpfile[52]; #ifdef WITH_MPI - snprintf(dumpfile, 52, "threadpool_info-rank%d-step%d.dat", engine_rank, 0); + snprintf(threadpool_dumpfile, 52, "threadpool_info-rank%d-step%d.dat", engine_rank, 0); #else - snprintf(dumpfile, 52, "threadpool_info-step%d.dat", 0); + snprintf(threadpool_dumpfile, 52, "threadpool_info-step%d.dat", 0); #endif // WITH_MPI - threadpool_dump_log(&e.threadpool, dumpfile, 1); + threadpool_dump_log(&e.threadpool, threadpool_dumpfile, 1); } else { threadpool_reset_log(&e.threadpool); } #endif // SWIFT_DEBUG_THREADPOOL - /* used parameters */ parser_write_params_to_file(params, "used_parameters.yml", 1); /* unused parameters */