scope_profiler.inspection
CLI entry point for scope-profiler inspect: summarize a profiling file.
Prints the run metadata in full and a one-line-per-region overview of the
timing data, plus a LIKWID hardware-counter table per rank and event group
when the run recorded any, without producing any plots. The metadata can
also be exported to JSON, either from the CLI (--export-metadata) or
with :func:write_metadata_json.
Functions
| Name | Description |
|---|---|
build_parser | Build the argument parser for scope-profiler inspect. |
collect_file_metadata | Collect the run metadata of one or more profiling files. |
inspect_file | Print a summary of one profiling HDF5 file. |
main | Entry point for scope-profiler inspect. |
write_metadata_json | Write the run metadata of one or more profiling files to JSON. |
build_parserfunction#
def build_parser() -> argparse.ArgumentParserBuild the argument parser for scope-profiler inspect.
collect_file_metadatafunction#
def collect_file_metadata(profiling_data: ProfilingResults | str | Path | Sequence) -> dictCollect the run metadata of one or more profiling files.
Parameters
profiling_data : ProfilingResults, path, or sequence of either Files to read the metadata from.
Returns
dict
{"files": [{"file_path": ..., "num_ranks": ..., "metadata": {...}}]},
matching the envelope used by
:func:~scope_profiler.plotting_scripts.collect_region_statistics, so
a single document can describe several runs.
inspect_filefunction#
def inspect_file(file_path, include=None, exclude=None, ranks=None, sort: str = 'start', show_metadata: bool = True, show_regions: bool = True, full: bool = False, source: list | None = None, columns=None, percentage_mode: str = 'coverage', stream=None) -> NonePrint a summary of one profiling HDF5 file.
Parameters
file_path : str or Path
Merged profiling file to inspect.
include, exclude : list of str or str, optional
Regex patterns selecting which regions to report.
ranks : list of int, optional
Restrict the region statistics to these ranks (default: all).
sort : str, optional
Region ordering: one of total, calls, avg, max (all
descending) or name (alphabetical). Default: total.
show_metadata, show_regions : bool, optional
Sections to print (both default to True).
full : bool, optional
Print long metadata values in full instead of clipping them.
source : list of str, optional
Region names to print the captured call-site source of (the with
block or decorated function that defines each region - see
ProfileManager.profile_region and issue #161). Printed after the
region table, regardless of include/exclude.
columns : list of str or str, optional
Region summary columns to print. Defaults to region, calls,
percent, total and avg.
percentage_mode : {“coverage”, “exclusive”}, optional
Quantity used for % session. Defaults to wall-clock coverage.
stream : file-like, optional
Where to write (default: stdout).
mainfunction#
def main(argv: list | None = None)Entry point for scope-profiler inspect.
write_metadata_jsonfunction#
def write_metadata_json(profiling_data: ProfilingResults | str | Path | Sequence, filepath: str | Path) -> dictWrite the run metadata of one or more profiling files to JSON.
Parameters
profiling_data : ProfilingResults, path, or sequence of either Files to read the metadata from. filepath : str or Path Destination JSON file. Parent directories are created as needed.
Returns
dict
The payload that was written (see :func:collect_file_metadata).