|
YAC 3.21.0
Yet Another Coupler
|
Lightweight per-rank event tracing tool. More...
Macros | |
| #define | YAC_PAK_VERSION_MAJOR 0 |
| #define | YAC_PAK_VERSION_MINOR 1 |
| #define | YAC_PAK_VERSION_PATCH 2 |
| #define | YAC_PAK_VERSION_STRING "0.1.2" |
Enumerations | |
| enum | yac_pak_event_type_t { YAC_PAK_EVENT_TYPE_INIT = 0 , YAC_PAK_EVENT_TYPE_DEF_COMP , YAC_PAK_EVENT_TYPE_SYNC_DEF , YAC_PAK_EVENT_TYPE_ENDDEF , YAC_PAK_EVENT_TYPE_FINALIZE , YAC_PAK_EVENT_TYPE_GET , YAC_PAK_EVENT_TYPE_AGET , YAC_PAK_EVENT_TYPE_PUT , YAC_PAK_EVENT_TYPE_REGION , YAC_PAK_EVENT_TYPE_UPDATE , YAC_PAK_EVENT_TYPE_WAIT } |
| Event type for YAC PAK trace entries. Defines the type of events that can be recorded in YAC PAK traces. More... | |
| enum | yac_pak_trace_level_t { YAC_PAK_TRACE_LEVEL_OFF = 0 , YAC_PAK_TRACE_LEVEL_COUPLING = 1 , YAC_PAK_TRACE_LEVEL_REGIONS = 2 , YAC_PAK_TRACE_LEVEL_MAX = YAC_PAK_TRACE_LEVEL_REGIONS } |
| YAC PAK coupling trace level. More... | |
Functions | |
| 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_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. | |
| 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_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_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_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. | |
| 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. | |
| 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. | |
Lightweight per-rank event tracing tool.
YAC PAK provides tools for event tracing, detecting load imbalances and performance analysis. It supports:
All interface routines take a struct yac_pak pointer as their first argument. Passing NULL is safe and results in a no-op.
For usage details, see YAC PAK Tracing Guide.
| #define YAC_PAK_VERSION_MAJOR 0 |
| enum yac_pak_event_type_t |
Event type for YAC PAK trace entries. Defines the type of events that can be recorded in YAC PAK traces.
YAC PAK coupling trace level.
The value of YAC_PAK_TRACE_LEVEL and equivalently the category of a coupling event, are gated together (event level <= setting). It is a coarse level, not a nesting depth (nesting depth is separate and unbounded). Setup-phase events are gated separately by YAC_PAK_TRACE_SETUP, independent of this level (see yac_pak_trace_start_ex).
| void yac_pak_delete | ( | struct yac_pak * | pak | ) |
Destroy a YAC PAK object.
Frees all allocated memory and flushes pending traces (if autoflush is enabled). Safe to call with NULL.
| [in] | pak | YAC PAK object to destroy (may be NULL) |
Definition at line 847 of file yac_pak.c.


| int yac_pak_flush_trace | ( | struct yac_pak * | pak | ) |
Flush trace data to disk.
Writes accumulated trace events to per-rank CSV files in the configured output directory. Each rank that passes the stride gate writes independently (not collective). Rank 0 always writes and additionally generates trace_metadata.json.
After flushing, the local event buffer is cleared and can be reused.
| [in] | pak | YAC PAK object (no-op if NULL) |
Definition at line 1092 of file yac_pak.c.


| char const * yac_pak_get_config_output_path | ( | struct yac_pak const * | pak | ) |
Return the coupling configuration output file path if enabled.
Return coupling configuration file output path when YAC_PAK_TRACE=1 and YAC_PAK_TRACE_CONFIG=1 are both set. Otherwise NULL is returned. The returned string is owned by the YAC PAK object and must not be freed by the caller.
| [in] | pak | YAC PAK object (returns NULL if NULL) |
Definition at line 925 of file yac_pak.c.

| struct yac_pak * yac_pak_new | ( | MPI_Comm | comm, |
| int | capacity ) |
Construct a new YAC PAK object.
Allocates and initialises the performance analysis infrastructure.
| [in] | comm | MPI communicator to use (must not be MPI_COMM_NULL) |
| [in] | capacity | Event buffer capacity (if > 0, overrides YAC_PAK_TRACE_CAPACITY environment variable) |
NULL unless YAC_PAK_TRACE=1 Definition at line 737 of file yac_pak.c.


