Commit 7736f0f2 authored by lhausamm's avatar lhausamm Committed by Loic Hausammann
Browse files

make snapshot available with logger

parent 84ab98ec
...@@ -5628,9 +5628,8 @@ void engine_check_for_dumps(struct engine *e) { ...@@ -5628,9 +5628,8 @@ void engine_check_for_dumps(struct engine *e) {
engine_print_stats(e); engine_print_stats(e);
#ifdef WITH_LOGGER #ifdef WITH_LOGGER
engine_dump_index(e); engine_dump_index(e);
#else
engine_dump_snapshot(e);
#endif #endif
engine_dump_snapshot(e);
} else if (e->ti_next_stats < e->ti_next_snapshot) { } else if (e->ti_next_stats < e->ti_next_snapshot) {
...@@ -5662,9 +5661,8 @@ void engine_check_for_dumps(struct engine *e) { ...@@ -5662,9 +5661,8 @@ void engine_check_for_dumps(struct engine *e) {
/* Dump snapshot */ /* Dump snapshot */
#ifdef WITH_LOGGER #ifdef WITH_LOGGER
engine_dump_index(e); engine_dump_index(e);
#else
engine_dump_snapshot(e);
#endif #endif
engine_dump_snapshot(e);
} else if (e->ti_next_stats > e->ti_next_snapshot) { } else if (e->ti_next_stats > e->ti_next_snapshot) {
...@@ -5684,9 +5682,8 @@ void engine_check_for_dumps(struct engine *e) { ...@@ -5684,9 +5682,8 @@ void engine_check_for_dumps(struct engine *e) {
/* Dump snapshot */ /* Dump snapshot */
#ifdef WITH_LOGGER #ifdef WITH_LOGGER
engine_dump_index(e); engine_dump_index(e);
#else
engine_dump_snapshot(e);
#endif #endif
engine_dump_snapshot(e);
/* Let's fake that we are at the stats dump time */ /* Let's fake that we are at the stats dump time */
e->ti_current = e->ti_next_stats; e->ti_current = e->ti_next_stats;
...@@ -5723,9 +5720,8 @@ void engine_check_for_dumps(struct engine *e) { ...@@ -5723,9 +5720,8 @@ void engine_check_for_dumps(struct engine *e) {
/* Dump... */ /* Dump... */
#ifdef WITH_LOGGER #ifdef WITH_LOGGER
engine_dump_index(e); engine_dump_index(e);
#else
engine_dump_snapshot(e);
#endif #endif
engine_dump_snapshot(e);
/* ... and find the next output time */ /* ... and find the next output time */
engine_compute_next_snapshot_time(e); engine_compute_next_snapshot_time(e);
......
...@@ -326,7 +326,7 @@ struct engine { ...@@ -326,7 +326,7 @@ struct engine {
size_t logger_time_offset; size_t logger_time_offset;
/* Size of the dump file */ /* Size of the dump file */
size_t logger_size; size_t logger_buffer_size;
#endif #endif
/* Need to dump a snapshot ? */ /* Need to dump a snapshot ? */
......
...@@ -61,7 +61,7 @@ const unsigned int logger_data_size[logger_data_count] = { ...@@ -61,7 +61,7 @@ const unsigned int logger_data_size[logger_data_count] = {
* *
* @return updated buff * @return updated buff
*/ */
__attribute__((always_inline)) INLINE static char *logger_write_chunk_header(char *buff, const unsigned int *mask, const size_t *offset, const size_t offset_new) { char *logger_write_chunk_header(char *buff, const unsigned int *mask, const size_t *offset, const size_t offset_new) {
memcpy(buff, mask, logger_size_mask); memcpy(buff, mask, logger_size_mask);
buff += logger_size_mask; buff += logger_size_mask;
...@@ -129,7 +129,7 @@ void logger_write_general_data(struct dump *d, struct logger_const *log, size_t ...@@ -129,7 +129,7 @@ void logger_write_general_data(struct dump *d, struct logger_const *log, size_t
* *
* @return The size of the logger message in bytes. * @return The size of the logger message in bytes.
*/ */
int logger_size(unsigned int mask) { int logger_compute_chunk_size(unsigned int mask) {
/* Start with 8 bytes for the header. */ /* Start with 8 bytes for the header. */
int size = 8; int size = 8;
...@@ -208,7 +208,7 @@ void logger_log_part(const struct part *p, const unsigned int mask, size_t *offs ...@@ -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."); error("You should not log particles as timestamps.");
/* Start by computing the size of the message. */ /* Start by computing the size of the message. */
const int size = logger_buffer_size(mask); const int size = logger_compute_chunk_size(mask);
/* Allocate a chunk of memory in the dump of the right size. */ /* Allocate a chunk of memory in the dump of the right size. */
size_t offset_new; size_t offset_new;
...@@ -289,7 +289,7 @@ void logger_log_gpart(const struct gpart *p, const unsigned int mask, size_t *of ...@@ -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."); error("Can't log SPH quantities for gparts.");
/* Start by computing the size of the message. */ /* Start by computing the size of the message. */
const int size = logger_buffer_size(mask); const int size = logger_compute_chunk_size(mask);
/* Allocate a chunk of memory in the dump of the right size. */ /* Allocate a chunk of memory in the dump of the right size. */
size_t offset_new; size_t offset_new;
...@@ -338,7 +338,7 @@ void logger_log_gpart(const struct gpart *p, const unsigned int mask, size_t *of ...@@ -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, void logger_log_timestamp(integertime_t timestamp, size_t *offset,
struct dump *dump) { struct dump *dump) {
/* Start by computing the size of the message. */ /* Start by computing the size of the message. */
const int size = logger_buffer_size(logger_mask_timestamp); const int size = logger_compute_chunk_size(logger_mask_timestamp);
/* Allocate a chunk of memory in the dump of the right size. */ /* Allocate a chunk of memory in the dump of the right size. */
size_t offset_new; size_t offset_new;
......
...@@ -119,7 +119,7 @@ enum logger_datatype { ...@@ -119,7 +119,7 @@ enum logger_datatype {
extern const unsigned int logger_data_size[]; extern const unsigned int logger_data_size[];
/* Function prototypes. */ /* Function prototypes. */
int logger_size(unsigned int mask); int logger_compute_chunk_size(unsigned int mask);
void logger_log_all(struct part *p, void logger_log_all(struct part *p,
const long long Np, struct dump *dump); const long long Np, struct dump *dump);
void logger_log_part(const struct part *p, const unsigned int mask, size_t *offset, void logger_log_part(const struct part *p, const unsigned int mask, size_t *offset,
...@@ -135,7 +135,7 @@ int logger_read_timestamp(unsigned long long int *t, size_t *offset, ...@@ -135,7 +135,7 @@ int logger_read_timestamp(unsigned long long int *t, size_t *offset,
void logger_write_file_header(struct dump *dump, struct engine* e); void logger_write_file_header(struct dump *dump, struct engine* e);
void logger_const_init(struct logger_const* log_const); void logger_const_init(struct logger_const* log_const);
void logger_const_free(struct logger_const* log_const); void logger_const_free(struct logger_const* log_const);
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);
#endif /* WITH_LOGGER */ #endif /* WITH_LOGGER */
......
This diff is collapsed.
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
/* Config parameters. */ /* Config parameters. */
#include "../config.h" #include "../config.h"
#if defined(HAVE_HDF5) && !defined(WITH_MPI) && defined(WITH_LOGGER) #ifdef WITH_LOGGER
/* Includes. */ /* Includes. */
#include "engine.h" #include "engine.h"
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
/* Config parameters. */ /* Config parameters. */
#include "../config.h" #include "../config.h"
#if defined(HAVE_HDF5) && defined(WITH_MPI) && defined(HAVE_PARALLEL_HDF5) && !defined(WITH_LOGGER) #if defined(HAVE_HDF5) && defined(WITH_MPI) && defined(HAVE_PARALLEL_HDF5)
/* Some standard headers. */ /* Some standard headers. */
#include <hdf5.h> #include <hdf5.h>
......
...@@ -46,6 +46,13 @@ void write_output_parallel(struct engine* e, const char* baseName, ...@@ -46,6 +46,13 @@ void write_output_parallel(struct engine* e, const char* baseName,
const struct unit_system* snapshot_units, const struct unit_system* snapshot_units,
int mpi_rank, int mpi_size, MPI_Comm comm, int mpi_rank, int mpi_size, MPI_Comm comm,
MPI_Info info); MPI_Info info);
void writeArray(struct engine* e, hid_t grp, char* fileName, FILE* xmfFile,
char* partTypeGroupName, struct io_props props, size_t N,
long long N_total, int mpi_rank, long long offset,
const struct unit_system* internal_units,
const struct unit_system* snapshot_units);
#endif #endif
#endif /* SWIFT_PARALLEL_IO_H */ #endif /* SWIFT_PARALLEL_IO_H */
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
/* Config parameters. */ /* Config parameters. */
#include "../config.h" #include "../config.h"
#if defined(HAVE_HDF5) && defined(WITH_MPI) && !defined(HAVE_PARALLEL_HDF5) && !defined(WITH_LOGGER) #if defined(HAVE_HDF5) && defined(WITH_MPI) && !defined(HAVE_PARALLEL_HDF5)
/* Some standard headers. */ /* Some standard headers. */
#include <hdf5.h> #include <hdf5.h>
......
...@@ -48,6 +48,12 @@ void write_output_serial(struct engine* e, const char* baseName, ...@@ -48,6 +48,12 @@ void write_output_serial(struct engine* e, const char* baseName,
const struct unit_system* snapshot_units, int mpi_rank, const struct unit_system* snapshot_units, int mpi_rank,
int mpi_size, MPI_Comm comm, MPI_Info info); int mpi_size, MPI_Comm comm, MPI_Info info);
void writeArray(const struct engine* e, hid_t grp, char* fileName,
FILE* xmfFile, char* partTypeGroupName,
const struct io_props props, size_t N, long long N_total,
int mpi_rank, long long offset,
const struct unit_system* internal_units,
const struct unit_system* snapshot_units);
#endif #endif
#endif /* SWIFT_SERIAL_IO_H */ #endif /* SWIFT_SERIAL_IO_H */
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
/* Config parameters. */ /* Config parameters. */
#include "../config.h" #include "../config.h"
#if defined(HAVE_HDF5) && !defined(WITH_MPI) && !defined(WITH_LOGGER) #if defined(HAVE_HDF5) && !defined(WITH_MPI)
/* Some standard headers. */ /* Some standard headers. */
#include <hdf5.h> #include <hdf5.h>
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
/* Includes. */ /* Includes. */
#include "engine.h" #include "engine.h"
#include "io_properties.h"
#include "part.h" #include "part.h"
#include "units.h" #include "units.h"
...@@ -46,6 +47,10 @@ void write_index_single(struct engine* e, const char* baseName, ...@@ -46,6 +47,10 @@ void write_index_single(struct engine* e, const char* baseName,
const struct unit_system* internal_units, const struct unit_system* internal_units,
const struct unit_system* snapshot_units); const struct unit_system* snapshot_units);
#endif /* HAVE_HDF5 && !WITH_MPI */ void writeArray(const struct engine* e, hid_t grp, char* fileName,
FILE* xmfFile, char* partTypeGroupName,
const struct io_props props, size_t N,
const struct unit_system* internal_units,
const struct unit_system* snapshot_units);
#endif /* SWIFT_SINGLE_IO_H */ #endif /* SWIFT_SINGLE_IO_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