Skip to content
Snippets Groups Projects
dashboard_fe2ti.py 5.68 KiB
from dashboards.dashboard_base import (DashboardOptions, build_dashboard,
                                       get_commit_annotation,
                                       get_dashboard_variable_query,
                                       pack_in_row,
                                       TimeSeries,
                                       get_influx_target,
                                       Repeat,
                                       get_color_regex_override,
                                       get_line_style_regex_override,
                                       get_text_panel)

from dashboards.influx_queries import (Query,
                                       join_variable_and,
                                       show_tag_values)
from dashboards.legends import Units
from collections import namedtuple

description_markdown = r"""

  - Linestyle indicates the compiler:
      - gcc -> dashed lines
      - intel -> full lines
  - Color indicates the solver:
      - pardiso -> green
      - umfpack -> yellow
      - ilu -> blue
  - benchmark setups:
      - fe2ti216: Domain size 2x2x2 solving all microproblems
      - fe2ti1728: Domain size 8x8x1 solving only 216 micro problems
  - List of generated plots can be found [https://www10.cs.fau.de/plots](https://www10.cs.fau.de/plots/)
  - All "raw" output files are uploaded to the [Kadi4Mat](https://kadi4mat.iam-cms.kit.edu/collections/1625)
  - Information about the different Hosts on the NHR@FAU [Testcluster](https://hpc.fau.de/systems-services/documentation-instructions/clusters/test-cluster/)

"""
Filter = namedtuple("Filter", ("name", "multi", "default_value"), defaults=('', True, ''))
PanelInfos = namedtuple("PanelInfos", ("name", "unit"))


def get_dashboard_variable(filter: Filter, measurment_name: str, data_source: str):
    query = show_tag_values(measurment_name, filter.name)
    kwargs = {}
    if filter.multi:
        kwargs.update({'includeAll': True, 'multi': True, })
    if filter.default_value:
        kwargs.update({'default': filter.default_value})
    return get_dashboard_variable_query(filter.name, query, data_source, **kwargs)


def get_time_series_panel(field: PanelInfos,
                          data_source: str,
                          measurment_name: str,
                          *,
                          where=None,
                          group_by=None,
                          overrides=None):
    query = Query(select_=field.name,
                  from_=measurment_name,
                  where_=where,
                  group_by=group_by)

    return TimeSeries(
        title=field.name,
        dataSource=data_source,
        targets=[get_influx_target(str(query))],
        unit=field.unit,
        pointSize=9,
        overrides=overrides,
    )


def dashboard_fe2ti():
    data_source = "fe2ti"
    measurment_name = "fe2ti"
    row_repeat = "micro_problem_size"
    other_filters = [
        Filter("micro_problem_size", True, '8'),
        Filter("host", False, 'skylakesp2'),
        Filter("branch"),
        Filter("benchmark_name"),
        Filter("compiler"),
        Filter("solver"),
        Filter("mpi_ranks"),
        Filter("omp_threads"),
        Filter("ksp_tol")
    ]

    other_vars = [get_dashboard_variable(filter, measurment_name, data_source) for filter in other_filters]
    row_repeat_var = other_vars[0]

    where = join_variable_and([f.name for f in other_filters])
    fields = [PanelInfos("Time to solution", Units.seconds),
              PanelInfos("DP [MFLOP/s] STAT Sum", Units.mflop_sec),
              PanelInfos("Operational intensity STAT Sum", Units.flop_per_byte),
              PanelInfos('AVX DP [MFLOP/s] STAT Sum" / "DP [MFLOP/s] STAT Sum', Units.percent),
              PanelInfos('Memory bandwidth [MBytes/s] STAT Sum', Units.mbytes_per_second),
              PanelInfos('Memory write bandwidth [MBytes/s] STAT Sum', Units.mbytes_per_second),
              PanelInfos('Memory read bandwidth [MBytes/s] STAT Sum', Units.mbytes_per_second),
              PanelInfos('Memory data volume [GBytes] STAT Sum', Units.gigabyte),
              PanelInfos('Memory read data volume [GBytes] STAT Sum', Units.gigabyte),
              PanelInfos('Memory write data volume [GBytes] STAT Sum', Units.gigabyte),
              PanelInfos('Energy [J] STAT Sum', Units.joule),
              PanelInfos('Power [W] STAT Sum', Units.watt),
              PanelInfos('Clock [MHz] STAT Avg', Units.megahertz), ]

    options = DashboardOptions(
        title="FE2ti Benchmarks",
        description="Benchmarks for fe2ti",
        tags=['benchmark', 'fe2ti'],
        timezone="browser",
    )
    annotations = get_commit_annotation(data_source, "red", "commits", measurment_name)

    overrides = [*[
        get_color_regex_override(f".*[Ss]olver.*: {solver}.*", color)
        for solver, color in [("pardiso", "#56A64B"), ("umfpack", "#F2CC0C"), ("ilu", "#3274D9")]
    ],
        get_line_style_regex_override(".*intel.*", "solid"),
        get_line_style_regex_override(".*gcc.*", "dashed")
    ]
    description_panel = pack_in_row("Legend", get_text_panel(description_markdown, title="FE2TI benchmarks"))

    panels = [
        get_time_series_panel(
            field,
            data_source,
            measurment_name,
            where=where,
            group_by=[f.name for f in other_filters],
            overrides=overrides,
        )
        for field in fields]

    row = pack_in_row(
        title=f"{row_repeat}: ${row_repeat_var.name}",
        panels=[*panels],
        repeat=Repeat('v', row_repeat_var.name),
    )
    return build_dashboard(options,
                           rows=[description_panel, row],
                           templating=[*other_vars],
                           annotations=annotations)