[Suggestion] Why tensorrt backend uses trtexec instead of tensorrt python interface?
Maintainer thường phản hồi trong vòng 6 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- performance
Hướng nghiên cứu
Issue không nêu tên tệp, bài kiểm thử hoặc điểm vào nào. Hãy bắt đầu bằng cách xác định mã backend TensorRT gọi trtexec, sau đó so sánh luồng profiling và thực thi của mã này với ví dụ về giao diện Python; công việc được xem là hoàn tất khi hành vi profiling được yêu cầu và phạm vi thay thế đã được xác định và kiểm định.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
From my point of view, use python interface we can insert cudaprofilestart() and cudaprofilestop() to better prof our program, because if we use trtexec, superbench will start anothor thread to execute and nvprof can not correctly prof the real command, and, directly profile trtexec will prof the compilation progress and runtime progress, in most of the case, we only need the last one.
tensorrt python interface example:
import tensorrt as trt
import common
import time
import pycuda.driver as cuda
import torch
import os
TRT_LOGGER = trt.Logger()
def inference(context, test_data):
inputs, outputs, bindings, stream = common.allocate_buffers(context.engine)
result = []
inputs[0].host = test_data
_, elapsed_time = common.do_inference_v2(context, bindings=bindings, inputs=inputs, outputs=outputs, stream=stream)
return result, elapsed_time
# This function builds an engine from a Onnx model.
def build_engine(model_file, batch_size=32):
with trt.Builder(TRT_LOGGER) as builder, builder.create_network(common.EXPLICIT_BATCH) as network, trt.OnnxParser(network, TRT_LOGGER) as parser, builder.create_builder_config() as trt_config:
# Attention that, builder should be set to 1 because of the implementation of allocate_buffer
builder.max_batch_size = 1
# builder.max_workspace_size = common.GiB(1)
trt_config.max_workspace_size = common.GiB(4)
# Parse onnx model
with open(model_file, 'rb') as model:
if not parser.parse(model.read()):
print ('ERROR: Failed to parse the ONNX file.')
for error in range(parser.num_errors):
print (parser.get_error(error))
return None
# This design may not be correct if output more than one
"""
for i in range(network.num_layers):
layer = network.get_layer(i)
layer.precision = trt.int8
layer.set_output_type(0, trt.int8)
"""
# network.mark_output(model_tensors.find(ModelData.OUTPUT_NAME))
# Build engine and do int8 calibration.
# engine = builder.build_cuda_engine(network)
engine = builder.build_engine(network, trt_config)
return engine
onnx_path = "/workspace/v-leiwang3/benchmark/nnfusion_models/resnet50.float32.1.onnx"
dummy_input = torch.rand(1, 3, 224, 224).numpy()
engine = build_engine(onnx_path)
context = engine.create_execution_context()
# warmup
for i in range(5):
_, time = inference(context, dummy_input)
# iteration
time_set = []
for i in range(100):
_, time = inference(context, dummy_input)
time_set.append(time)
print(f'average time: {sum(time_set)/len(time_set)* 1000} ms')
- Ngôn ngữ chính
- Python
- Star
- 397
- Fork
- 91
- Merge trung bình
- 5 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/superbenchmark
-
Calling stop() multiple times or log() after stop() can cause errors in StdLoggerCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
microsoft/superbenchmark#708 · 1 reaction ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
microsoft/superbenchmark#772 · 1 reaction ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Official Docker image missing `bandwidthTest` binary for mem-bw benchmark in offline environmentsĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
microsoft/superbenchmark#766 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 6 ngày
-
NVBandwidth benchmark results parsing bugCó thể đã có người làm @NJX-njx đã nhận 229 ngày trước. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
microsoft/superbenchmark#748 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 6 ngày
-
V0.13.0 Release PlanCó thể làm lại được @guoshzhao đã nhận 342 ngày trước và không có pull request nào đang mở. Đang mở
microsoft/superbenchmark#743 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 6 ngày
Tất cả issue của microsoft/superbenchmark
Issue tương tự
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ianktoo/project-monitor#14 ·
-
A wrong descriptor checksum is refused with the right one, also for an xprv or WIF descriptorĐang mởsecurity
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
btclib-org/btclib-wallet#478 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
btclib-org/btclib#2727 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue lead variant:container
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
radialmonster/orf-cleanroom#10 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
gdsa opencode: keep-alive cleanup trap fails with 'keepalive_pid: unbound variable'Có thể đã có người làm @darribas đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100