aron.h
August 1, 2023, 4:03pm
1
Environment
• Hardware Platform (Jetson / GPU)
Jetson AGX Orin
• DeepStream Version
DeepStream 6.1
• JetPack Version (valid for Jetson only)
JetPack 5.0.2-b231
• TensorRT Version
TensorRT 8.4.1
• Issue Type( questions, new requirements, bugs)
Question
Description
We get cv::Mat frames using this OpenCV gstreamer pipeline:
filesrc location="./video.mp4" ! qtdemux ! h264parse ! queue ! nvv4l2decoder ! queue ! nvvideoconvert ! video/x-raw,format=BGRx ! videorate max-rate=30 ! videoscale ! video/x-raw,format=BGRx,width=1920,height=1080 ! queue ! videoconvert ! video/x-raw,format=BGR ! appsink
We specify a model using Yolov7::Yolov7
after which we pass the cv::Mat frames to Yolov7::preProcess
and then run Yolov7::infer
and Yolov7::PostProcess
.
The inference works and everything runs fine at this point (around 31 seconds to process a 31 second video).
When we then spin up another thread that does the same thing in parallel, the combined process takes around 6 seconds longer than with a single thread.
For every additional thread after that, there is an additional 20-25 second increase in processing time.
After further examination, the culprit lies somewhere within the method enqueueV2
mentioned in Yolov7.cpp
I traced it’s origin via NvInfer.h
and NvInferRuntime.h
to NvInferImpl.h
.
There the class class VExecutionContext : public VRoot
has the method
virtual bool enqueueV2(void* const* bindings, cudaStream_t stream, cudaEvent_t* inputConsumed) noexcept = 0;
From there I can’t find further information nor definition of how it works and why it would be slowing down the overall process.
Any idea of why this is happening?
Relevant Files
We are using the library called Yolov7 made by an Nvidia employee.
yuweiw
August 2, 2023, 7:48am
7
Could you attach the whole pipeline including the nvinfer part? You can also get the latency and memory loading by referring: memory latency .
aron.h
August 2, 2023, 8:11am
8
Here is a boiled down and hard coded vesion of what is relevant.
#include <opencv2/opencv.hpp>
#include "Yolov7.h"
int main()
{
Yolov7 yolov7("model.engine");
int frame_count = 0;
std::vector<std::vector<std::vector<float>>> nmsresults;
cv::VideoCapture cap = cv::VideoCapture("filesrc location=video.mp4 ! qtdemux ! h264parse ! queue ! nvv4l2decoder ! queue ! nvvideoconvert ! video/x-raw,format=BGRx ! videorate max-rate=30 ! videoscale ! video/x-raw,format=BGRx,width=1920,height=1080 ! queue ! videoconvert ! video/x-raw,format=BGR ! appsink", cv::CAP_GSTREAMER);
while (frame_count < 1000)
{
cv::Mat cap_mat;
std::vector<cv::Mat> cap_mat_vec;
cap >> cap_mat;
if (!cap_mat.data) { break; }
cap_mat_vec.push_back(cap_mat);
yolov7.preProcess(cap_mat_vec);
yolov7.infer();
nmsresults = yolov7.PostProcess();
cap_mat_vec.clear();
frame_count++;
}
cap.release();
return 0;
}
For the sake of expediting results, the following changes can be made to the Yolov7 library.
CMakeLists.txt lines 73 to 81:
Comment out the lines that mention add_executable
and target_link_libraries
for detect
, video_detect
and validate_coco
Yolov7.h Line 96:
Change static int Yolov::DrawBoxesonGraph(...
to static int DrawBoxesonGraph(...
aron.h
August 2, 2023, 9:14am
9
The exampe code above had some bugs, but they have been edited out now.
yuweiw
August 2, 2023, 10:57am
10
Could you get the information in your environment? Maybe the loading is too heavy when spin up another thread that does the same thing in parallel
.
aron.h
August 2, 2023, 6:15pm
11
Most of the measurements mentioned in that post assume that one is using deepstream sample apps.
That is not the case with us.
One of the posts suggested to download and run nvmemstat.py while running our application to get more information. After minor tweaking of the python script (a case of ‘.decode’ expecting a string, but getting an int),
I got this output from the above example code.
Next, I ran our own application with 1 input source.
PID: 10072 18:12:06 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 32326.2305 MiB VmRSS: 417.5469 MiB RssFile: 210.5898 MiB RssAnon: 215.2500 MiB lsof: 333
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:08 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 33105.4648 MiB VmRSS: 1341.4141 MiB RssFile: 558.8438 MiB RssAnon: 788.3398 MiB lsof: 627
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:10 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34296.9297 MiB VmRSS: 1889.7070 MiB RssFile: 861.2930 MiB RssAnon: 1028.4141 MiB lsof: 691
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:12 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34512.9414 MiB VmRSS: 1889.9648 MiB RssFile: 861.2930 MiB RssAnon: 1028.6719 MiB lsof: 691
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:13 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34512.9414 MiB VmRSS: 1890.6133 MiB RssFile: 861.6836 MiB RssAnon: 1028.9297 MiB lsof: 691
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:15 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34512.9414 MiB VmRSS: 1890.6133 MiB RssFile: 861.6836 MiB RssAnon: 1028.9297 MiB lsof: 691
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:17 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34512.9414 MiB VmRSS: 1890.6133 MiB RssFile: 861.6836 MiB RssAnon: 1028.9297 MiB lsof: 691
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:19 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34512.9414 MiB VmRSS: 1890.6133 MiB RssFile: 861.6836 MiB RssAnon: 1028.9297 MiB lsof: 691
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:21 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34512.9414 MiB VmRSS: 1890.6133 MiB RssFile: 861.6836 MiB RssAnon: 1028.9297 MiB lsof: 691
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:23 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34512.9414 MiB VmRSS: 1890.6133 MiB RssFile: 861.6836 MiB RssAnon: 1028.9297 MiB lsof: 691
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:24 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34512.9414 MiB VmRSS: 1890.6836 MiB RssFile: 861.6836 MiB RssAnon: 1029.0000 MiB lsof: 691
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:26 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34512.9414 MiB VmRSS: 1890.6836 MiB RssFile: 861.6836 MiB RssAnon: 1029.0000 MiB lsof: 691
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:28 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34512.9414 MiB VmRSS: 1890.6836 MiB RssFile: 861.6836 MiB RssAnon: 1029.0000 MiB lsof: 691
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:30 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34512.9414 MiB VmRSS: 1890.6836 MiB RssFile: 861.6836 MiB RssAnon: 1029.0000 MiB lsof: 691
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:32 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34512.9414 MiB VmRSS: 1890.6836 MiB RssFile: 861.6836 MiB RssAnon: 1029.0000 MiB lsof: 691
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:34 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34512.9414 MiB VmRSS: 1890.9414 MiB RssFile: 861.9141 MiB RssAnon: 1029.0273 MiB lsof: 691
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:36 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34512.9414 MiB VmRSS: 1890.9414 MiB RssFile: 861.9141 MiB RssAnon: 1029.0273 MiB lsof: 691
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:37 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34512.9414 MiB VmRSS: 1890.9414 MiB RssFile: 861.9141 MiB RssAnon: 1029.0273 MiB lsof: 691
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:39 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34512.9414 MiB VmRSS: 1892.9414 MiB RssFile: 861.9141 MiB RssAnon: 1031.0273 MiB lsof: 601
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 10072 18:12:41 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 34446.5312 MiB VmRSS: 1887.7344 MiB RssFile: 858.7930 MiB RssAnon: 1028.9414 MiB lsof: 580
Finally, I ran our own application with 6 input sources.
PID: 7742 18:07:09 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 32418.0156 MiB VmRSS: 574.6719 MiB RssFile: 273.9023 MiB RssAnon: 311.7773 MiB lsof: 333
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:11 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 33268.8281 MiB VmRSS: 1648.7930 MiB RssFile: 699.3789 MiB RssAnon: 963.2383 MiB lsof: 691
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:12 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 35008.2773 MiB VmRSS: 2112.4023 MiB RssFile: 867.4336 MiB RssAnon: 1246.9688 MiB lsof: 853
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:14 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 35871.0195 MiB VmRSS: 2215.6367 MiB RssFile: 879.3984 MiB RssAnon: 1338.2383 MiB lsof: 983
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:16 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37011.9453 MiB VmRSS: 2552.8047 MiB RssFile: 887.0625 MiB RssAnon: 1665.7422 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:18 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2515.2227 MiB RssFile: 892.1680 MiB RssAnon: 1623.0547 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:20 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2515.2227 MiB RssFile: 892.1680 MiB RssAnon: 1623.0547 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:22 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2515.9961 MiB RssFile: 892.1680 MiB RssAnon: 1623.8281 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:24 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2516.5117 MiB RssFile: 892.2617 MiB RssAnon: 1624.2500 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:26 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.0273 MiB RssFile: 892.2617 MiB RssAnon: 1624.7656 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:27 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.0273 MiB RssFile: 892.2617 MiB RssAnon: 1624.7656 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:29 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.5391 MiB RssFile: 892.2617 MiB RssAnon: 1625.2773 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:31 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.5391 MiB RssFile: 892.2617 MiB RssAnon: 1625.2773 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:33 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.5977 MiB RssFile: 892.2617 MiB RssAnon: 1625.3359 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:35 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.8516 MiB RssFile: 892.2617 MiB RssAnon: 1625.5898 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:37 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.8516 MiB RssFile: 892.2617 MiB RssAnon: 1625.5898 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:39 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.8516 MiB RssFile: 892.2617 MiB RssAnon: 1625.5898 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:41 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.8516 MiB RssFile: 892.2617 MiB RssAnon: 1625.5898 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:43 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.8516 MiB RssFile: 892.2617 MiB RssAnon: 1625.5898 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:44 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.8516 MiB RssFile: 892.2617 MiB RssAnon: 1625.5898 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:46 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.8516 MiB RssFile: 892.2617 MiB RssAnon: 1625.5898 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:48 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.8516 MiB RssFile: 892.2617 MiB RssAnon: 1625.5898 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:50 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.8516 MiB RssFile: 892.2617 MiB RssAnon: 1625.5898 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:52 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.8516 MiB RssFile: 892.2617 MiB RssAnon: 1625.5898 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:54 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.8516 MiB RssFile: 892.2617 MiB RssAnon: 1625.5898 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:56 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.8516 MiB RssFile: 892.2617 MiB RssAnon: 1625.5898 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:58 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.8516 MiB RssFile: 892.2617 MiB RssAnon: 1625.5898 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:07:59 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.8516 MiB RssFile: 892.2617 MiB RssAnon: 1625.5898 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:01 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.8516 MiB RssFile: 892.2617 MiB RssAnon: 1625.5898 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:03 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2517.8516 MiB RssFile: 892.2617 MiB RssAnon: 1625.5898 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:05 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.1094 MiB RssFile: 892.3320 MiB RssAnon: 1625.7773 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:07 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.1094 MiB RssFile: 892.3320 MiB RssAnon: 1625.7773 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:09 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.1094 MiB RssFile: 892.3320 MiB RssAnon: 1625.7773 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:11 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.1094 MiB RssFile: 892.3320 MiB RssAnon: 1625.7773 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:13 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.1094 MiB RssFile: 892.3320 MiB RssAnon: 1625.7773 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:15 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.3672 MiB RssFile: 892.3867 MiB RssAnon: 1625.9805 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:16 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.3672 MiB RssFile: 892.3867 MiB RssAnon: 1625.9805 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:18 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.6250 MiB RssFile: 892.3867 MiB RssAnon: 1626.2383 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:20 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.8828 MiB RssFile: 892.3867 MiB RssAnon: 1626.4961 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:22 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.8828 MiB RssFile: 892.3867 MiB RssAnon: 1626.4961 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:24 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.8828 MiB RssFile: 892.3867 MiB RssAnon: 1626.4961 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:26 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.8828 MiB RssFile: 892.3867 MiB RssAnon: 1626.4961 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:28 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.8828 MiB RssFile: 892.3867 MiB RssAnon: 1626.4961 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:30 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.8828 MiB RssFile: 892.3867 MiB RssAnon: 1626.4961 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:32 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.8828 MiB RssFile: 892.3867 MiB RssAnon: 1626.4961 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:33 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.8828 MiB RssFile: 892.3867 MiB RssAnon: 1626.4961 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:35 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.8828 MiB RssFile: 892.3867 MiB RssAnon: 1626.4961 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:37 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.8828 MiB RssFile: 892.3867 MiB RssAnon: 1626.4961 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:39 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.8828 MiB RssFile: 892.3867 MiB RssAnon: 1626.4961 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:41 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.8828 MiB RssFile: 892.3867 MiB RssAnon: 1626.4961 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:43 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.8828 MiB RssFile: 892.3867 MiB RssAnon: 1626.4961 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:45 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2518.8828 MiB RssFile: 892.3867 MiB RssAnon: 1626.4961 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:47 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2519.1406 MiB RssFile: 892.3867 MiB RssAnon: 1626.7539 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:48 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2519.1406 MiB RssFile: 892.3867 MiB RssAnon: 1626.7539 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:50 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2519.1406 MiB RssFile: 892.3867 MiB RssAnon: 1626.7539 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:52 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2519.1406 MiB RssFile: 892.3867 MiB RssAnon: 1626.7539 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:54 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2519.1406 MiB RssFile: 892.3867 MiB RssAnon: 1626.7539 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:56 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2519.1406 MiB RssFile: 892.3867 MiB RssAnon: 1626.7539 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:08:58 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2519.1406 MiB RssFile: 892.3867 MiB RssAnon: 1626.7539 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:09:00 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2519.1406 MiB RssFile: 892.3867 MiB RssAnon: 1626.7539 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:09:02 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2519.1406 MiB RssFile: 892.3867 MiB RssAnon: 1626.7539 MiB lsof: 1178
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:09:04 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2521.1445 MiB RssFile: 892.3867 MiB RssAnon: 1628.7578 MiB lsof: 1158
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:09:05 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37292.3828 MiB VmRSS: 2521.1445 MiB RssFile: 892.3867 MiB RssAnon: 1628.7578 MiB lsof: 1082
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:09:07 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37235.9570 MiB VmRSS: 2518.6719 MiB RssFile: 889.9492 MiB RssAnon: 1628.7227 MiB lsof: 1062
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:09:09 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37219.9492 MiB VmRSS: 2516.7227 MiB RssFile: 889.9492 MiB RssAnon: 1626.7734 MiB lsof: 1007
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:09:11 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 37131.5078 MiB VmRSS: 2464.6602 MiB RssFile: 887.4805 MiB RssAnon: 1577.1797 MiB lsof: 891
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:09:13 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 36970.6328 MiB VmRSS: 2413.1289 MiB RssFile: 882.3125 MiB RssAnon: 1530.8164 MiB lsof: 754
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:09:15 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 36783.7656 MiB VmRSS: 2305.4688 MiB RssFile: 876.4336 MiB RssAnon: 1429.0352 MiB lsof: 587
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:09:17 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 36783.7656 MiB VmRSS: 2305.4688 MiB RssFile: 876.4336 MiB RssAnon: 1429.0352 MiB lsof: 587
cat: /sys/kernel/debug/nvmap/iovmm/clients: No such file or directory
PID: 7742 18:09:18 Total used hardware memory: 0 hardware memory: 0.0000 KiB VmSize: 36783.7656 MiB VmRSS: 2305.4688 MiB RssFile: 876.4336 MiB RssAnon: 1429.0352 MiB lsof: 587
I am not sure what I should be looking for in these reports?
yuweiw
August 3, 2023, 3:03am
12
It’s werid that Total used hardware memory: 0 hardware memory: 0.0000 KiB
in your environment. As you said before, I traced it’s origin via NvInfer.h and NvInferRuntime.h to NvInferImpl.h.
. So the possible reason is that gpu loading is heavy. Below is the printing in my environment:
PID: 59003 10:56:11 Total used hardware memory: 1261736K hardware memory: 825.2676 MiB VmSize: 35084.5234 MiB VmRSS: 2940.2344 MiB RssFile: 1324.2695 MiB RssAnon: 1609.5273 MiB lsof: 743
Also could you describe how the code you posted works step by step and the specific time comparison data?
aron.h
August 3, 2023, 8:48am
13
I tried running the python script from outside our docker and with sudo priviliges.
This time, more information was showing.
I ran our own application with 1 input source.
PID: 2145718 09:29:18 Total used hardware memory: 195808K hardware memory: 193.1445 MiB VmSize: 32375.0156 MiB VmRSS: 495.5430 MiB RssFile: 236.0508 MiB RssAnon: 260.1133 MiB lsof: 332
PID: 2145718 09:29:20 Total used hardware memory: 375304K hardware memory: 366.4336 MiB VmSize: 32811.4609 MiB VmRSS: 802.2734 MiB RssFile: 310.1758 MiB RssAnon: 500.6055 MiB lsof: 356
PID: 2145718 09:29:21 Total used hardware memory: 869384K hardware memory: 848.9336 MiB VmSize: 33204.8164 MiB VmRSS: 1765.3125 MiB RssFile: 839.7852 MiB RssAnon: 925.5273 MiB lsof: 527
…
PID: 2145718 09:29:37 Total used hardware memory: 995588K hardware memory: 972.1797 MiB VmSize: 34650.9609 MiB VmRSS: 1888.3477 MiB RssFile: 862.2109 MiB RssAnon: 1026.1367 MiB lsof: 691
PID: 2145718 09:29:38 Total used hardware memory: 995588K hardware memory: 972.1797 MiB VmSize: 34650.9609 MiB VmRSS: 1888.6211 MiB RssFile: 862.2695 MiB RssAnon: 1026.3516 MiB lsof: 691
PID: 2145718 09:29:39 Total used hardware memory: 995588K hardware memory: 972.1797 MiB VmSize: 34650.9609 MiB VmRSS: 1888.6211 MiB RssFile: 862.2695 MiB RssAnon: 1026.3516 MiB lsof: 691
…
PID: 2145718 09:29:58 Total used hardware memory: 944156K hardware memory: 921.9531 MiB VmSize: 34584.5508 MiB VmRSS: 1887.7344 MiB RssFile: 859.1992 MiB RssAnon: 1028.5352 MiB lsof: 580
PID: 2145718 09:29:59 Total used hardware memory: 944156K hardware memory: 921.9531 MiB VmSize: 34584.5508 MiB VmRSS: 1887.7344 MiB RssFile: 859.1992 MiB RssAnon: 1028.5352 MiB lsof: 580
PID: 2145718 09:30:00 Total used hardware memory: 944156K hardware memory: 921.9531 MiB VmSize: 34584.5508 MiB VmRSS: 1887.7344 MiB RssFile: 859.1992 MiB RssAnon: 1028.5352 MiB lsof: 580
Then I ran our own application with 6 input sources.
PID: 2168169 09:37:59 Total used hardware memory: 204000K hardware memory: 199.1445 MiB VmSize: 32482.0078 MiB VmRSS: 612.9297 MiB RssFile: 273.8477 MiB RssAnon: 341.0820 MiB lsof: 333
PID: 2168169 09:38:00 Total used hardware memory: 461640K hardware memory: 456.7461 MiB VmSize: 32970.9141 MiB VmRSS: 1073.9883 MiB RssFile: 424.8438 MiB RssAnon: 656.9570 MiB lsof: 397
PID: 2168169 09:38:02 Total used hardware memory: 869384K hardware memory: 848.9336 MiB VmSize: 33412.8086 MiB VmRSS: 1807.2500 MiB RssFile: 837.1797 MiB RssAnon: 972.0703 MiB lsof: 524
…
PID: 2168169 09:38:56 Total used hardware memory: 2598052K hardware memory: 2537.0859 MiB VmSize: 36727.8633 MiB VmRSS: 2374.2148 MiB RssFile: 884.3633 MiB RssAnon: 1489.8516 MiB lsof: 1080
PID: 2168169 09:38:57 Total used hardware memory: 2598052K hardware memory: 2537.0859 MiB VmSize: 36727.8633 MiB VmRSS: 2374.2148 MiB RssFile: 884.3633 MiB RssAnon: 1489.8516 MiB lsof: 1080
PID: 2168169 09:38:58 Total used hardware memory: 2598052K hardware memory: 2537.0859 MiB VmSize: 36727.8633 MiB VmRSS: 2374.2148 MiB RssFile: 884.3633 MiB RssAnon: 1489.8516 MiB lsof: 1080
…
PID: 2168169 09:39:52 Total used hardware memory: 2341196K hardware memory: 2286.2500 MiB VmSize: 36307.6875 MiB VmRSS: 2254.8086 MiB RssFile: 871.5586 MiB RssAnon: 1383.2500 MiB lsof: 585
PID: 2168169 09:39:53 Total used hardware memory: 2341196K hardware memory: 2286.2500 MiB VmSize: 36307.6875 MiB VmRSS: 2254.8086 MiB RssFile: 871.5586 MiB RssAnon: 1383.2500 MiB lsof: 585
PID: 2168169 09:39:54 Total used hardware memory: 2341196K hardware memory: 2286.2500 MiB VmSize: 36307.6875 MiB VmRSS: 2254.8086 MiB RssFile: 871.5586 MiB RssAnon: 1383.2500 MiB lsof: 585
yuweiw
August 3, 2023, 9:31am
14
Just from the log, the 6 sources need 2341196K
memory and the 1 source needs 944156K
. What is the memory of your machine?
And could you describe how to reproduce the issue step by step? If I can try to reproduce in my environment, it’ll be faster to analyze this issue.
Its an AGX Orin 32GB. Here’s a screenshot from JTOP
yuweiw
August 3, 2023, 11:00am
16
OK. Could you provide the detailed steps to reproduce the issue, including the code, compiling and run?
aron.h
August 3, 2023, 3:21pm
17
Our codebase is way to large to post here.
Instead I expanded upon the code example above so that it runs inside threads.
I sent you a PM with the new code example as well as instructions for building and executing it.
1 Like
yuweiw
August 4, 2023, 8:34am
18
OK. Thanks for providing the demo. We will analyze it as soon as possible.
@yuweiw any luck replicating the issue ?
yuweiw
August 7, 2023, 1:37am
20
Yes. I can reproduce the problem in my environment. It may take some time to analyze this issue.
aron.h:
I traced it’s origin via NvInfer.h
and NvInferRuntime.h
to NvInferImpl.h
.
There the class class VExecutionContext : public VRoot
has the method
virtual bool enqueueV2(void* const* bindings, cudaStream_t stream, cudaEvent_t* inputConsumed) noexcept = 0;
How did you come to this conclusion above? Based on my results, the time for all three processes(preprocess, infer, postprocess) has increased.
aron.h
August 7, 2023, 2:34pm
21
yuweiw:
Yes. I can reproduce the problem in my environment. It may take some time to analyze this issue.
aron.h:
I traced it’s origin via NvInfer.h
and NvInferRuntime.h
to NvInferImpl.h
.
There the class class VExecutionContext : public VRoot
has the method
virtual bool enqueueV2(void* const* bindings, cudaStream_t stream, cudaEvent_t* inputConsumed) noexcept = 0;
How did you come to this conclusion above? Based on my results, the time for all three processes(preprocess, infer, postprocess) has increased.
After I assertained that the project took too long to run, I started commenting out the content of it, starting form the bottom and working my way up.
Once I commented out the infer()
call, the time it took to run the project immediately dropped down to acceptable levels (ie. slightly more than the duration of the video file).
Armed with that knowledge, I then uncommented the infer()
call and started commenting out lines inside the Yolov7::infer
method itself.
By elimination, I found that the line if (!mContext->enqueueV2(mBindingArray.data(), mStream.get(), NULL))
was causing the slow-down.
yuweiw
August 8, 2023, 3:10am
22
You can use the jtop
or tegrastats
tool to observing the usage rate of GPU. It is full when run 6 threads. And the preprocess and postprocess use OpenCV which use the gpu to process data. This will also slow down the process speed.
What’s the way around this ? Surely orin agx can run inference on 6 1080p videos without slow down. The slow down starts from just 2 1080p videos.
yuweiw
August 8, 2023, 8:57am
24
How did this conclusion come from? The demo you used uses the CPU to process data. If you want to improve efficiency, you can use the DeepStream, like:
source1
source2
source3 -------------> streammux ---------------> inference ------->.......
....
sourcen
aron.h
August 9, 2023, 9:10am
25
We did try using gstreamer plugins in a similar fashion as your diagram above shows.
As per per this post, we had some problems with nvinfer so at the end of that dialogue, we were advised to use the libary Yolov7 to do the inference.
This library takes a vector of cv::Mat as input. That suited us just fine since we make other use of the cv::Mat’s ourselves.