From e4adbf64375d061e90f82677b469ab1e884620b2 Mon Sep 17 00:00:00 2001 From: lhausamm <loic_hausammann@hotmail.com> Date: Mon, 6 Nov 2017 16:08:54 +0100 Subject: [PATCH] Ensure size of the log --- examples/parameter_example.yml | 1 + src/engine.c | 6 ++++-- src/engine.h | 4 ++++ src/runner.c | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/examples/parameter_example.yml b/examples/parameter_example.yml index 85661a9eda..a9fd08c585 100644 --- a/examples/parameter_example.yml +++ b/examples/parameter_example.yml @@ -91,6 +91,7 @@ Snapshots: output_list_on: 0 # (Optional) Enable the output list output_list: snaplist.txt # (Optional) File containing the output times (see documentation in "Parameter File" section) logger_max_steps: 10 # (Optional) Number of particle steps between two chunk writing if using logger + logger_size: 1e7 # buffer size of the logger file in bytes # Parameters governing the conserved quantities statistics Statistics: diff --git a/src/engine.c b/src/engine.c index 0d99a1fb02..96b2eeeaf0 100644 --- a/src/engine.c +++ b/src/engine.c @@ -5461,6 +5461,7 @@ void engine_step(struct engine *e) { ((double)e->total_nr_gparts) * e->gravity_properties->rebuild_frequency)) e->forcerebuild = 1; + #ifdef WITH_LOGGER logger_log_timestamp(e->ti_old, &e->logger_time_offset, e->logger_dump); @@ -6700,10 +6701,11 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params, /* Logger params */ char logger_name_file[PARSER_MAX_LINE_SIZE]; e->logger_max_steps = parser_get_opt_param_int(params, "Snapshots:logger_max_steps", 10); - parser_get_opt_param_string(params, "Snapshots:dump_file", logger_name_file, e->snapshotBaseName); + e->logger_size = parser_get_param_float(params, "Snapshots:logger_size"); + strcpy(logger_name_file, e->snapshotBaseName); strcat(logger_name_file, ".dump"); e->logger_dump = malloc(sizeof(struct dump)); - dump_init(e->logger_dump, logger_name_file, 1024 * 1024 * 100); + dump_init(e->logger_dump, logger_name_file, e->logger_size); e->logger_time_offset = 0; #endif diff --git a/src/engine.h b/src/engine.h index 5efd53b230..e5c7106a40 100644 --- a/src/engine.h +++ b/src/engine.h @@ -325,6 +325,10 @@ struct engine { /* Need to dump a snapshot ? */ int dump_snapshot; + /* Size of the dump file */ + int logger_size; +#endif + /* How many steps have we done with the same set of tasks? */ int tasks_age; diff --git a/src/runner.c b/src/runner.c index 9dbc1f5fea..5a9e6e26f0 100644 --- a/src/runner.c +++ b/src/runner.c @@ -899,7 +899,7 @@ void runner_do_init_grav(struct runner *r, struct cell *c, int timer) { * @param timer Are we timing this ? */ void runner_do_extra_ghost(struct runner *r, struct cell *c, int timer) { - + #ifdef EXTRA_HYDRO_LOOP struct part *restrict parts = c->hydro.parts; -- GitLab