Skip to content

remove default stream sync in cuda TVL1 optical flow#3089

Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom
noahstier:tlv1_cuda_optimization
Oct 26, 2021
Merged

remove default stream sync in cuda TVL1 optical flow#3089
opencv-pushbot merged 1 commit intoopencv:masterfrom
noahstier:tlv1_cuda_optimization

Conversation

@noahstier
Copy link
Copy Markdown
Contributor

@noahstier noahstier commented Oct 25, 2021

This is an optimization in the cuda TVL1 optical flow implementation.

It moves a summation reduction off of the default cuda stream, preventing a device sync. It also eliminates a slow cudaHostAlloc and cudaHostFree.

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 other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to 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
force_builders=Custom
build_worker:Custom=linux-4,linux-6
build_image:Custom=ubuntu-cuda:18.04

@noahstier
Copy link
Copy Markdown
Contributor Author

noahstier commented Oct 25, 2021

This gives me much better GPU utilization for this function. I can share nvprof data if it would be helpful.

tasks:

  • proper branch: In version 3.4 this function is in opencv, not opencv_contrib. Should I also make this change in 3.4 in opencv?

  • bug report: I didn't make one--should I?. I am attaching a screenshot from nvprof where you can see the cudaDeviceSynchronize and the extra pinned memory alloc / free.

nvprof

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

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

Thank you for contribution 👍

3.4 branch is in the maintenance mode.
If you need to change this branch too, then you can push changes to the main repository.

@opencv-pushbot opencv-pushbot merged commit 92987f8 into opencv:master Oct 26, 2021
@alalek alalek mentioned this pull request Dec 30, 2021
@alalek alalek mentioned this pull request Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants