# scope_profiler.plotting_scripts.roofline

*module*

Roofline analysis from LIKWID FLOP-rate and memory-bandwidth metrics.

LIKWID reports its derived metrics per participating hardware thread.  A
region's point therefore sums those rates: a parallel region that sustains
``20 GFLOP/s`` on each of four cores belongs at ``80 GFLOP/s``, not at their
mean.  Arithmetic intensity is then ``GFLOP/s / GB/s`` and is numerically
identical to FLOP/byte.

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/plotting_scripts/roofline.py#L1-L1)

## scope_profiler.plotting_scripts.roofline.collect_roofline_points

*function*

```python
def collect_roofline_points(profiling_data: ProfilingResults | Sequence[ProfilingResults], *, flops_metric: str | None = None, bandwidth_metric: str | None = None, ranks: list[int] | int | None = None, include: list[str] | str | None = None, exclude: list[str] | str | None = None) -> list[dict]
```

Derive one roofline point per selected LIKWID region and rank.

``flops_metric`` and ``bandwidth_metric`` select exact LIKWID derived
metric names.  When omitted, the first names containing ``FLOP/s`` and
``bandwidth`` respectively are selected for each region.  Supplying exact
names is recommended when a group offers both single- and double-precision
FLOP rates.

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/plotting_scripts/roofline.py#L94-L153)

## scope_profiler.plotting_scripts.roofline.plot_roofline

*function*

```python
def plot_roofline(profiling_data: ProfilingResults | Sequence[ProfilingResults], *, flops_metric: str | None = None, bandwidth_metric: str | None = None, peak_flops: float | None = None, peak_bandwidth: float | None = None, ranks: list[int] | int | None = None, include: list[str] | str | None = None, exclude: list[str] | str | None = None, filepath: str | None = None, show: bool = False, verbose: bool = True, cmap: str = DEFAULT_CMAP, data_filepath: str | Path | None = None, data_format: str = 'csv', backend: str = 'matplotlib') -> dict
```

Plot attained performance against arithmetic intensity for LIKWID regions.

``peak_flops`` (GFLOP/s) and ``peak_bandwidth`` (GB/s) should be measured
hardware ceilings for a true roofline.  If either is absent, the largest
selected observation supplies that ceiling and the plot labels it
*empirical*; it is useful for comparing regions but must not be read as a
machine limit.

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/plotting_scripts/roofline.py#L187-L301)
