Benchmark: Revision - Add wait time option to resolve mem-bw unstable issue (#438)

**Description**
Add wait time option to resolve mem-bw unstable issue.
This commit is contained in:
Yuting Jiang 2022-12-14 17:21:02 +08:00 коммит произвёл GitHub
Родитель 1deb2eaa29
Коммит 6583ba2e40
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 24 добавлений и 0 удалений

Просмотреть файл

@ -33,6 +33,13 @@ class CudaMemBwBenchmark(MemBwBenchmark):
default=False,
help='Enable shmoo mode for bandwidthtest.',
)
self._parser.add_argument(
'--sleep',
type=int,
default=0,
required=False,
help='The seconds will be sleeped between each bandwidthtest command.',
)
def _preprocess(self):
"""Preprocess/preparation operations before the benchmarking.
@ -52,6 +59,8 @@ class CudaMemBwBenchmark(MemBwBenchmark):
if self._args.memory == 'pinned':
command += ' memory=pinned'
command += ' --csv'
if self._args.sleep != 0:
command += f' && sleep {self._args.sleep}'
self._commands.append(command)
return True

Просмотреть файл

@ -57,3 +57,18 @@ class CudaMemBwTest(BenchmarkTestCase, unittest.TestCase):
assert (metric in benchmark.result)
assert (len(benchmark.result[metric]) == 1)
assert (isinstance(benchmark.result[metric][0], numbers.Number))
benchmark = benchmark_class(benchmark_name, parameters='--memory=pinned --sleep 3')
ret = benchmark._preprocess()
assert (ret is True)
assert (benchmark.return_code == ReturnCode.SUCCESS)
# Check command list
expected_command = [
'bandwidthTest --htod memory=pinned --csv && sleep 3',
'bandwidthTest --dtoh memory=pinned --csv && sleep 3', 'bandwidthTest --dtod memory=pinned --csv && sleep 3'
]
for i in range(len(expected_command)):
command = benchmark._bin_name + benchmark._commands[i].split(benchmark._bin_name)[1]
assert (command == expected_command[i])