Commit 595c6399 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Code formatting

parent d891c77f
...@@ -265,7 +265,7 @@ int main(int argc, char *argv[]) { ...@@ -265,7 +265,7 @@ int main(int argc, char *argv[]) {
/* Report CPU frequency. */ /* Report CPU frequency. */
cpufreq = clocks_get_cpufreq(); cpufreq = clocks_get_cpufreq();
if (myrank == 0) { if (myrank == 0) {
message("Running on: %s",hostname()); message("Running on: %s", hostname());
message("CPU frequency used for tick conversion: %llu Hz", cpufreq); message("CPU frequency used for tick conversion: %llu Hz", cpufreq);
} }
......
...@@ -2174,15 +2174,18 @@ void engine_print_task_counts(struct engine *e) { ...@@ -2174,15 +2174,18 @@ void engine_print_task_counts(struct engine *e) {
int counts[task_type_count + 1]; int counts[task_type_count + 1];
for (int k = 0; k <= task_type_count; k++) counts[k] = 0; for (int k = 0; k <= task_type_count; k++) counts[k] = 0;
for (int k = 0; k < sched->nr_tasks; k++) { for (int k = 0; k < sched->nr_tasks; k++) {
if (sched->tasks[k].skip) counts[task_type_count] += 1; if (sched->tasks[k].skip)
else counts[(int)sched->tasks[k].type] += 1; counts[task_type_count] += 1;
else
counts[(int)sched->tasks[k].type] += 1;
} }
#ifdef WITH_MPI #ifdef WITH_MPI
printf("[%04i] %s engine_print_task_counts: task counts are [ %s=%i", printf("[%04i] %s engine_print_task_counts: task counts are [ %s=%i",
e->nodeID, clocks_get_timesincestart(), taskID_names[0], counts[0]); e->nodeID, clocks_get_timesincestart(), taskID_names[0], counts[0]);
#else #else
printf("%s engine_print_task_counts: time step:%d task counts are [ %s=%i", printf("%s engine_print_task_counts: time step:%d task counts are [ %s=%i",
clocks_get_timesincestart(), e->ti_current, taskID_names[0], counts[0]); clocks_get_timesincestart(), e->ti_current, taskID_names[0],
counts[0]);
#endif #endif
for (int k = 1; k < task_type_count; k++) for (int k = 1; k < task_type_count; k++)
printf(" %s=%i", taskID_names[k], counts[k]); printf(" %s=%i", taskID_names[k], counts[k]);
...@@ -2796,7 +2799,7 @@ void engine_step(struct engine *e) { ...@@ -2796,7 +2799,7 @@ void engine_step(struct engine *e) {
mask |= 1 << task_type_recv; mask |= 1 << task_type_recv;
submask |= 1 << task_subtype_tend; submask |= 1 << task_subtype_tend;
} }
engine_print_task_counts(e); engine_print_task_counts(e);
if (e->verbose) engine_print_task_counts(e); if (e->verbose) engine_print_task_counts(e);
...@@ -3364,13 +3367,14 @@ void engine_init(struct engine *e, struct space *s, ...@@ -3364,13 +3367,14 @@ void engine_init(struct engine *e, struct space *s,
nr_nodes * nr_threads); nr_nodes * nr_threads);
e->file_timesteps = fopen(timestepsfileName, "w"); e->file_timesteps = fopen(timestepsfileName, "w");
fprintf(e->file_timesteps, fprintf(e->file_timesteps,
"# Host: %s\n# Branch: %s\n# Revision: %s\n# Compiler: %s, Version: %s \n# " "# Host: %s\n# Branch: %s\n# Revision: %s\n# Compiler: %s, "
"Version: %s \n# "
"Number of threads: %d\n# Number of MPI ranks: %d\n# Hydrodynamic " "Number of threads: %d\n# Number of MPI ranks: %d\n# Hydrodynamic "
"scheme: %s\n# Hydrodynamic kernel: %s\n# No. of neighbours: %.2f " "scheme: %s\n# Hydrodynamic kernel: %s\n# No. of neighbours: %.2f "
"+/- %.2f\n# Eta: %f\n", "+/- %.2f\n# Eta: %f\n",
hostname(), git_branch(), git_revision(), compiler_name(), compiler_version(), hostname(), git_branch(), git_revision(), compiler_name(),
e->nr_threads, e->nr_nodes, SPH_IMPLEMENTATION, kernel_name, compiler_version(), e->nr_threads, e->nr_nodes, SPH_IMPLEMENTATION,
e->hydro_properties->target_neighbours, kernel_name, e->hydro_properties->target_neighbours,
e->hydro_properties->delta_neighbours, e->hydro_properties->delta_neighbours,
e->hydro_properties->eta_neighbours); e->hydro_properties->eta_neighbours);
......
...@@ -62,8 +62,7 @@ const char *hostname(void) { ...@@ -62,8 +62,7 @@ const char *hostname(void) {
static int initialised = 0; static int initialised = 0;
if (!initialised) { if (!initialised) {
buf[255] = '\0'; buf[255] = '\0';
if(gethostname(buf,255)) if (gethostname(buf, 255)) sprintf(buf, "%s", "Unknown host");
sprintf(buf, "%s", "Unknown host");
initialised = 1; initialised = 1;
} }
return buf; return buf;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
const char* package_description(void); const char* package_description(void);
const char* package_version(void); const char* package_version(void);
const char *hostname(void); const char* hostname(void);
const char* git_revision(void); const char* git_revision(void);
const char* git_branch(void); const char* git_branch(void);
const char* compiler_name(void); const char* compiler_name(void);
......
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