I have a code which fails only on the Orin(Cuda 11.4, gcc-11.5.0) board with this message:
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.10.0-dev) ~/opencv_contrib/modules/cudaimgproc/src/canny.cpp:140: error: (-215:Assertion failed) deviceSupports(SHARED_ATOMICS) in function 'detect'
and works on my older Jetson TX2 (OpenCV version <4.10.0, but I checked this deviceSupports(…) function is there too).
I guess this 2023 year device is definitely supports these atomics, but function deviceSupports(…) return wrong result for some reason.
Which settings should I check to let this function return ‘true’?
Probably something changed in ocv distrib and now I have to set these values manually while I never did this before. Since Orin is headless, I’ve added -DCUDA_ARCH_BIN=8.6 -DCUDA_ARCH_PTX=8.6
and rebuild ocv (btw switched to gcc-10 since gcc-11 gives error). Now your code prints:
I recompiled OpenCV and my app using -DCUDA_ARCH_BIN=87 (PTX was auto detected as 86). It works fine but I see no changes in my app size ~18MB. By the way, on TX2 it is just 1.8 MB. Could you tell me why it is ~10 times bigger on Orin?
If I use gcc-11 instead of gcc-10 on Orin board app size is ~13MB.
I have no static linking, although I’d like to have (to let application work on any board without OCV and CUDA installation) - is it possible?
I tried once -DBUILD_SHARED_LIBS=OFF but it lead to the app size 130 MB (it is ok) and the next level of error messages when running (it is not ok). Should I create another topic about static linking (if this goal to use application without any CUDA and OCV installation is even possible) or it is ok to discuss it here? Perhaps you have a link to a detailed explanation with examples?
That’s strange did you clean your build directory?
I was refering to the OpenCV shared library[s] (libopencv_cudaimgproc.so.4.10.0 etc.) which you link to in your application.
I don’t know, maybe the default compile options are for minimum size on one set up and for speed on another.
I’m not sure. If you compile with CUDA as a first class language this might be possible because it has access to static targets but I would have to check.
Do you mean -DBUILD_SHARED_LIBS=OFF? I would start a new thread if you have errors when building a static library.
I would have thought so but I would just change the build directory name to gurantee a fresh configuration, you can then just delete it once you have examined the CMake configuration output.
While your in the middle of this can you quickly test what happens if you don’t specify CUDA_ARCH_BIN in a fresh build directory, does still have blank entries for GPU/PTX arch?
I would include -DOPENCV_CMAKE_CUDA_DEBUG=ONso you get the output of all the architectures it tried to build against and why they failed if they did.