Commit 73e4beb4 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Print the min and max active time-bin at every time-step

parent 835c678a
......@@ -845,9 +845,9 @@ int main(int argc, char *argv[]) {
/* Legend */
if (myrank == 0)
printf("# %6s %14s %14s %12s %12s %12s %16s [%s] %6s\n", "Step", "Time",
"Time-step", "Updates", "g-Updates", "s-Updates", "Wall-clock time",
clocks_getunit(), "Props");
printf("# %6s %14s %14s %9s %12s %12s %12s %16s [%s] %6s\n", "Step", "Time",
"Time-step", "Time-bins", "Updates", "g-Updates", "s-Updates",
"Wall-clock time", clocks_getunit(), "Props");
/* File for the timers */
if (with_verbose_timers) timers_open_file(myrank);
......
......@@ -148,8 +148,8 @@ def parse_files():
# Loop over all files for a given series and load the times
for j in range(0,len(file_list)):
times = np.loadtxt(file_list[j],usecols=(6,))
updates = np.loadtxt(file_list[j],usecols=(3,))
times = np.loadtxt(file_list[j],usecols=(8,))
updates = np.loadtxt(file_list[j],usecols=(5,))
totalTime[i].append(np.sum(times))
sumTotal.append(np.sum(totalTime[i]))
......
......@@ -149,8 +149,8 @@ def parse_files():
# Loop over all files for a given series and load the times
for j in range(0,len(file_list)):
times = np.loadtxt(file_list[j],usecols=(6,), skiprows=11)
updates = np.loadtxt(file_list[j],usecols=(3,), skiprows=11)
times = np.loadtxt(file_list[j],usecols=(8,))
updates = np.loadtxt(file_list[j],usecols=(5,))
totalTime[i].append(np.sum(times))
sumTotal.append(np.sum(totalTime[i]))
......
......@@ -4370,14 +4370,17 @@ void engine_step(struct engine *e) {
if (e->nodeID == 0) {
/* Print some information to the screen */
printf(" %6d %14e %14e %12zu %12zu %12zu %21.3f %6d\n", e->step, e->time,
e->time_step, e->updates, e->g_updates, e->s_updates,
e->wallclock_time, e->step_props);
printf(" %6d %14e %14e %4d %4d %12zu %12zu %12zu %21.3f %6d\n", e->step,
e->time, e->time_step, e->min_active_bin, e->max_active_bin,
e->updates, e->g_updates, e->s_updates, e->wallclock_time,
e->step_props);
fflush(stdout);
fprintf(e->file_timesteps, " %6d %14e %14e %12zu %12zu %12zu %21.3f %6d\n",
e->step, e->time, e->time_step, e->updates, e->g_updates,
e->s_updates, e->wallclock_time, e->step_props);
fprintf(e->file_timesteps,
" %6d %14e %14e %4d %4d %12zu %12zu %12zu %21.3f %6d\n", e->step,
e->time, e->time_step, e->min_active_bin, e->max_active_bin,
e->updates, e->g_updates, e->s_updates, e->wallclock_time,
e->step_props);
fflush(e->file_timesteps);
}
......@@ -4385,6 +4388,7 @@ void engine_step(struct engine *e) {
e->ti_old = e->ti_current;
e->ti_current = e->ti_end_min;
e->max_active_bin = get_max_active_bin(e->ti_end_min);
e->min_active_bin = get_min_active_bin(e->ti_current, e->ti_old);
e->step += 1;
e->step_props = engine_step_prop_none;
......@@ -5213,6 +5217,7 @@ void engine_init(
e->time_begin = 0.;
e->time_end = 0.;
e->max_active_bin = num_time_bins;
e->min_active_bin = 1;
e->internal_units = internal_units;
e->timeFirstSnapshot =
parser_get_param_double(params, "Snapshots:time_first");
......@@ -5508,12 +5513,13 @@ void engine_config(int restart, struct engine *e,
"Version: %s \n# "
"Number of threads: %d\n# Number of MPI ranks: %d\n# Hydrodynamic "
"scheme: %s\n# Hydrodynamic kernel: %s\n# No. of neighbours: %.2f "
"+/- %.4f\n# Eta: %f\n",
"+/- %.4f\n# Eta: %f\n# Config: %s\n# CFLAGS: %s\n",
hostname(), git_branch(), git_revision(), compiler_name(),
compiler_version(), e->nr_threads, e->nr_nodes, SPH_IMPLEMENTATION,
kernel_name, e->hydro_properties->target_neighbours,
e->hydro_properties->delta_neighbours,
e->hydro_properties->eta_neighbours);
e->hydro_properties->eta_neighbours, configuration_options(),
compilation_cflags());
fprintf(e->file_timesteps,
"# Step Properties: Rebuild=%d, Redistribute=%d, Repartition=%d, "
......@@ -5523,9 +5529,9 @@ void engine_config(int restart, struct engine *e,
engine_step_prop_snapshot, engine_step_prop_restarts);
fprintf(e->file_timesteps,
"# %6s %14s %14s %12s %12s %12s %16s [%s] %6s\n", "Step", "Time",
"Time-step", "Updates", "g-Updates", "s-Updates",
"Wall-clock time", clocks_getunit(), "Props");
"# %6s %14s %14s %9s %12s %12s %12s %16s [%s] %6s\n", "Step",
"Time", "Time-step", "Time-bins", "Updates", "g-Updates",
"s-Updates", "Wall-clock time", clocks_getunit(), "Props");
fflush(e->file_timesteps);
}
}
......
......@@ -142,6 +142,9 @@ struct engine {
/* The highest active bin at this time */
timebin_t max_active_bin;
/* The lowest active bin at this time */
timebin_t min_active_bin;
/* Time step */
double time_step;
......
......@@ -40,6 +40,12 @@ typedef char timebin_t;
/*! Fictious time-bin to hold inhibited particles */
#define time_bin_inhibited (num_time_bins + 2)
/*! Fictitious time-bin for particles not awaken */
#define time_bin_not_awake (0)
/*! Fictitious time-bin for particles woken up */
#define time_bin_awake (-1)
/**
* @brief Returns the integer time interval corresponding to a time bin
*
......@@ -122,4 +128,17 @@ static INLINE timebin_t get_max_active_bin(integertime_t time) {
return bin;
}
/**
* @brief Returns the lowest active time bin at a given point on the time line.
*
* @param ti_current The current point on the time line.
* @param ti_old The last synchronisation point on the time line.
*/
static INLINE timebin_t get_min_active_bin(integertime_t ti_current,
integertime_t ti_old) {
const timebin_t min_bin = get_max_active_bin(ti_current - ti_old);
return (ti_old > 0) ? min_bin : (min_bin - 1);
}
#endif /* SWIFT_TIMELINE_H */
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