Skip to content

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

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
cudawarped:cuda_update_to_npp_stream_ctx
Oct 22, 2024
Merged

cuda - update npp calls to use the new NppStreamContext API if available#26245
asmorkalov merged 1 commit intoopencv:4.xfrom
cudawarped:cuda_update_to_npp_stream_ctx

Conversation

@cudawarped
Copy link
Copy Markdown
Contributor

@cudawarped cudawarped commented Oct 3, 2024

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 opencv/opencv_contrib#3338 to all Npp functions called by OpenCV.
Fixes opencv/opencv_contrib#3798

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 changed the title cuda - update npp calls to use the new NppStreamContext API if available cuda - update npp calls to use the new NppStreamContext API if available Oct 3, 2024
Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@asmorkalov asmorkalov added feature category: gpu/cuda (contrib) OpenCV 4.0+: moved to opencv_contrib labels Oct 22, 2024
@asmorkalov asmorkalov self-assigned this Oct 22, 2024
@asmorkalov asmorkalov added this to the 4.11.0 milestone Oct 22, 2024
@asmorkalov asmorkalov merged commit 57ccbee into opencv:4.x Oct 22, 2024
@asmorkalov asmorkalov mentioned this pull request Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: gpu/cuda (contrib) OpenCV 4.0+: moved to opencv_contrib feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Morphology operation is slower on GPU than same operation on CPU

2 participants