Skip to content

Commit a8016ff

Browse files
author
Anurag Dixit
committed
feat: Added comprehensive perf benchmark script
Signed-off-by: Anurag Dixit <[email protected]>
1 parent f2d1655 commit a8016ff

File tree

5 files changed

+237
-134
lines changed

5 files changed

+237
-134
lines changed

Diff for: examples/benchmark/py/README.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Performance Benchmarking
2+
3+
This is a comprehensive Python benchmark suite to run perf runs using different supported backends. Following backends are supported:
4+
5+
1. Torch
6+
2. Torch-TensorRT
7+
3. TensorRT
8+
9+
Note: Please note that for ONNX models, user can convert the ONNX model to TensorRT serialized engine and then use this package.
10+
11+
## Structure
12+
13+
```
14+
./
15+
├── config
16+
│ ├── vgg16_trt.yml
17+
│ └── vgg16.yml
18+
├── models
19+
├── perf_run.py
20+
└── README.md
21+
```
22+
23+
Please save your configuration files at config directory. Similarly, place your model files at models path.
24+
25+
## Usage
26+
27+
To run the benchmark for a given configuration file:
28+
29+
```
30+
python perf_run.py --config=config/vgg16.yml
31+
```
32+
33+
## Configuration
34+
35+
There are two sample configuration files added.
36+
37+
* vgg16.yml demonstrates a configuration with all the supported backends (Torch, Torch-TensorRT, TensorRT)
38+
* vgg16_trt.yml demonstrates how to use an external TensorRT serialized engine file directly.
39+
40+
41+
### Supported fields
42+
43+
| Name | Supported Values | Description |
44+
| --- | --- | --- |
45+
| backend | all, torch, torch_tensorrt, tensorrt | Supported backends for inference |
46+
| input | - | Input binding names. Expected to list shapes of each input bindings |
47+
| model | - | Configure the model filename and name |
48+
| filename | - | Model file name to load from disk |
49+
| name | - | Model name |
50+
| runtime | - | Runtime configurations |
51+
| device | 0 | Target device ID to run inference. Range depends on available GPUs |
52+
| precision | fp32, fp16 or half, int8 | Target precision to run inference |
53+
54+
55+
Additional sample use case:
56+
57+
```
58+
backend:
59+
- torch
60+
- torch_tensorrt
61+
- tensorrt
62+
input:
63+
input0:
64+
- 3
65+
- 224
66+
- 224
67+
num_of_input: 1
68+
model:
69+
filename: model.plan
70+
name: vgg16
71+
runtime:
72+
device: 0
73+
precision:
74+
- fp32
75+
- fp16
76+
```

Diff for: examples/benchmark/py/config/vgg16.yml

100644100755
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
backend:
3-
- torch
4-
- torch_tensorrt
3+
- all
54
input:
65
input0:
76
- 1

Diff for: examples/benchmark/py/config/vgg16_trt.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
backend:
3+
- tensorrt
4+
input:
5+
input0:
6+
- 3
7+
- 224
8+
- 224
9+
num_of_input: 1
10+
model:
11+
filename: model.plan
12+
name: vgg16
13+
runtime:
14+
device: 0
15+
precision:
16+
- fp32
17+
- fp16

Diff for: examples/benchmark/py/models/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)