|
YAC 3.21.0
Yet Another Coupler
|
#include <mpi.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <stdarg.h>#include <sys/stat.h>#include <unistd.h>#include <errno.h>#include <limits.h>#include <time.h>#include "config.h"#include "yac_config.h"#include "yac_pak.h"#include "yac_assert.h"#include "yac_mpi_common.h"#include "ensure_array_size.h"#include "utils_core.h"#include "utils_common.h"#include "io_utils.h"
Go to the source code of this file.
Data Structures | |
| struct | yac_pak_timer_t |
| struct | yac_pak_event_info_t |
| struct | yac_pak_open_event_t |
| struct | yac_pak_str_t |
| struct | yac_pak_trace_entry_t |
| struct | yac_pak |
Macros | |
| #define | YAC_PAK_TRACE_ENV "YAC_PAK_TRACE" |
| #define | YAC_PAK_TRACE_LEVEL_ENV "YAC_PAK_TRACE_LEVEL" |
| #define | YAC_PAK_TRACE_SETUP_ENV "YAC_PAK_TRACE_SETUP" |
| #define | YAC_PAK_TRACE_CAPACITY_ENV "YAC_PAK_TRACE_CAPACITY" |
| #define | YAC_PAK_TRACE_DIR_ENV "YAC_PAK_TRACE_DIR" |
| #define | YAC_PAK_TRACE_STRIDE_ENV "YAC_PAK_TRACE_STRIDE" |
| #define | YAC_PAK_TRACE_FLUSH_TIME_ENV "YAC_PAK_TRACE_FLUSH_TIME" |
| #define | YAC_PAK_TRACE_CONFIG_ENV "YAC_PAK_TRACE_CONFIG" |
| #define | YAC_PAK_TRACE_WRITE_MODE_ENV "YAC_PAK_TRACE_WRITE_MODE" |
| #define | YAC_PAK_TRACE_VERBOSE_ENV "YAC_PAK_TRACE_VERBOSE" |
Enumerations | |
| enum | { YAC_PAK_TRACE_CAPACITY_DEFAULT = 4096 , YAC_PAK_TRACE_CAPACITY_MIN = 1 } |
| enum | yac_pak_output_mode_t { YAC_PAK_OUTPUT_FILE_PER_RANK } |
| enum | yac_pak_trace_write_mode_t { YAC_PAK_TRACE_WRITE_AT_FINALIZE , YAC_PAK_TRACE_WRITE_INSTANT } |
Functions | |
| DEF_NAME_TYPE_PAIRS (yac_pak_event_type_pairs, DEF_NAME_TYPE_PAIR(INIT, YAC_PAK_EVENT_TYPE_INIT), DEF_NAME_TYPE_PAIR(DEF_COMP, YAC_PAK_EVENT_TYPE_DEF_COMP), DEF_NAME_TYPE_PAIR(SYNC_DEF, YAC_PAK_EVENT_TYPE_SYNC_DEF), DEF_NAME_TYPE_PAIR(ENDDEF, YAC_PAK_EVENT_TYPE_ENDDEF), DEF_NAME_TYPE_PAIR(FINALIZE, YAC_PAK_EVENT_TYPE_FINALIZE), DEF_NAME_TYPE_PAIR(GET, YAC_PAK_EVENT_TYPE_GET), DEF_NAME_TYPE_PAIR(AGET, YAC_PAK_EVENT_TYPE_AGET), DEF_NAME_TYPE_PAIR(PUT, YAC_PAK_EVENT_TYPE_PUT), DEF_NAME_TYPE_PAIR(REGION, YAC_PAK_EVENT_TYPE_REGION), DEF_NAME_TYPE_PAIR(UPDATE, YAC_PAK_EVENT_TYPE_UPDATE), DEF_NAME_TYPE_PAIR(WAIT, YAC_PAK_EVENT_TYPE_WAIT)) | |
| static int | yac_pak_event_type_is_setup (yac_pak_event_type_t type) |
| DEF_NAME_TYPE_PAIRS (yac_pak_trace_write_mode_pairs, DEF_NAME_TYPE_PAIR(at_finalize, YAC_PAK_TRACE_WRITE_AT_FINALIZE), DEF_NAME_TYPE_PAIR(instant, YAC_PAK_TRACE_WRITE_INSTANT)) | |
| static int | directory_exists (char const *path) |
| static char const * | get_component_name (struct yac_pak const *pak) |
| static int | compute_is_writer (struct yac_pak const *pak) |
| static void | pak_make_trace_dir (char const *path, int verbose) |
| static char * | build_output_path_per_rank (struct yac_pak const *pak, char const *suffix, int rank) |
| static void | str_appendf (yac_pak_str_t *str, char const *fmt,...) __attribute__((format(printf |
| static void | append_trace_header (yac_pak_str_t *str, struct yac_pak const *pak, double flush_dur) |
| static void | append_trace_row (yac_pak_str_t *str, struct yac_pak const *pak, yac_pak_trace_entry_t const *entry, int in_progress) |
| static void | write_trace_row (FILE *out, struct yac_pak const *pak, yac_pak_trace_entry_t const *entry, int in_progress) |
| static void | write_metadata_json_file (struct yac_pak const *pak, double flush_dur_rank0) |
| static void | yac_pak_setup_trace_dir (struct yac_pak *pak) |
| static size_t | get_finished_event_idx (struct yac_pak *pak) |
| static size_t | get_open_event_idx (struct yac_pak *pak) |
| static void | rewrite_open_file (struct yac_pak *pak) |
| static void | write_trace_row_instant (struct yac_pak *pak, yac_pak_trace_entry_t const *entry) |
| static void | rename_open_file (struct yac_pak const *pak, char **path, char const *suffix) |
| static void | set_component_name (struct yac_pak *pak, char const *component) |
| static void | open_instant_files (struct yac_pak *pak) |
| static void | rewrite_instant_header (struct yac_pak *pak) |
| static void | discard_instant_files (struct yac_pak *pak) |
| static void | release_open_event (struct yac_pak *pak, size_t handle) |
| struct yac_pak * | yac_pak_new (MPI_Comm comm, int capacity) |
| Construct a new YAC PAK object. | |
| void | yac_pak_delete (struct yac_pak *pak) |
| Destroy a YAC PAK object. | |
| int | yac_pak_trace_is_enabled (struct yac_pak const *pak) |
| Event tracing support. | |
| int | yac_pak_setup_trace_is_enabled (struct yac_pak const *pak) |
| Check whether setup-phase tracing is active. | |
| int | yac_pak_region_trace_is_enabled (struct yac_pak const *pak, yac_pak_trace_level_t level) |
| Check whether region events at a given trace level will be recorded. | |
| char const * | yac_pak_get_config_output_path (struct yac_pak const *pak) |
| Return the coupling configuration output file path if enabled. | |
| void | yac_pak_set_component (struct yac_pak *pak, char const *comp_name, int comp_rank, int comp_size) |
| Set the component this process belongs to. | |
| int | yac_pak_trace_start_setup (struct yac_pak *pak, char const *name, yac_pak_event_type_t type) |
| Setup-phase event tracing. | |
| int | yac_pak_trace_record (struct yac_pak *pak, char const *field, char const *component, char const *grid, yac_pak_event_type_t type, double tstart, double tend) |
| Record a complete trace entry with explicit timestamps. | |
| int | yac_pak_trace_start_ex (struct yac_pak *pak, char const *field, char const *component, char const *grid, yac_pak_event_type_t type, int put_idx, char const *datetime, int action, yac_pak_trace_level_t level) |
| Start a trace event with full metadata. | |
| int | yac_pak_trace_stop (struct yac_pak *pak, int handle) |
| Stop a trace event. | |
| int | yac_pak_flush_trace (struct yac_pak *pak) |
| Flush trace data to disk. | |
| int | yac_pak_register (struct yac_pak *pak, char const *name) |
| Register a named timer. | |
| int | yac_pak_start (struct yac_pak *pak, int idx) |
| Start a registered timer. | |
| int | yac_pak_stop (struct yac_pak *pak, int idx) |
| Stop a registered timer. | |
| int | yac_pak_report (struct yac_pak *pak, FILE *out) |
| Generate collective timer report. | |
| #define YAC_PAK_TRACE_CAPACITY_ENV "YAC_PAK_TRACE_CAPACITY" |
| #define YAC_PAK_TRACE_FLUSH_TIME_ENV "YAC_PAK_TRACE_FLUSH_TIME" |
| #define YAC_PAK_TRACE_WRITE_MODE_ENV "YAC_PAK_TRACE_WRITE_MODE" |
| anonymous enum |
|
static |
Append the comment header and the column names of a trace file.
| [in,out] | str | Growing string |
| [in] | pak | YAC PAK object |
| [in] | flush_dur | Flush duration to report, negative to omit it |
Definition at line 327 of file yac_pak.c.


|
static |
Append one event row.
Single definition of the row format, so that the buffered and the instant write path cannot drift apart.
| [in,out] | str | Growing string |
| [in] | pak | YAC PAK object |
| [in] | entry | Event to render |
| [in] | in_progress | Event has started but not ended: the tend and duration columns are left empty |
Definition at line 362 of file yac_pak.c.


|
static |
|
static |
| DEF_NAME_TYPE_PAIRS | ( | yac_pak_event_type_pairs | , |
| DEF_NAME_TYPE_PAIR(INIT, YAC_PAK_EVENT_TYPE_INIT) | , | ||
| DEF_NAME_TYPE_PAIR(DEF_COMP, YAC_PAK_EVENT_TYPE_DEF_COMP) | , | ||
| DEF_NAME_TYPE_PAIR(SYNC_DEF, YAC_PAK_EVENT_TYPE_SYNC_DEF) | , | ||
| DEF_NAME_TYPE_PAIR(ENDDEF, YAC_PAK_EVENT_TYPE_ENDDEF) | , | ||
| DEF_NAME_TYPE_PAIR(FINALIZE, YAC_PAK_EVENT_TYPE_FINALIZE) | , | ||
| DEF_NAME_TYPE_PAIR(GET, YAC_PAK_EVENT_TYPE_GET) | , | ||
| DEF_NAME_TYPE_PAIR(AGET, YAC_PAK_EVENT_TYPE_AGET) | , | ||
| DEF_NAME_TYPE_PAIR(PUT, YAC_PAK_EVENT_TYPE_PUT) | , | ||
| DEF_NAME_TYPE_PAIR(REGION, YAC_PAK_EVENT_TYPE_REGION) | , | ||
| DEF_NAME_TYPE_PAIR(UPDATE, YAC_PAK_EVENT_TYPE_UPDATE) | , | ||
| DEF_NAME_TYPE_PAIR(WAIT, YAC_PAK_EVENT_TYPE_WAIT) | ) |
| DEF_NAME_TYPE_PAIRS | ( | yac_pak_trace_write_mode_pairs | , |
| DEF_NAME_TYPE_PAIR(at_finalize, YAC_PAK_TRACE_WRITE_AT_FINALIZE) | , | ||
| DEF_NAME_TYPE_PAIR(instant, YAC_PAK_TRACE_WRITE_INSTANT) | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Rename an open file to the current component name. The descriptor keeps pointing at the same file.
| [in] | pak | YAC PAK object |
| [in,out] | path | Path of the file, updated to the new name |
| [in] | suffix | File name suffix, e.g. ".csv" |
Definition at line 616 of file yac_pak.c.


|
static |
|
static |
Rewrite the companion/debug file listing the events in progress.
The file is rewritten from scratch on every event start and end, so it always shows what this rank is doing right now. If the run hangs, its contents are the operations it is stuck in, a clean shutdown removes it.
Definition at line 565 of file yac_pak.c.


|
static |
Take the component name from the first event that carries one.
Later events may name a different component (a rank can serve several); only the first one names the files. The component of an individual event is always in its own "component" column.
In write mode "instant" the files were created before any component was defined, they still carry the placeholder name and are renamed here.
Definition at line 638 of file yac_pak.c.


|
static |
Append printf-style output to a growing heap string.
The string starts out empty (zero) and grows as needed, so no caller has to think about buffer sizes. Release it with free(str->buf).
| [in,out] | str | Growing string |
| [in] | fmt | printf-style format string |
Definition at line 303 of file yac_pak.c.

|
static |
|
static |
|
static |
|
static |