Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

CSBVision
Copy link
Contributor

@CSBVision CSBVision commented Feb 1, 2023

Fixes #23187

Supports delay-loading for Ninja generators and Python bindings.

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

@CSBVision
Copy link
Contributor Author

CC @asmorkalov @stopmosk

@asmorkalov asmorkalov added category: build/install category: gpu/cuda (contrib) OpenCV 4.0+: moved to opencv_contrib labels Feb 1, 2023
Supports delay-loading for Ninja generators and Python bindings.
@stopmosk
Copy link
Contributor

stopmosk commented Feb 7, 2023

I confirm lazy loading with Ninja generator. It works with this PR.

But could you please provide steps to check python bindings with CUDA delayed loading?

@CSBVision
Copy link
Contributor Author

CSBVision commented Feb 8, 2023

Sure, no problem. If you compiled OpenCV with Python3 bindings enabled, go to your Python3 package location defined by PYTHON3_PACKAGES_PATH and open the cv2\python-X.X directory (depending on your Python version). Here, the cv2.cpXX-win_amd64.pyd file is a DLL with pyd extension whose dependencies can be checked just like those of other DLLs. In the existing code, the delay flags were only set for shared modules (i.e. DLLs) while with this PR, the delay flags are also set for modules (e.g. Python) as well as programs (i.e. EXE files).

Still, loading the pyd file from Python is a bit tricky regarding the dependencies. Even though all dependencies might be shipped next to the DLL or the Path environment, Python will not load these. Instead, they need to be defined by the package's configuration scripts (cv2\config.py here). But if you only check for delay-loaded dependencies, this should not really matter at all.

@asmorkalov asmorkalov self-requested a review February 9, 2023 06:35
Copy link
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 self-assigned this Feb 9, 2023
@opencv-pushbot opencv-pushbot merged commit d3c6b85 into opencv:4.x Feb 9, 2023
@asmorkalov asmorkalov mentioned this pull request May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Two issues with CUDA_ENABLE_DELAYLOAD

5 participants