From 4e976b5653f6ca876d856bd244b743e8c5c61c3a Mon Sep 17 00:00:00 2001 From: shiquanyu Date: Wed, 29 Dec 2021 19:48:54 +0800 Subject: [PATCH] Use syncMemcpy --- deployment/tensorrt/main.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/deployment/tensorrt/main.cpp b/deployment/tensorrt/main.cpp index 31cd0080..67312917 100644 --- a/deployment/tensorrt/main.cpp +++ b/deployment/tensorrt/main.cpp @@ -325,33 +325,29 @@ std::vector YOLOv5Detector::detect(cv::Mat& image) { for (int32_t i = 1; i < engine->getNbBindings(); i++) { if (i == detection_boxes_index) { - CHECK(cudaMemcpyAsync( + CHECK(cudaMemcpy( detection_boxes.data(), buffers[detection_boxes_index], detection_boxes.size() * getElementSize(engine->getBindingDataType(i)), - cudaMemcpyDeviceToHost, - stream)); + cudaMemcpyDeviceToHost)); } else if (i == detection_scores_index) { - CHECK(cudaMemcpyAsync( + CHECK(cudaMemcpy( detection_scores.data(), buffers[detection_scores_index], detection_scores.size() * getElementSize(engine->getBindingDataType(i)), - cudaMemcpyDeviceToHost, - stream)); + cudaMemcpyDeviceToHost)); } else if (i == detection_labels_index) { - CHECK(cudaMemcpyAsync( + CHECK(cudaMemcpy( detection_labels.data(), buffers[detection_labels_index], detection_labels.size() * getElementSize(engine->getBindingDataType(i)), - cudaMemcpyDeviceToHost, - stream)); + cudaMemcpyDeviceToHost)); } else if (i == num_detections_index) { - CHECK(cudaMemcpyAsync( + CHECK(cudaMemcpy( &num_detections, buffers[num_detections_index], getElementSize(engine->getBindingDataType(i)), - cudaMemcpyDeviceToHost, - stream)); + cudaMemcpyDeviceToHost)); } }