Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cuda - update npp calls to use the new NppStreamContext API if available #3803

Open
wants to merge 1 commit into
base: 4.x
Choose a base branch
from

Conversation

cudawarped
Copy link
Contributor

@cudawarped cudawarped commented Oct 3, 2024

Requires changes in opencv/opencv#26245

Update calls to Nvidia's NPP library to use the newer NppStreamContext API introduced in CUDA 10.1 (release notes)

Although this was introduced in CUDA 10.1 at that point not all of the functions either had a _Ctx version which took a NppStreamContext or an implementation present in the NPP library. Therefore in this PR the USE_NPP_STREAM_CTX flag which selects the new API is only enabled for versions of NPP >= 12205 (the version included with CUDA toolkit 12.4) which I have verified as working. Currently the only function called inside OpenCV which does not work with the new API is nppiEvenLevelsHost_32s_Ctx which doesn't have an implementation inside nppist.lib or libnppist.so as of CUDA 12.6.

Tested locally on Ubuntu 20.04 with both CUDA toolkits 12.3 and 12.4.

Adds changes discussed in #3338 to all Npp functions called by OpenCV.
Fixes #3798

@tomoaki0705 I have re-introduced streaming in https://github.com/tomoaki0705/opencv/blob/f4e5d777e856f751c4318f0c633dcce37cfa66f2/modules/cudaarithm/src/reductions.cpp#L161 which you disabled in opencv/opencv#11064 because it looks like you fixed it with opencv/opencv#11550 is this correct?

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@cudawarped cudawarped force-pushed the cuda_update_to_npp_stream_ctx branch from a7fdf2f to 06f764a Compare October 3, 2024 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Morphology operation is slower on GPU than same operation on CPU
1 participant