-
Notifications
You must be signed in to change notification settings - Fork 5.8k
cudaoptflow: disable Optical Flow SDK when CUDA version is insufficient #2824
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
Conversation
Sure @tomoaki0705. |
Hi @tomoaki0705 Please DO NOT SUBMIT this change instead Thanks, |
@vchiluka5 Perhaps this should be handled in CMake scripts through CUDA SDK version check:
|
Thank you @alalek @vchiluka5
I'd like to propose to fallback to v1.0 in master branch (4.5 series) @vchiluka5 , what I'd like to double check is that is Optical Flow SDK v1.0 totally deprecated ? |
il suggest to disable the v2.0 for CUDA < 10.0. Because CUDA 8 doesnt have proper compatibility with turing architecture and optical flow sdk 1.0 works from turing architecture and above. |
Thank you @vchiluka5 ! |
Thanks @tomoaki0705 . That will be of great help :-) |
d085506
to
5795d8d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected changes in CMake
(looks good) and src/nvidiaOpticalFlow.cpp
(just add guard for HAVE_NVIDIA_OPTFLOW
, no code removal is expected)
@@ -198,6 +198,7 @@ bool parseROI(std::string ROIFileName, std::vector<Rect>& roiData) | |||
|
|||
int main(int argc, char **argv) | |||
{ | |||
#if defined HAVE_NVIDIA_OPTFLOW |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Samples should not depend on such defines.
API calls will throw an exception.
Please revert compilation guards from samples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed. thank you
@@ -326,56 +326,7 @@ PERF_TEST_P(ImagePair, OpticalFlowDual_TVL1, | |||
} | |||
} | |||
|
|||
////////////////////////////////////////////////////// | |||
// NvidiaOpticalFlow_1_0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cv::cuda::NvidiaOpticalFlow_1_0
is not removed from OpenCV public API, it is just disabled (throws exceptions).
Please restore this test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restored. Thank you
@@ -249,437 +239,6 @@ class LoadNvidiaModules | |||
PFNNvOFAPICreateInstanceCuda GetOFLibraryFunctionPtr() { return m_NvOFAPICreateInstanceCuda; } | |||
}; | |||
|
|||
class NvidiaOpticalFlowImpl : public cv::cuda::NvidiaOpticalFlow_1_0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe 1_0
implementation can work with 2.0
SDK.
Perhaps there is no reason to remove that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you were right.
I could restore the 1_0
implementation.
There was another build failure but that was due to the wrong function call in the disabled part.
Thanks for the review @alalek. |
5795d8d
to
a821659
Compare
So, I've restored the |
Just for clarification. SDK 2.0 works with 1.0 as well and hence we have 2 classes exposed. |
@tomoaki0705 Build is failing on .cu file compilation (check "Custom" builder with CUDA 8.0). |
* follow the review comment * add missing constructors when not covered * add definition in cu file
a821659
to
6e52be3
Compare
relates #2807
Just modifying this line will let the build pass for both CUDA 8.0 and CUDA 10.0
/cc @vchiluka5
I understand that Optical flow API only supports CUDA 10.0 and later. Thank you for the comment.
Though, I'd like to propose this fix as a quick fix of build.
Eventually, I can add to disable Optical Flow API when CUDA is less than 10.0
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.