Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions superbench/benchmarks/micro_benchmarks/cudnn_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def __init__(self, name, parameters=''):
'mode': 1
}, {
'name': 'cudnnConvolutionBackwardData',
'algo': 4,
'algo': 1,
'filterDims': [32, 128, 3, 3],
'inputType': 0,
'inputDims': [32, 32, 14, 14],
Expand Down Expand Up @@ -232,7 +232,7 @@ def __init__(self, name, parameters=''):
'tensorOp': False,
'inputType': 0,
'convType': 0,
'algo': 6
'algo': 1
}, {
'name': 'cudnnConvolutionForward',
'inputDims': [32, 128, 14, 14],
Expand Down
36 changes: 9 additions & 27 deletions tests/benchmarks/micro_benchmarks/test_cudnn_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

"""Tests for cudnn-functions benchmark."""

import math
import numbers

from tests.helper import decorator
Expand All @@ -16,34 +17,15 @@ def test_cudnn_functions():
context = BenchmarkRegistry.create_benchmark_context(
'cudnn-function', platform=Platform.CUDA, parameters='--num_warmup 10 --num_steps 10 --num_in_step 100'
)

assert (BenchmarkRegistry.is_benchmark_context_valid(context))

benchmark = BenchmarkRegistry.launch_benchmark(context)

# Check basic information.
assert (benchmark)
assert (benchmark.name == 'cudnn-function')
assert (benchmark.type == BenchmarkType.MICRO)

# Check parameters specified in BenchmarkContext.
assert (benchmark._args.num_warmup == 10)
assert (benchmark._args.num_steps == 10)
assert (benchmark._args.num_in_step == 100)

# Check results and metrics.
assert (benchmark.run_count == 1)
assert (benchmark.return_code == ReturnCode.SUCCESS)
assert ('raw_output_0' in benchmark.raw_data)
assert (len(benchmark.raw_data['raw_output_0']) == 1)
assert (isinstance(benchmark.raw_data['raw_output_0'][0], str))

assert (18 <= len(benchmark.result))
for metric in list(benchmark.result.keys()):
assert (len(benchmark.result[metric]) == 1)
assert (isinstance(benchmark.result[metric][0], numbers.Number))
if metric != 'return_code':
assert (len(benchmark.raw_data[metric][0]) == benchmark._args.num_steps)
assert benchmark.return_code == ReturnCode.SUCCESS

timings = {metric: values for metric, values in benchmark.result.items() if metric.endswith('_time')}
assert len(timings) == 18
for metric, values in timings.items():
# Unsupported convolutions still emit a timing metric with value -1.
assert len(values) == 1 and 0 < values[0] < math.inf, metric
assert len(benchmark.raw_data[metric][0]) == benchmark._args.num_steps, metric

# Test for custom configuration
custom_config_str = '{"algo":0,"arrayLength":2,"convType":0,"dilationA":[1,1],"filterStrideA":[1,1],' \
Expand Down
Loading