-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Description
System information
- OpenCV => 4.8.0
- Operating System / Platform => Nvidia JetPack 6.0 (Ubuntu 22.04) / Nvidia Jetson Orin NX
- Compiler => gcc 11.4.0
Detailed description
I am trying to test the morphology operation on GPU, the test platform is Nvidia Jetson Orin NX, the JetPack 6.0 (R36.3.0, Ubuntu 22.04) + cuda 12.2 is installed on the test platform.
I download, build and installed the OpenCV 4.8.0 and opencv_contrib 4.8 on the test platform, and then, I code a test program to call morphology interfaces on GPU (cuda::MorphologyFilter->apply) and CPU (morphologyEx) to compare its performance, in my opinion, the same operation on GPU should be faster than on CPU, but in my test, the morphology operation is slower on GPU than it on CPU.
The source of test program and relative image file are attached in a zip file for your reference.
Could you please help me to check if any problem or bug happens in my test program?
Steps to reproduce
- compiler the program with command "g++ -D PROFILE_SAMPLE -o morph morph.cpp
pkg-config --cflags --libs opencv4-I /usr/local/cuda/include -L /usr/local/cuda/lib64 -l cudart", an executable file "morph" is generated if no error happens; - run the program morph which built by the step 1 without any arguments, it will read the image file "./baboon.jpg", and do morphology operations on GPU and CPU, and calculate the time cost by the operations on GPU and CPU, print out the time cost on the terminal.
- on my test platform - Jetson Orin NX, the printed out is listed below:
(base) nvidia@ubuntu:~/opencv/rep$ ./morph
264 times morphology operations are done with OpenCV on GPU!
Time for morphology : 4396.36 ms
in system time : 4397 ms
264 times morphology operations are done with OpenCV on CPU!
Time for morphology : 1867.39 ms
in system time : 1868 ms
We can find that it costs 4396.36ms to do 264 times morphology operations on GPU, and it costs 1867.39ms to do 264 times morphology operations on CPU.