| 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.
Lets callers skip setting up region instrumentation when the resulting events would be discarded anyway.
| [in] | pak | YAC PAK object (returns 0 if NULL) |
| [in] | level | Event category (see yac_pak_trace_level_t), e.g. YAC_PAK_TRACE_LEVEL_REGIONS |
level would be recorded, 0 otherwise Definition at line 913 of file yac_pak.c.

| int yac_pak_register | ( | struct yac_pak * | pak, |
| char const * | name ) |
Register a named timer.
Registers a new performance timer. Must be called collectively on all ranks in the same order to ensure consistent timer indices (TODO: expand and test).
| [in] | pak | YAC PAK object (no-op if NULL) |
| [in] | name | Name of the timer (will be duplicated internally) |
Definition at line 1151 of file yac_pak.c.

| int yac_pak_report | ( | struct yac_pak * | pak, |
| FILE * | out ) |
Generate collective timer report.
Computes and prints global statistics (sum, min, max, average, count) for all registered timers. Output is written by rank 0 only (TODO: expand and test).
| [in] | pak | YAC PAK object (no-op if NULL) |
| [in] | out | Output stream (uses stdout if NULL) |
| 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.
Called once the components are known. Name, rank and size are set together, so that the trace file name and YAC_PAK_TRACE_STRIDE always refer to the same component. May be called only once and has to be called before any traced event that carries a component name.
Without this call the component name is taken from the first traced event that carries one (yac_pak_unknown if there is none) and the stride is applied within the communicator.
| [in] | pak | YAC PAK object (no-op if NULL) |
| [in] | comp_name | Name of the component (non-empty) |
| [in] | comp_rank | Rank within the component |
| [in] | comp_size | Number of ranks of the component |
Definition at line 929 of file yac_pak.c.


| int yac_pak_setup_trace_is_enabled | ( | struct yac_pak const * | pak | ) |
Check whether setup-phase tracing is active.
Returns non-zero only when both the main trace flag (YAC_PAK_TRACE=1) and the setup flag (YAC_PAK_TRACE_SETUP=1) are set. Use this as the guard for level-0 (setup-phase) trace calls such as those in yac_cinit, yac_cdef_comp, yac_csync_def, yac_cenddef, and yac_cfinalize.
| [in] | pak | YAC PAK object (returns 0 if NULL) |
Definition at line 909 of file yac_pak.c.

| int yac_pak_start | ( | struct yac_pak * | pak, |
| int | idx ) |
Start a registered timer.
Starts timing for a previously registered timer. Local operation (TODO: expand and test).
| [in] | pak | YAC PAK object (no-op if NULL) |
| [in] | idx | Timer index returned by yac_pak_register() |
| int yac_pak_stop | ( | struct yac_pak * | pak, |
| int | idx ) |
Stop a registered timer.
Stops timing for a running timer and accumulates the elapsed time. Local operation (TODO: expand and test).
| [in] | pak | YAC PAK object (no-op if NULL) |
| [in] | idx | Timer index returned by yac_pak_register() |
| int yac_pak_trace_is_enabled | ( | struct yac_pak const * | pak | ) |
Event tracing support.
YAC PAK can record detailed per-rank event timelines for coupling operations. Traces include field name, component, grid, event type, timestamps, and coupling metadata.
YAC_PAK_TRACE=0|1: Enable tracing (default: 0)YAC_PAK_TRACE_LEVEL=0|1|2: Coupling trace level (default: 1). Level 0 records no coupling events (setup-phase events are still recorded if YAC_PAK_TRACE_SETUP=1); level 1 records PUT/GET/AGET/UPDATE/WAIT; level 2 additionally records nested interpolation/compute regions (and any deeper nesting).YAC_PAK_TRACE_SETUP=0|1: Additionally record lifecycle events (INIT, DEF_COMP, SYNC_DEF, ENDDEF, FINALIZE) together with the setup-phase regions (distributed grid pair generation, process sphere part generation) (default: 0)YAC_PAK_TRACE_CAPACITY=<n>: In-memory event buffer size per rank (default: 4096). Buffer grows automatically; aborts on OOM.YAC_PAK_TRACE_DIR=<path>: Output directory (default: auto-generated as traces_YYYYMMDD_HHMMSS_N<number_of_processes>_v<YAC_PAK_VERSION>/)YAC_PAK_TRACE_STRIDE=<n>: Write only every n-th rank of each component, counted within the component (default: 1, the first rank of every component always writes)YAC_PAK_TRACE_FLUSH_TIME=0|1: Include flush_duration_s in trace metadata (default: 1)YAC_PAK_TRACE_AUTOFLUSH=0|1: Automatically flush traces at finalize (default: 1)YAC_PAK_TRACE_CONFIG=0|1: Store coupling configuration in trace (default: 0) (requires YAC_PAK_TRACE=1)YAC_PAK_TRACE_WRITE_MODE=at_finalize|instant: When event rows are written (default: at_finalize). instant writes each event as it ends and lists the events in progress in <component>_r<rank>.open.YAC_PAK_TRACE_VERBOSE=0|1: Print progress messages (trace directory, files written) to stderr (default: 0)Each rank writes a CSV file: <dir>/<component>_r<rank>.csv
Rank 0 additionally writes trace_metadata.json with run-level information.
Query tracing status
Checks whether event tracing is currently enabled.
| [in] | pak | YAC PAK object (returns 0 if NULL) |
Definition at line 905 of file yac_pak.c.

