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

Re-enabled individual task timers.

parent 77451de9
...@@ -31,6 +31,7 @@ Valid options are: ...@@ -31,6 +31,7 @@ Valid options are:
-s Run with hydrodynamics. -s Run with hydrodynamics.
-S Run with stars. -S Run with stars.
-t {int} The number of threads to use on each MPI rank. Defaults to 1 if not specified. -t {int} The number of threads to use on each MPI rank. Defaults to 1 if not specified.
-T Print timers every time-step.
-v [12] Increase the level of verbosity -v [12] Increase the level of verbosity
1: MPI-rank 0 writes 1: MPI-rank 0 writes
2: All MPI-ranks write 2: All MPI-ranks write
......
...@@ -90,6 +90,7 @@ void print_help_message() { ...@@ -90,6 +90,7 @@ void print_help_message() {
printf(" %2s %8s %s\n", "-t", "{int}", printf(" %2s %8s %s\n", "-t", "{int}",
"The number of threads to use on each MPI rank. Defaults to 1 if not " "The number of threads to use on each MPI rank. Defaults to 1 if not "
"specified."); "specified.");
printf(" %2s %8s %s\n", "-T", "", "Print timers every time-step.");
printf(" %2s %8s %s\n", "-v", "[12]", "Increase the level of verbosity."); printf(" %2s %8s %s\n", "-v", "[12]", "Increase the level of verbosity.");
printf(" %2s %8s %s\n", "", "", "1: MPI-rank 0 writes "); printf(" %2s %8s %s\n", "", "", "1: MPI-rank 0 writes ");
printf(" %2s %8s %s\n", "", "", "2: All MPI-ranks write"); printf(" %2s %8s %s\n", "", "", "2: All MPI-ranks write");
...@@ -165,12 +166,13 @@ int main(int argc, char *argv[]) { ...@@ -165,12 +166,13 @@ int main(int argc, char *argv[]) {
int with_drift_all = 0; int with_drift_all = 0;
int verbose = 0; int verbose = 0;
int nr_threads = 1; int nr_threads = 1;
int with_verbose_timers = 0;
char paramFileName[200] = ""; char paramFileName[200] = "";
unsigned long long cpufreq = 0; unsigned long long cpufreq = 0;
/* Parse the parameters */ /* Parse the parameters */
int c; int c;
while ((c = getopt(argc, argv, "acCdDef:FgGhn:sSt:v:y:")) != -1) switch (c) { while ((c = getopt(argc, argv, "acCdDef:FgGhn:sSt:Tv:y:")) != -1) switch (c) {
case 'a': case 'a':
with_aff = 1; with_aff = 1;
break; break;
...@@ -229,6 +231,9 @@ int main(int argc, char *argv[]) { ...@@ -229,6 +231,9 @@ int main(int argc, char *argv[]) {
return 1; return 1;
} }
break; break;
case 'T':
with_verbose_timers = 1;
break;
case 'v': case 'v':
if (sscanf(optarg, "%d", &verbose) != 1) { if (sscanf(optarg, "%d", &verbose) != 1) {
if (myrank == 0) printf("Error parsing verbosity level (-v).\n"); if (myrank == 0) printf("Error parsing verbosity level (-v).\n");
...@@ -596,11 +601,18 @@ int main(int argc, char *argv[]) { ...@@ -596,11 +601,18 @@ int main(int argc, char *argv[]) {
engine_dump_snapshot(&e); engine_dump_snapshot(&e);
/* Legend */ /* Legend */
if (myrank == 0) if (myrank == 0) {
printf("# %6s %14s %14s %10s %10s %10s %16s [%s]\n", "Step", "Time", printf("# %6s %14s %14s %10s %10s %10s %16s [%s]\n", "Step", "Time",
"Time-step", "Updates", "g-Updates", "s-Updates", "Wall-clock time", "Time-step", "Updates", "g-Updates", "s-Updates", "Wall-clock time",
clocks_getunit()); clocks_getunit());
if (with_verbose_timers) {
printf("timers: ");
for (int k = 0; k < timer_count; k++) printf("%s\t", timers_names[k]);
printf("\n");
}
}
/* Main simulation loop */ /* Main simulation loop */
for (int j = 0; !engine_is_done(&e) && e.step - 1 != nsteps; j++) { for (int j = 0; !engine_is_done(&e) && e.step - 1 != nsteps; j++) {
...@@ -610,6 +622,15 @@ int main(int argc, char *argv[]) { ...@@ -610,6 +622,15 @@ int main(int argc, char *argv[]) {
/* Take a step. */ /* Take a step. */
engine_step(&e); engine_step(&e);
/* Print the timers. */
if (with_verbose_timers) {
printf("timers: ");
for (int k = 0; k < timer_count; k++)
printf("%.3f\t", clocks_from_ticks(timers[k]));
printf("\n");
timers_reset(0xFFFFFFFFllu);
}
#ifdef SWIFT_DEBUG_TASKS #ifdef SWIFT_DEBUG_TASKS
/* Dump the task data using the given frequency. */ /* Dump the task data using the given frequency. */
if (dump_tasks && (dump_tasks == 1 || j % dump_tasks == 1)) { if (dump_tasks && (dump_tasks == 1 || j % dump_tasks == 1)) {
......
...@@ -29,6 +29,53 @@ ...@@ -29,6 +29,53 @@
/* The timers. */ /* The timers. */
ticks timers[timer_count]; ticks timers[timer_count];
/* Timer names. */
char *timers_names[timer_count] = {
"none",
"prepare",
"init",
"drift",
"kick1",
"kick2",
"timestep",
"endforce",
"dosort",
"doself_density",
"doself_gradient",
"doself_force",
"doself_grav_pp",
"dopair_density",
"dopair_gradient",
"dopair_force",
"dopair_grav_pm",
"dopair_grav_mm",
"dopair_grav_pp",
"dograv_external",
"dograv_down",
"dograv_long_range",
"dosource",
"dosub_self_density",
"dosub_self_gradient",
"dosub_self_force",
"dosub_self_grav",
"dosub_pair_density",
"dosub_pair_gradient",
"dosub_pair_force",
"dosub_pair_grav",
"dopair_subset",
"do_ghost",
"do_extra_ghost",
"dorecv_part",
"dorecv_gpart",
"dorecv_spart",
"gettask",
"qget",
"qsteal",
"runners",
"step",
"do_cooling",
};
/** /**
* @brief Re-set the timers. * @brief Re-set the timers.
* *
......
...@@ -27,7 +27,12 @@ ...@@ -27,7 +27,12 @@
#include "cycle.h" #include "cycle.h"
#include "inline.h" #include "inline.h"
/* The timers themselves. */ /**
* @brief The timers themselves.
*
* If you modify this list, be sure to change timers_names in timers.c as
* well!
**/
enum { enum {
timer_none = 0, timer_none = 0,
timer_prepare, timer_prepare,
...@@ -78,6 +83,9 @@ enum { ...@@ -78,6 +83,9 @@ enum {
/* The timers. */ /* The timers. */
extern ticks timers[timer_count]; extern ticks timers[timer_count];
/* The timer names. */
extern char *timers_names[];
/* Mask for all timers. */ /* Mask for all timers. */
#define timers_mask_all ((1ull << timer_count) - 1) #define timers_mask_all ((1ull << timer_count) - 1)
......
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