from typing import List from dashboards.units import Units from dashboards.dashboard_base import (DashboardOptions, build_dashboard, build_row_repeat_dashboard, get_dashboard_variable_query, get_grid_pos, get_stat_panel, pack_in_row, get_annotation) from dashboards.influx_queries import (Query, get_variable_condition, join_conditions, 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 = Units.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", ) 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 = Units.milliseconds 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 = Units.mlups 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" ]) 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') dashboard = build_row_repeat_dashboard(options, row_repeat_var, panel_repeat_var, dataSource, measurment_name, query, unit) dashboard.rows = [ pack_in_row("Power Consumption", panel_power), *dashboard.rows ] annotation_query = "SELECT \"commit\" from( SELECT first(\"mlupsPerProcess\") FROM \"PhaseFieldAllenCahn\" WHERE host =~ /^$host$/ AND $timeFilter GROUP BY \"commit\" )" dashboard.annotations = get_annotation("InfluxDB-1", "red", "commits", annotation_query) return dashboard.auto_panel_ids() def dashboard_phasefieldallenchangpu(): dataSource = 'InfluxDB-1' measurment_name = 'PhaseFieldAllenCahnGPU' row_repeat = "cellsPerBlock_0" panel_repeat = "host" unit = Units.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" ]) return build_row_repeat_dashboard(options, row_repeat_var, panel_repeat_var, dataSource, measurment_name, query, unit) def dashboard_general_infos(): dataSource = 'InfluxDB-1' measurment_name = "JOB_INFOS" host_var = get_dashboard_variable_query('host', show_tag_values("", 'host'), dataSource) def get_query(name_base: str): return Query( select_="duration", from_=measurment_name, where_=join_conditions( [f'"name" =~ /{name_base}/', f'"name" =~ /${host_var.name}/'], "AND"), group_by=['name']) options = DashboardOptions( title='Overview', description="General Information about walberla benchmarks", tags=[ 'walberla', ], timezone="browser", ) panel_build = get_stat_panel("Build Times", dataSource, get_query("build"), gridPos=get_grid_pos(12, 24, 0, 0), format='s', alias="$tag_name") panel_benchmark = get_stat_panel("Benchmark Runtime", dataSource, get_query("benchmark"), gridPos=get_grid_pos(30, 24, 0, 13), format='s', alias="$tag_name") return build_dashboard(options, panels=[panel_build, panel_benchmark], templating=[host_var])