| 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.
Records a trace event with pre-determined start and end times. Useful for tracing operations where timing needs to be captured before the YAC PAK object's trace buffers are fully set up (INIT event).
| [in] | pak | YAC PAK object (no-op if NULL) |
| [in] | field | Name of the field or operation (may be NULL) |
| [in] | component | Component name (may be NULL) |
| [in] | grid | Grid name (may be NULL) |
| [in] | type | Event type (e.g. YAC_PAK_EVENT_TYPE_INIT) |
| [in] | tstart | Start timestamp (MPI_Wtime()) |
| [in] | tend | End timestamp (MPI_Wtime()) |
Definition at line 979 of file yac_pak.c.


| 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.
Records the start of a coupling or setup event with detailed metadata. Returns a handle for later use with yac_pak_trace_stop().
| [in] | pak | YAC PAK object (returns -1 if NULL) |
| [in] | field | Name of the field being communicated (may be NULL) |
| [in] | component | Component name (may be NULL) |
| [in] | grid | Grid name (may be NULL) |
| [in] | type | Event type ("PUT", "GET", "AGET", "UPDATE", "WAIT", "REGION", "INIT", "DEF_COMP", "SYNC_DEF", "ENDDEF", "FINALIZE") |
| [in] | put_idx | Per-put index for source operations (-1 for GET or aggregated PUT; TODO: implement when needed) |
| [in] | datetime | ISO 8601 datetime string of the coupling step (may be NULL). For WAIT this is the step of the exchange being completed, not the current one. |
| [in] | action | Coupling action as integer (0=NONE, 1=REDUCTION, 2=COUPLING, 3=RESTART, -1=unknown) |
| [in] | level | Coupling level of the event (see yac_pak_trace_level_t), recorded when level <= YAC_PAK_TRACE_LEVEL. Ignored for setup-phase event types (INIT, DEF_COMP, SYNC_DEF, ENDDEF, FINALIZE; gated by YAC_PAK_TRACE_SETUP). |
level <= YAC_PAK_TRACE_LEVEL; setting YAC_PAK_TRACE_LEVEL=2 records level-2 (nested) events in addition to level-1 events. Definition at line 1017 of file yac_pak.c.


| int yac_pak_trace_start_setup | ( | struct yac_pak * | pak, |
| char const * | name, | ||
| yac_pak_event_type_t | type ) |
Setup-phase event tracing.
Setup-phase tracing records YAC lifecycle events: INIT, DEF_COMP, SYNC_DEF, ENDDEF, FINALIZE. Controlled by the YAC_PAK_TRACE_SETUP environment variable.
Setup traces:
Start a setup-phase trace event
Convenience wrapper around yac_pak_trace_start_ex() for setup-phase events (level=0). Setup events carry no field, grid, component, put_idx, or datetime; this function fills those with the appropriate NULL/-1 defaults so callers need not repeat them.
| [in] | pak | YAC PAK object (returns -1 if NULL) |
| [in] | name | Operation name (e.g. "yac_enddef") |
| [in] | type | Event type (e.g. YAC_PAK_EVENT_TYPE_ENDDEF) |
YAC_PAK_TRACE=1 and YAC_PAK_TRACE_SETUP=1 are set. Definition at line 972 of file yac_pak.c.


| int yac_pak_trace_stop | ( | struct yac_pak * | pak, |
| int | handle ) |
Stop a trace event.
Stops a trace event previously started with yac_pak_trace_start_ex(). Records the end timestamp and stores the complete entry in the trace buffer.
| [in] | pak | YAC PAK object (no-op if NULL) |
| [in] | handle | Event handle returned by yac_pak_trace_start_ex() |
Definition at line 1055 of file yac_pak.c.

