it maybe a tensorrt bug ,i try all model in those card like (3080 3080ti) ,infer will slower down ( all model i can get, tensorrt 7 ~ 8.4 )
infer speed will not slower down if the image in host memory in advance
but speed will slower down if image need load to host memory from disk
and cudnn infer will not slower down
code like :
startTime = std::chrono::high_resolution_clock::now();
context_->enqueue(input_shape_[0], buffers_, stream_, nullptr);
// context_->enqueueV2(buffers_, stream_, nullptr);
cudaStreamSynchronize(stream_);
if(count ){
auto endTime = std::chrono::high_resolution_clock::now();
totol_time_ += std::chrono::duration<float, std::milli>(endTime - startTime).count();
// totol_time_ += totalTime;
}
if(count % 10== 0){
AIDI_LOG(info)<<"averge time---------------------" << time.average_time(Timer::Unit::MilliSecond);
time.clear();
// AIDI_LOG(info)<<"averge time---------------------" << totol_time_ / count;
}
count++;
速度变化
[2022-08-02 12:18:22.244586] [0x0000a5a0] [info] [location_client.cpp(116)]: averge time---------------------1.63985
[2022-08-02 12:18:22.729808] [0x0000a5a0] [info] [location_client.cpp(116)]: averge time---------------------1.55214
[2022-08-02 12:18:23.159126] [0x0000a5a0] [info] [location_client.cpp(116)]: averge time---------------------1.51793
[2022-08-02 12:18:23.623376] [0x0000a5a0] [info] [location_client.cpp(116)]: averge time---------------------1.51454
[2022-08-02 12:18:24.032722] [0x0000a5a0] [info] [location_client.cpp(116)]: averge time---------------------1.64723
[2022-08-02 12:18:24.511941] [0x0000a5a0] [info] [location_client.cpp(116)]: averge time---------------------2.23529
[2022-08-02 12:18:24.980748] [0x0000a5a0] [info] [location_client.cpp(116)]: averge time---------------------2.72391
[2022-08-02 12:18:25.494937] [0x0000a5a0] [info] [location_client.cpp(116)]: averge time---------------------3.3516
[2022-08-02 12:18:25.962188] [0x0000a5a0] [info] [location_client.cpp(116)]: averge time---------------------4.00212
[2022-08-02 12:18:26.529281] [0x0000a5a0] [info] [location_client.cpp(116)]: averge time---------------------4.57732
[2022-08-02 12:18:27.690370] [0x0000a5a0] [info] [location_client.cpp(116)]: averge time---------------------5.48994
[2022-08-02 12:18:28.284459] [0x0000a5a0] [info] [location_client.cpp(116)]: averge time---------------------5.83345