from typing import List from dashboards.dashboard_base import (DashboardOptions, build_dashboard, build_row_repeat_dashboard, get_commit_annotation, get_dashboard_list, get_dashboard_variable_query, get_grid_pos, get_stat_panel, pack_in_row) from dashboards.influx_queries import (Query, get_variable_condition, join_conditions, join_variable_and, show_tag_values) from dashboards.legends import AxisLabel, Units def _uniform_grid(arch: str, group_by: List[str]): dataSource = 'InfluxDB-1' measurment_name = f'UniformGrid{arch}' row_repeat = "collisionSetup" panel_repeat = "host" unit = Units.number axisLabel = AxisLabel.mlups 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", ) annotations = get_commit_annotation("InfluxDB-1", "red", "commits", measurment_name) return build_row_repeat_dashboard(options, row_repeat_var, panel_repeat_var, dataSource, measurment_name, query, unit, axisLabel, [cellsPerBlock_var], annotations=annotations) 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 = Units.milliseconds axisLabel = AxisLabel.runtime 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", ) annotations = get_commit_annotation("InfluxDB-1", "red", "commits", measurment_name) return build_row_repeat_dashboard(options, row_repeat_var, panel_repeat_var, dataSource, measurment_name, query, unit, axisLabel, annotations=annotations) def dashboard_phasefieldallenchan(): dataSource = 'InfluxDB-1' measurment_name = 'PhaseFieldAllenCahn' row_repeat = "cellsPerBlock_0" panel_repeat = "host" unit = Units.number axisLabel = AxisLabel.mlups alias_tags = ["blocks_0", "blocks_1", "blocks_2", "mpi_num_processes", "timeStepStrategy"] # alias_descr = [ # *[f"Blocks in {chr(ord('x') + i)} dimension" for i in range(3)], # "Number of Processes", # "Timestep Strategy" # ] # # alias = build_alias(zip(alias_descr, alias_tags)) 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=[ *alias_tags, "cellsPerBlock_0", "host", "executable", "stencil_phase", "stencil_hydro" ]) power_query = Query(select_="Power Core [W]", from_="PhaseFieldAllenCahn_ENERGY", where_=get_variable_condition(panel_repeat)) panel_power = get_stat_panel("Total Power Consumption on $host in Watt[W]", dataSource, power_query, repeat=panel_repeat_var, format='W') annotations = get_commit_annotation("InfluxDB-1", "red", "commits", measurment_name) dashboard = build_row_repeat_dashboard(options, row_repeat_var, panel_repeat_var, dataSource, measurment_name, query, unit, axisLabel, annotations=annotations, ) dashboard.rows = [ pack_in_row("Power Consumption", panel_power), *dashboard.rows ] return dashboard.auto_panel_ids() def dashboard_phasefieldallenchangpu(): dataSource = 'InfluxDB-1' measurment_name = 'PhaseFieldAllenCahnGPU' row_repeat = "cellsPerBlock_0" panel_repeat = "host" unit = Units.number axisLabel = AxisLabel.mlups options = DashboardOptions( title='Phase Field Allen Chan GPU', description="Benchmark dashboard for the Phasefield Allen Cahn Benchmark from walberla", tags=['GPU', '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", "gpuBlockSize_0", "gpuBlockSize_1", "gpuBlockSize_2", "cellsPerBlock_0", "mpi_num_processes", "host", "executable", "timeStepStrategy", "stencil_phase", "stencil_hydro" ]) annotations = get_commit_annotation("InfluxDB-1", "red", "commits", measurment_name) return build_row_repeat_dashboard(options, row_repeat_var, panel_repeat_var, dataSource, measurment_name, query, unit, axisLabel, annotations=annotations) def dashboard_general_infos(): dataSource = 'InfluxDB-1' measurment_name = "JOB_INFOS" host_var = get_dashboard_variable_query('host', show_tag_values("", 'host'), dataSource) benchmark_var = get_dashboard_variable_query('benchmark', show_tag_values(measurment_name, 'name'), dataSource, regex="/benchmark_(.*)_[^_]+/") def get_query(name_base: str): conds = [f'"name" =~ /{name_base}/', f'"name" =~ /${host_var.name}/'] if name_base == "benchmark": conds.append(f'"name" =~ /${benchmark_var.name}/') return Query( select_="duration", from_=measurment_name, where_=join_conditions( conds, "AND"), group_by=['name']) options = DashboardOptions( title='Overview', description="General Information about walberla benchmarks", tags=[ 'walberla', ], timezone="browser", ) cpu_list = get_dashboard_list('CPU Benchmarks', ['walberla', 'CPU'], gridPos=get_grid_pos(10, 12, 0, 0)) gpu_list = get_dashboard_list('GPU Benchmarks', ['walberla', 'GPU'], gridPos=get_grid_pos(10, 12, 13, 0)) panel_build = get_stat_panel("Build Times", dataSource, get_query("build"), gridPos=get_grid_pos(12, 24, 0, 13), format='s', alias="$tag_name") panel_benchmark = get_stat_panel("Runtime $benchmark", dataSource, get_query("benchmark"), gridPos=get_grid_pos(10, 24, 0, 26), format='s', repeat=benchmark_var, alias="$tag_name", colorMode="background", maxPerRow=2) return build_dashboard(options, panels=[cpu_list, gpu_list, panel_build, panel_benchmark], templating=[host_var, benchmark_var])