Skip to content
Snippets Groups Projects
dashboard_list.py 6.43 KiB
Newer Older
Christoph Alt's avatar
Christoph Alt committed
from typing import List

from dashboards.dashboard_base import (DashboardOptions,
                                       build_row_repeat_dashboard,
                                       get_dashboard_variable_query)
from dashboards.influx_queries import Query, join_variable_and, show_tag_values


def _uniform_grid(arch: str, group_by: List[str]):
    dataSource = 'InfluxDB-1'
    measurment_name = f'UniformGrid{arch}'
    row_repeat = "collisionSetup"
    panel_repeat = "host"
    unit = 'MLUPs per Process'

    row_repeat_var = get_dashboard_variable_query(row_repeat,
                                                  show_tag_values(measurment_name, row_repeat),
                                                  dataSource)
    panel_repeat_var = get_dashboard_variable_query(panel_repeat,
                                                    show_tag_values(measurment_name, panel_repeat),
                                                    dataSource)
    other_filter = 'cellsPerBlock_0'
    cellsPerBlock_var = get_dashboard_variable_query(other_filter,
                                                     show_tag_values(measurment_name, other_filter),
                                                     dataSource
                                                     )
    where = join_variable_and([row_repeat, panel_repeat, other_filter])
    query = Query(
        select_='mlupsPerProcess',
        from_=measurment_name,
        where_=where,
        group_by=group_by
    )
    options = DashboardOptions(
        title=f'Uniform Grid {arch}',
        description=f"Benchmark dashboard for the Uniform Grid {arch} Benchmark from walberla",
        tags=[
            arch,
            'benchmark',
            'walberla',
            'Uniform Grid'
        ],
        timezone="browser",
    )
    return build_row_repeat_dashboard(options,
                                      row_repeat_var,
                                      panel_repeat_var,
                                      dataSource,
                                      measurment_name,
                                      query,
                                      unit,
                                      [cellsPerBlock_var]
                                      )


def dashboard_uniformGridGPU():
    group_by = ["blocks_0",
                "blocks_1",
                "blocks_2",
                "cellsPerBlock_0",
                "cellsPerBlock_1",
                "cellsPerBlock_2",
                "gpuBlockSize_0",
                "gpuBlockSize_1",
                "gpuBlockSize_2",
                "collisionSetup",
                "stencil",
                "streamingPattern",
                ]

    return _uniform_grid("GPU", group_by)


def dashboard_uniformGridCPU():
    group_by = ["blocks_0",
                "blocks_1",
                "blocks_2",
                "cellsPerBlock_0",
                "cellsPerBlock_1",
                "cellsPerBlock_2",
                "periodic_0",
                "periodic_1",
                "periodic_2",
                "collisionSetup",
                "mpi_num_processes",
                "streamingPattern",
                "timeStepStrategy",
                "stencil",
                ]

    return _uniform_grid("CPU", group_by)


def dashboard_granular_gas():
    dataSource = 'InfluxDB-1'
    measurment_name = 'MESA_PD_KernelBenchmark'
    row_repeat = "kernel"
    panel_repeat = "host"
    unit = 'ms'

    row_repeat_var = get_dashboard_variable_query(row_repeat,
                                                  f"SHOW FIELD KEYS FROM {measurment_name}",
                                                  dataSource)
    panel_repeat_var = get_dashboard_variable_query(panel_repeat,
                                                    show_tag_values(measurment_name, panel_repeat),
                                                    dataSource)
    query = Query(
        select_='$kernel',
        from_=measurment_name,
        where_=f'"{panel_repeat}" =~ /^${panel_repeat}$/',
        group_by=['mpi_num_processes', 'omp_max_threads'])
    options = DashboardOptions(
        title='Granular Gas Kernel Benchmark',
        description="Benchmark dashboard for the Granular Gas Benchmark from walberla",
        tags=[
            'CPU',
            'benchmark',
            'walberla',
            'Granular Gas'
        ],
        timezone="browser",
    )
    return build_row_repeat_dashboard(options,
                                      row_repeat_var,
                                      panel_repeat_var,
                                      dataSource,
                                      measurment_name,
                                      query,
                                      unit)


def dashboard_phasefieldallenchan():
    dataSource = 'InfluxDB-1'
    measurment_name = 'PhaseFieldAllenCahn'
    row_repeat = "cellsPerBlock_0"
    panel_repeat = "host"
    unit = 'MLUPs per Process'

    options = DashboardOptions(
        title='Phase Field Allen Chan',
        description="Benchmark dashboard for the Phasefield Allen Cahn Benchmark from walberla",
        tags=[
            'CPU',
            'benchmark',
            'walberla',
            'PhaseField Allen Cahn'
        ],
        timezone="browser",
    )
    row_repeat_var = get_dashboard_variable_query(row_repeat,
                                                  show_tag_values(measurment_name, row_repeat),
                                                  dataSource)
    panel_repeat_var = get_dashboard_variable_query(panel_repeat,
                                                    show_tag_values(measurment_name, panel_repeat),
                                                    dataSource)
    query = Query(
        select_='mlupsPerProcess',
        from_=measurment_name,
        where_=join_variable_and([row_repeat, panel_repeat]),
        group_by=[
            "blocks_0",
            "blocks_1",
            "blocks_2",
            "cellsPerBlock_0",
            "mpi_num_processes",
            "host",
            "executable",
            "timeStepStrategy",
            "stencil_phase",
            "stencil_hydro"
        ]
    )

    return build_row_repeat_dashboard(options,
                                      row_repeat_var,
                                      panel_repeat_var,
                                      dataSource,
                                      measurment_name,
                                      query,
                                      unit)