Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
superbenchmark
Commits
2bf01d5e
Commit
2bf01d5e
authored
Apr 18, 2026
by
one
Browse files
Format python code on branch dtk
parent
47d4a79d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
48 deletions
+78
-48
superbench/analyzer/metric_sorter.py
superbench/analyzer/metric_sorter.py
+0
-2
superbench/benchmarks/micro_benchmarks/gpu_hpcg_performance_base.py
.../benchmarks/micro_benchmarks/gpu_hpcg_performance_base.py
+18
-5
superbench/benchmarks/micro_benchmarks/gpu_stream.py
superbench/benchmarks/micro_benchmarks/gpu_stream.py
+39
-25
superbench/benchmarks/micro_benchmarks/kernel_launch_overhead.py
...nch/benchmarks/micro_benchmarks/kernel_launch_overhead.py
+6
-3
superbench/cli/_commands.py
superbench/cli/_commands.py
+1
-1
tests/runner/test_runner.py
tests/runner/test_runner.py
+14
-12
No files found.
superbench/analyzer/metric_sorter.py
View file @
2bf01d5e
...
...
@@ -10,7 +10,6 @@ plain string ordering.
import
re
_RCCL_PATTERN
=
re
.
compile
(
r
'^(?P<bench>rccl-bw(?::[^/]+)?)/(?P<op>[^_]+)_(?P<size>\d+)_(?P<suffix>.+?)(?::\d+)?$'
)
_HPCG_PATTERN
=
re
.
compile
(
r
'^(?P<bench>gpu-hpcg(?::[^/]+)?)/(?P<metric>.+?)(?::\d+)?$'
)
...
...
@@ -95,7 +94,6 @@ _SORTERS = (
def
sort_metrics
(
metrics
):
"""Sort metrics with benchmark-specific sorters and a stable default fallback."""
def
sort_key
(
metric_name
):
for
sorter
in
_SORTERS
:
key
=
sorter
(
metric_name
)
...
...
superbench/benchmarks/micro_benchmarks/gpu_hpcg_performance_base.py
View file @
2bf01d5e
...
...
@@ -14,11 +14,24 @@ from superbench.benchmarks.micro_benchmarks import MicroBenchmarkWithInvoke
class
GpuHpcgBenchmark
(
MicroBenchmarkWithInvoke
):
"""The GPU HPCG benchmark base class."""
_mpi_output_prefix_pattern
=
re
.
compile
(
r
'^\[\d+,\d+\]<(?:stdout|stderr)>:\s*'
)
_operation_metric_map
=
{
'DDOT'
:
'ddot'
,
'WAXPBY'
:
'waxpby'
,
'SpMV'
:
'spmv'
,
'MG'
:
'mg'
,
'Total'
:
'total'
,
'Final'
:
'final'
}
_time_metric_map
=
{
'Total Time'
:
'total_time'
,
'Setup Time'
:
'setup_time'
,
'Optimization Time'
:
'optimization_time'
}
_domain_metric_map
=
{
'Local domain'
:
'local_domain'
,
'Global domain'
:
'global_domain'
,
'Process domain'
:
'process_domain'
}
_operation_metric_map
=
{
'DDOT'
:
'ddot'
,
'WAXPBY'
:
'waxpby'
,
'SpMV'
:
'spmv'
,
'MG'
:
'mg'
,
'Total'
:
'total'
,
'Final'
:
'final'
}
_time_metric_map
=
{
'Total Time'
:
'total_time'
,
'Setup Time'
:
'setup_time'
,
'Optimization Time'
:
'optimization_time'
}
_domain_metric_map
=
{
'Local domain'
:
'local_domain'
,
'Global domain'
:
'global_domain'
,
'Process domain'
:
'process_domain'
}
_float_pattern
=
re
.
compile
(
r
'([0-9]+(?:\.[0-9]+)?)\s+(GFlop/s|GB/s)'
)
_dimension_pattern
=
re
.
compile
(
r
'([0-9]+)\s*x\s*([0-9]+)\s*x\s*([0-9]+)'
)
_time_value_pattern
=
re
.
compile
(
r
'([0-9]+(?:\.[0-9]+)?)\s+sec'
)
...
...
superbench/benchmarks/micro_benchmarks/gpu_stream.py
View file @
2bf01d5e
...
...
@@ -114,14 +114,18 @@ class GpuStreamBenchmark(MicroBenchmarkWithInvoke):
if
phase_name
in
self
.
_phase_metric_map
:
metric_tag
=
self
.
_phase_metric_map
[
phase_name
]
array_size
=
int
(
row
[
'n_elements'
])
phase_rows
.
append
({
'metric_name'
:
self
.
_get_phase_bw_metric_name
(
metric_tag
,
array_size
),
'value'
:
self
.
_mbps_to_gbps
(
row
[
'max_mbytes_per_sec'
]),
})
phase_rows
.
append
({
'metric_name'
:
self
.
_get_phase_time_metric_name
(
metric_tag
,
array_size
),
'value'
:
float
(
row
[
'runtime'
]),
})
phase_rows
.
append
(
{
'metric_name'
:
self
.
_get_phase_bw_metric_name
(
metric_tag
,
array_size
),
'value'
:
self
.
_mbps_to_gbps
(
row
[
'max_mbytes_per_sec'
]),
}
)
phase_rows
.
append
(
{
'metric_name'
:
self
.
_get_phase_time_metric_name
(
metric_tag
,
array_size
),
'value'
:
float
(
row
[
'runtime'
]),
}
)
if
not
phase_rows
:
raise
ValueError
(
'No valid phase rows found in CSV output.'
)
...
...
@@ -145,22 +149,30 @@ class GpuStreamBenchmark(MicroBenchmarkWithInvoke):
if
function_name
in
self
.
_function_metric_map
:
metric_tag
=
self
.
_function_metric_map
[
function_name
]
array_size
=
int
(
row
[
'n_elements'
])
function_rows
.
append
({
'metric_name'
:
self
.
_get_function_bw_metric_name
(
metric_tag
,
array_size
),
'value'
:
self
.
_mbps_to_gbps
(
row
[
'max_mbytes_per_sec'
]),
})
function_rows
.
append
({
'metric_name'
:
self
.
_get_function_time_metric_name
(
metric_tag
,
array_size
,
'min'
),
'value'
:
float
(
row
[
'min_runtime'
]),
})
function_rows
.
append
({
'metric_name'
:
self
.
_get_function_time_metric_name
(
metric_tag
,
array_size
,
'max'
),
'value'
:
float
(
row
[
'max_runtime'
]),
})
function_rows
.
append
({
'metric_name'
:
self
.
_get_function_time_metric_name
(
metric_tag
,
array_size
,
'avg'
),
'value'
:
float
(
row
[
'avg_runtime'
]),
})
function_rows
.
append
(
{
'metric_name'
:
self
.
_get_function_bw_metric_name
(
metric_tag
,
array_size
),
'value'
:
self
.
_mbps_to_gbps
(
row
[
'max_mbytes_per_sec'
]),
}
)
function_rows
.
append
(
{
'metric_name'
:
self
.
_get_function_time_metric_name
(
metric_tag
,
array_size
,
'min'
),
'value'
:
float
(
row
[
'min_runtime'
]),
}
)
function_rows
.
append
(
{
'metric_name'
:
self
.
_get_function_time_metric_name
(
metric_tag
,
array_size
,
'max'
),
'value'
:
float
(
row
[
'max_runtime'
]),
}
)
function_rows
.
append
(
{
'metric_name'
:
self
.
_get_function_time_metric_name
(
metric_tag
,
array_size
,
'avg'
),
'value'
:
float
(
row
[
'avg_runtime'
]),
}
)
if
not
function_rows
:
raise
ValueError
(
'No valid function rows found in CSV output.'
)
...
...
@@ -188,7 +200,9 @@ class GpuStreamBenchmark(MicroBenchmarkWithInvoke):
metric_width
=
max
(
len
(
metric
[
'metric_name'
])
for
metric
in
metrics
)
output_lines
=
[
'Device: {}'
.
format
(
device_name
)]
for
metric
in
metrics
:
output_lines
.
append
(
'{:<{width}} {:.6f}'
.
format
(
metric
[
'metric_name'
],
metric
[
'value'
],
width
=
metric_width
))
output_lines
.
append
(
'{:<{width}} {:.6f}'
.
format
(
metric
[
'metric_name'
],
metric
[
'value'
],
width
=
metric_width
)
)
return
output_lines
def
_get_text_output_header
(
self
):
...
...
superbench/benchmarks/micro_benchmarks/kernel_launch_overhead.py
View file @
2bf01d5e
...
...
@@ -84,7 +84,9 @@ class KernelLaunch(MicroBenchmarkWithInvoke):
self
.
_result
.
add_raw_data
(
'raw_output_'
+
str
(
cmd_idx
),
raw_output
,
self
.
_args
.
log_raw_data
)
result
=
{}
pattern
=
re
.
compile
(
r
'^(e2e_latency_us|host_dispatch_us|launch_throughput_mkps|device_launch_us):\s*(-?\d+(?:\.\d+)?)$'
)
pattern
=
re
.
compile
(
r
'^(e2e_latency_us|host_dispatch_us|launch_throughput_mkps|device_launch_us):\s*(-?\d+(?:\.\d+)?)$'
)
for
line
in
raw_output
.
splitlines
():
match
=
pattern
.
match
(
line
.
strip
())
if
match
:
...
...
@@ -92,8 +94,9 @@ class KernelLaunch(MicroBenchmarkWithInvoke):
if
set
(
result
.
keys
())
!=
set
(
self
.
_metric_names
):
logger
.
error
(
'Cannot extract kernel launch benchmark metrics - round: {}, benchmark: {}, raw data: {}.'
.
format
(
self
.
_curr_run_index
,
self
.
_name
,
raw_output
)
'Cannot extract kernel launch benchmark metrics - round: {}, benchmark: {}, raw data: {}.'
.
format
(
self
.
_curr_run_index
,
self
.
_name
,
raw_output
)
)
return
False
...
...
superbench/cli/_commands.py
View file @
2bf01d5e
...
...
@@ -44,7 +44,7 @@ class SuperBenchCommandsLoader(CLICommandsLoader):
ac
.
argument
(
'docker_image'
,
options_list
=
(
'--docker-image'
,
'-i'
),
type
=
str
,
help
=
'Docker image URI.'
)
ac
.
argument
(
'container_name'
,
options_list
=
(
'--container-name'
,),
options_list
=
(
'--container-name'
,
),
type
=
str
,
help
=
'Docker container name. Defaults to sb-workspace.'
)
...
...
tests/runner/test_runner.py
View file @
2bf01d5e
...
...
@@ -546,18 +546,20 @@ class RunnerTestCase(unittest.TestCase):
return
{
'module_args'
:
cmd
,
'cmdline'
:
''
,
'host_pattern'
:
'localhost'
,
'module'
:
'shell'
}
self
.
runner
.
_ansible_client
.
get_shell_config
=
fake_get_shell_config
mode
=
OmegaConf
.
create
({
'name'
:
'mpi'
,
'proc_num'
:
4
,
'node_num'
:
1
,
'bind_to'
:
'numa'
,
'mca'
:
{},
'env'
:
{
'NCCL_BUFFSIZE'
:
4194304
,
'NCCL_RINGS'
:
'0 1 2 3|0 3 2 1'
,
'PATH'
:
None
,
},
})
mode
=
OmegaConf
.
create
(
{
'name'
:
'mpi'
,
'proc_num'
:
4
,
'node_num'
:
1
,
'bind_to'
:
'numa'
,
'mca'
:
{},
'env'
:
{
'NCCL_BUFFSIZE'
:
4194304
,
'NCCL_RINGS'
:
'0 1 2 3|0 3 2 1'
,
'PATH'
:
None
,
},
}
)
self
.
runner
.
_run_proc
(
'foo'
,
mode
,
{
'proc_rank'
:
0
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment