Unverified Commit 7af7c0b7 authored by Kirill Prosvirov's avatar Kirill Prosvirov Committed by GitHub
Browse files

Bug - Fix tensorrt-inference parsing (#674)

**Description**
Today I was running a benchmark on my machine. And encountered a fancy
issue with tensorrt-inference.
I got code 33, which according to the source code is:
```
MICROBENCHMARK_RESULT_PARSING_FAILURE = 33
```
I dived deep into the code and found out the following problem. The
parser stumbled upon getting to the following line:
```
[11/28/2024-17:03:11] [I] Latency: min = 7.2793 ms, max = 10.1606 ms, mean = 7.41642 ms, median = 7.39551 ms, percentile(99%) = 8 ms
```
I ran it separately on the code and found out that the regular
expression was not suitable for the cases like this, when you encounter
an INT as a result in milliseconds.
That's why this pull request is created.
I came up with the closest possible regular expression to fix this issue
and not to introduce any other bug.

**Major Revision**
- 0.11.0
parent b55279ad
...@@ -138,7 +138,7 @@ def _process_raw_result(self, cmd_idx, raw_output): ...@@ -138,7 +138,7 @@ def _process_raw_result(self, cmd_idx, raw_output):
line = line.strip() line = line.strip()
if '[I] mean:' in line or '[I] percentile:' in line: if '[I] mean:' in line or '[I] percentile:' in line:
tag = 'mean' if '[I] mean:' in line else '99' tag = 'mean' if '[I] mean:' in line else '99'
lats = re.findall(r'(\d+\.\d+) ms', line) lats = re.findall(r'(\d+\.*\d*) ms', line)
if len(lats) == 1: if len(lats) == 1:
self._result.add_result(f'{model}_gpu_time_{tag}', float(lats[0])) self._result.add_result(f'{model}_gpu_time_{tag}', float(lats[0]))
elif len(lats) == 2: elif len(lats) == 2:
...@@ -149,11 +149,11 @@ def _process_raw_result(self, cmd_idx, raw_output): ...@@ -149,11 +149,11 @@ def _process_raw_result(self, cmd_idx, raw_output):
tm = 'gpu' if '[I] GPU Compute Time:' in line else 'host' tm = 'gpu' if '[I] GPU Compute Time:' in line else 'host'
self._result.add_result( self._result.add_result(
f'{model}_{tm}_time_mean', f'{model}_{tm}_time_mean',
float(re.findall(r'mean = (\d+\.\d+) ms', line)[0]), float(re.findall(r'mean = (\d+\.*\d*) ms', line)[0]),
) )
self._result.add_result( self._result.add_result(
f'{model}_{tm}_time_99', f'{model}_{tm}_time_99',
float(re.findall(r'\(99\%\) = (\d+\.\d+) ms', line)[0]), float(re.findall(r'\(99\%\) = (\d+\.*\d*) ms', line)[0]),
) )
success = True success = True
except BaseException as e: except BaseException as e:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment