Hello all. I am considering contributing an update to the median filter in OpenCV (4.x) using CUDA.
At SIGGRAPH Asia 2022, a method was presented that, according to the paper, achieves more than a tenfold speedup over the current histogram-based method. In addition, the current OpenCV only supports up to 5x5 windows for 16-bit or float data, but this new method also supports larger windows for HDR.
I am thinking about offering this implementation for OpenCV, but I have questions about the CUDA version and libraries that can be used. The author’s current implementation uses the CUDA library CUB. As far as I can tell from examining the OpenCV project, there does not seem to be any code currently using CUB. Since CUB has been included in the standard toolkit since CUDA 11.0, it seems possible to port this as is, if OpenCV’s implementation is fine with using CUDA 11 or higher.
What version of CUDA should I use for OpenCV 4.x? Is CUB usable? Would it be necessary to branch the code depending on whether CUB is available for older environments?
Also, NVIDIA has released many GPUs over the years. From which generation on should they be supported? Kepler (3.5)? Maxwell (5.x)?
This is correct as far as I know but there are implementations of warp and block level reductions/scans. e.g.
So you could use those and if you want update them to use CUB when the CUDA Toolkit >= 11.
If your improvement to an existing algorithm relies on features which are only available on newer hardware then you can selectively compile those modifications in when compiling for that architechture using __CUDA_ARCH__. e.g.
It’s fine to discuss this on the forum but you’ll probably want to open an issue and discuss this on the github. That is where all the library work happens. And where all the paid core maintainers are to be found
Thanks cudawarped for the quick reply. I consider all my current technical questions answered.
I never knew that there are primitives within OpenCV that also provide scan, etc. for CUDA.
I will use these and do some refactoring to create a PR.
Thank you for pointing this out, crackwitz.
I also checked the recent issues on GitHub, but most of them are about bugs, etc. When I opened New Issue, I was confused with “Feature request”, but I thought my question would be included in “Questions”, so I decided to go with “forum”.
I will use GitHub issues next time.