Commit 0ce88be0 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'master' of gitlab.cosma.dur.ac.uk:swift/swiftsim

parents 8d372771 a4cb085a
......@@ -262,12 +262,21 @@ int main(int argc, char *argv[]) {
message(
"Executing a dry run. No i/o or time integration will be performed.");
/* Report CPU frequency. */
/* Report CPU frequency.*/
cpufreq = clocks_get_cpufreq();
if (myrank == 0) {
message("CPU frequency used for tick conversion: %llu Hz", cpufreq);
}
/* Report host name(s). */
#ifdef WITH_MPI
if (myrank == 0 || verbose > 1) {
message("Rank %d running on: %s", myrank, hostname());
}
#else
message("Running on: %s", hostname());
#endif
/* Do we choke on FP-exceptions ? */
if (with_fp_exceptions) {
feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
......
......@@ -3409,13 +3409,14 @@ void engine_init(struct engine *e, struct space *s,
nr_nodes * nr_threads);
e->file_timesteps = fopen(timestepsfileName, "w");
fprintf(e->file_timesteps,
"# 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 "
"scheme: %s\n# Hydrodynamic kernel: %s\n# No. of neighbours: %.2f "
"+/- %.2f\n# Eta: %f\n",
git_branch(), git_revision(), compiler_name(), compiler_version(),
e->nr_threads, e->nr_nodes, SPH_IMPLEMENTATION, kernel_name,
e->hydro_properties->target_neighbours,
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);
......
......@@ -21,6 +21,9 @@
/* Config parameters. */
#include "../config.h"
/* Needed for gethostname() */
#include <unistd.h>
/* MPI headers. */
#ifdef WITH_MPI
#include <mpi.h>
......@@ -47,6 +50,24 @@
/* Local headers. */
#include "version_string.h"
/**
* @brief Return the hostname
*
* Will return the name of the host.
*
* @result the hostname.
*/
const char *hostname(void) {
static char buf[256];
static int initialised = 0;
if (!initialised) {
buf[255] = '\0';
if (gethostname(buf, 255)) sprintf(buf, "%s", "Unknown host");
initialised = 1;
}
return buf;
}
/**
* @brief Return the source code git revision
*
......
......@@ -22,6 +22,7 @@
const char* package_description(void);
const char* package_version(void);
const char* hostname(void);
const char* git_revision(void);
const char* git_branch(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