Commit 84ab98ec authored by lhausamm's avatar lhausamm Committed by Loic Hausammann
Browse files

First reviews from Pedro

parent 41fbd21b
......@@ -90,8 +90,12 @@ Snapshots:
UnitTemp_in_cgs: 1 # (Optional) Unit system for the outputs (Kelvin)
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: 10. # buffer size of the logger file in MB
# Parameters governing the logger snapshot system
Logger:
max_steps: 10 # (Optional) Update the particle log every this many updates
mmaped_buffer_size: .01 # buffer size in GB
basename: indice # Common part of the filenames
# Parameters governing the conserved quantities statistics
Statistics:
......
......@@ -50,7 +50,7 @@ void *dump_get(struct dump *d, size_t count, size_t *offset) {
size_t local_offset = atomic_add(&d->count, count);
#ifdef SWIFT_DEBUG_CHECKS
if (d->count > d->size)
error("A new dump file should be created");
error("A new dump file should have been created.");
#endif
*offset = local_offset + d->file_offset;
return (char *)d->data + local_offset;
......
......@@ -5216,7 +5216,7 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs,
#ifdef WITH_LOGGER
logger_log_timestamp(e->ti_old, &e->logger_time_offset,
e->logger_dump);
logger_ensure_size(e->total_nr_parts, e->logger_size);
logger_ensure_size(e->total_nr_parts, e->logger_buffer_size);
#endif
/* Now, launch the calculation */
......@@ -5468,11 +5468,12 @@ void engine_step(struct engine *e) {
((double)e->total_nr_gparts) * e->gravity_properties->rebuild_frequency))
e->forcerebuild = 1;
#ifdef WITH_LOGGER
#ifdef WITH_LOGGER
logger_log_timestamp(e->ti_current, &e->logger_time_offset,
e->logger_dump);
logger_ensure_size(e->total_nr_parts, e->logger_size);
dump_ensure(e->logger_dump, e->logger_size);
logger_ensure_size(e->total_nr_parts, e->logger_buffer_size);
dump_ensure(e->logger_dump, e->logger_buffer_size);
#endif
/* Are we drifting everything (a la Gadget/GIZMO) ? */
......@@ -6524,8 +6525,7 @@ void engine_dump_index(struct engine *e) {
#endif
/* Dump... */
/* Should use snapshotBaseName for the index name */
write_index_single(e, e->snapshotBaseName, e->internal_units,
write_index_single(e, e->loggerBaseName, e->internal_units,
e->snapshotUnits);
e->dump_snapshot = 0;
......@@ -7334,7 +7334,7 @@ void engine_config(int restart, struct engine *e, struct swift_params *params,
if (e->nodeID == 0)
message("Expected output of over 9000\n Should write a real message...");
logger_write_file_header(e->logger_dump, e);
dump_ensure(e->logger_dump, e->logger_size);
dump_ensure(e->logger_dump, e->logger_buffer_size);
e->logger_time_offset = 0;
#endif
......
......@@ -316,6 +316,9 @@ struct engine {
/* Number of particle steps between dumping a chunk of data */
short int logger_max_steps;
/* Logger basename */
char loggerBaseName[PARSER_MAX_LINE_SIZE];
/* File name of the dump file */
struct dump *logger_dump;
......
......@@ -56,7 +56,7 @@ struct xpart {
struct cooling_xpart_data cooling_data;
#ifdef WITH_LOGGER
/* Number of time step since last output */
/* Number of particle updates since last output */
short int last_output;
#endif
......@@ -96,7 +96,7 @@ struct part {
float entropy_dt;
#ifdef WITH_LOGGER
/* offset at last writing */
/* offset of last particle log entry */
size_t last_offset;
#endif
......
......@@ -208,7 +208,7 @@ void logger_log_part(const struct part *p, const unsigned int mask, size_t *offs
error("You should not log particles as timestamps.");
/* Start by computing the size of the message. */
const int size = logger_size(mask);
const int size = logger_buffer_size(mask);
/* Allocate a chunk of memory in the dump of the right size. */
size_t offset_new;
......@@ -289,7 +289,7 @@ void logger_log_gpart(const struct gpart *p, const unsigned int mask, size_t *of
error("Can't log SPH quantities for gparts.");
/* Start by computing the size of the message. */
const int size = logger_size(mask);
const int size = logger_buffer_size(mask);
/* Allocate a chunk of memory in the dump of the right size. */
size_t offset_new;
......@@ -338,7 +338,7 @@ void logger_log_gpart(const struct gpart *p, const unsigned int mask, size_t *of
void logger_log_timestamp(integertime_t timestamp, size_t *offset,
struct dump *dump) {
/* Start by computing the size of the message. */
const int size = logger_size(logger_mask_timestamp);
const int size = logger_buffer_size(logger_mask_timestamp);
/* Allocate a chunk of memory in the dump of the right size. */
size_t offset_new;
......@@ -360,9 +360,9 @@ void logger_log_timestamp(integertime_t timestamp, size_t *offset,
* @brief ensure that the input parameter logger size is large enough
*
* @param total_nr_nparts total number of particle
* @param logger_size requested file size upate
* @param logger_buffer_size requested file size upate
*/
void logger_ensure_size(size_t total_nr_parts, size_t logger_size) {
void logger_ensure_size(size_t total_nr_parts, size_t logger_buffer_size) {
size_t limit, i;
struct logger_const log_const;
logger_const_init(&log_const);
......@@ -377,7 +377,7 @@ void logger_ensure_size(size_t total_nr_parts, size_t logger_size) {
limit *= total_nr_parts;
if (logger_size < limit) error("Need a larger logger size");
if (logger_buffer_size < limit) error("Need a larger logger size");
logger_const_free(&log_const);
}
......
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