Skip to content

build: fix OpenBLAS detection on Linux#27029

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
mshabunin:fix-openblas
Apr 1, 2025
Merged

build: fix OpenBLAS detection on Linux#27029
asmorkalov merged 1 commit intoopencv:4.xfrom
mshabunin:fix-openblas

Conversation

@mshabunin
Copy link
Copy Markdown
Contributor

@mshabunin mshabunin commented Mar 8, 2025

Main change is rewritten OpenCVFindOpenBLAS.cmake:

  • search cmake package first
  • search using environment variables second
  • search in system locations last
  • additionally search for lapacke.h and append its path to the result header location

Other changes:

  • use arguments syntax for ocv_lapack_check
  • debug output

Test framework (Linux): https://github.com/mshabunin/opencv-blas-check

Should be merged with opencv/ci-gha-workflow#237

@asmorkalov
Copy link
Copy Markdown
Contributor

Proper BLAS detection affects photo module tests:

 PID: 45146
  [ RUN      ] Photo_CalibrateDebevec.regression
  /home/ubuntu/opencv/modules/photo/test/test_hdr.cpp:233: Failure
  Expected: (max) < (0.1), actual: 0.415381 vs 0.1
  [  FAILED  ] Photo_CalibrateDebevec.regression (1480 ms)

@asmorkalov asmorkalov self-requested a review March 10, 2025 08:32
@asmorkalov asmorkalov self-assigned this Mar 10, 2025
@asmorkalov asmorkalov added this to the 4.12.0 milestone Mar 10, 2025
@asmorkalov
Copy link
Copy Markdown
Contributor

Looks like the following lines affect test result:

// solve the overdetermined system using SVD (least-squares problem)

            // solve the overdetermined system using SVD (least-squares problem)
            Mat solution;
            solve(A, B, solution, DECOMP_SVD);

@mshabunin
Copy link
Copy Markdown
Contributor Author

Yes, apparently SVD differs between the libraries. I'm not sure how we should handle this...

@asmorkalov
Copy link
Copy Markdown
Contributor

Related PR: #19343

@mshabunin
Copy link
Copy Markdown
Contributor Author

CI has passed with updated ubuntu 24 docker image (opencv/ci-gha-workflow#237), I'm reverting CI branch.

@asmorkalov asmorkalov merged commit 8b4b382 into opencv:4.x Apr 1, 2025
27 of 28 checks passed
@mshabunin mshabunin deleted the fix-openblas branch April 1, 2025 07:50
@asmorkalov asmorkalov mentioned this pull request Apr 29, 2025
asmorkalov pushed a commit that referenced this pull request May 12, 2025
Port of #27029 to 5.x

Replaced search mechanism with 4.x variant
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.

2 participants