Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

LAPACK_xxx is the universal way to go for lapack >= 3.40 with c/c++ i…#21291

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
dwardor wants to merge3 commits intoopencv:4.xfromdwardor:alternate
Closed

Conversation

@dwardor
Copy link
Contributor

@dwardordwardor commentedDec 19, 2021
edited
Loading

…nterface.

This is an alternate solution to#21116 (explained by#21114 (comment))
It works on my gentoo box... doing a pull request to test it here on th ebuildbot. If it works it seems better/cleaner than#21114 to me as it uses lapack's "unpreprocessed" function names and relies on lapack's preprocessor macros to do all the magic...

Pull Request Readiness Checklist

See details athttps://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

devurandom reacted with eyes emoji
@alalek
Copy link
Member

OpenCV LAPACK`'s support is wider that just lapack integration.

  • different lapack implementations could be used including Apple'sAccelerate framework (which fails on "Mac" builder)
  • some BLAS routines are used under this check too (this is confusing)

Tested on ArchLinux with freshlapack-3.10.0-1 +lapacke-3.10.0-1:

CMake:

-- LAPACK(LAPACK/Generic): LAPACK_LIBRARIES: /lib64/liblapack.so;/lib64/libblas.so-- LAPACK(LAPACK/Generic): Support is enabled....--     Lapack:                      YES (/lib64/liblapack.so /lib64/libblas.so)

Failed on linking step for opencv_test_core:

/usr/bin/ld: lib/libopencv_core.so.4.5.4: undefined reference to `cblas_dgemm'/usr/bin/ld: lib/libopencv_core.so.4.5.4: undefined reference to `cblas_cgemm'/usr/bin/ld: lib/libopencv_core.so.4.5.4: undefined reference to `cblas_zgemm'/usr/bin/ld: lib/libopencv_core.so.4.5.4: undefined reference to `cblas_sgemm'

Need to investigate (probably it is a different problem).

@dwardor
Copy link
ContributorAuthor

OpenCV LAPACK`'s support is wider that just lapack integration.

  • different lapack implementations could be used including Apple'sAccelerate framework (which fails on "Mac" builder)
  • some BLAS routines are used under this check too (this is confusing)

Tested on ArchLinux with freshlapack-3.10.0-1 +lapacke-3.10.0-1:

CMake:

-- LAPACK(LAPACK/Generic): LAPACK_LIBRARIES: /lib64/liblapack.so;/lib64/libblas.so-- LAPACK(LAPACK/Generic): Support is enabled....--     Lapack:                      YES (/lib64/liblapack.so /lib64/libblas.so)

Failed on linking step for opencv_test_core:

/usr/bin/ld: lib/libopencv_core.so.4.5.4: undefined reference to `cblas_dgemm'/usr/bin/ld: lib/libopencv_core.so.4.5.4: undefined reference to `cblas_cgemm'/usr/bin/ld: lib/libopencv_core.so.4.5.4: undefined reference to `cblas_zgemm'/usr/bin/ld: lib/libopencv_core.so.4.5.4: undefined reference to `cblas_sgemm'

Need to investigate (probably it is a different problem).

I haven't touched anything "cblas" so yes I'd say those undefined references are another issue...

How does Apple's "Accelerate" (or other lapack implementations) define the lapack functions in the appropriate ".h" files ? LAPACK_xxxx or xxxx_ or ????

@alalek
Copy link
Member

CMakeError log has this:

LAPACK(LAPACK/Apple) check FAILED:    LAPACK_INCLUDE_DIR: ''    LAPACK_LIBRARIES: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/System/Library/Frameworks/Accelerate.framework;-lm;-ldl'    LAPACK_LINK_LIBRARIES: '/usr/local/lib'    Output:Change Dir: /build/precommit_macosx/build/CMakeFiles/CMakeTmpRun Build Command(s):/usr/local/bin/ninja cmTC_ec99f && [1/2] Building CXX object CMakeFiles/cmTC_ec99f.dir/lapack_check.cpp.oFAILED: CMakeFiles/cmTC_ec99f.dir/lapack_check.cpp.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -I. -I/build/precommit_macosx/build -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden  -O3 -DNDEBUG  -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk -fPIE -std=c++11 -MD -MT CMakeFiles/cmTC_ec99f.dir/lapack_check.cpp.o -MF CMakeFiles/cmTC_ec99f.dir/lapack_check.cpp.o.d -o CMakeFiles/cmTC_ec99f.dir/lapack_check.cpp.o -c /build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:11:2: error: Developper needs to figure this out as both LAPACK_GLOBAL and LAPACK_NAME are undefined#error Developper needs to figure this out as both LAPACK_GLOBAL and LAPACK_NAME are undefined ^/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:15:47: error: use of undeclared identifier 'sgesv'static char* check_fn1 = (char*)LAPACK_GLOBAL(sgesv,SGESV);                                              ^/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:15:53: error: use of undeclared identifier 'SGESV'static char* check_fn1 = (char*)LAPACK_GLOBAL(sgesv,SGESV);                                                    ^/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:16:47: error: use of undeclared identifier 'sposv'static char* check_fn2 = (char*)LAPACK_GLOBAL(sposv,SPOSV);                                              ^/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:16:53: error: use of undeclared identifier 'SPOSV'static char* check_fn2 = (char*)LAPACK_GLOBAL(sposv,SPOSV);                                                    ^/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:17:47: error: use of undeclared identifier 'spotrf'static char* check_fn3 = (char*)LAPACK_GLOBAL(spotrf,SPOTRF);                                              ^/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:17:54: error: use of undeclared identifier 'SPOTRF'static char* check_fn3 = (char*)LAPACK_GLOBAL(spotrf,SPOTRF);                                                     ^/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:18:47: error: use of undeclared identifier 'sgesdd'static char* check_fn4 = (char*)LAPACK_GLOBAL(sgesdd,SGESDD);                                              ^/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:18:54: error: use of undeclared identifier 'SGESDD'static char* check_fn4 = (char*)LAPACK_GLOBAL(sgesdd,SGESDD);                                                     ^9 errors generated.ninja: build stopped: subcommand failed.

… using netlib's reference LAPACK implementation version >= 3.4.0
@dwardor
Copy link
ContributorAuthor

CMakeError log has this:

LAPACK(LAPACK/Apple) check FAILED:    LAPACK_INCLUDE_DIR: ''    LAPACK_LIBRARIES: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/System/Library/Frameworks/Accelerate.framework;-lm;-ldl'    LAPACK_LINK_LIBRARIES: '/usr/local/lib'    Output:Change Dir: /build/precommit_macosx/build/CMakeFiles/CMakeTmpRun Build Command(s):/usr/local/bin/ninja cmTC_ec99f && [1/2] Building CXX object CMakeFiles/cmTC_ec99f.dir/lapack_check.cpp.oFAILED: CMakeFiles/cmTC_ec99f.dir/lapack_check.cpp.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -I. -I/build/precommit_macosx/build -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden  -O3 -DNDEBUG  -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk -fPIE -std=c++11 -MD -MT CMakeFiles/cmTC_ec99f.dir/lapack_check.cpp.o -MF CMakeFiles/cmTC_ec99f.dir/lapack_check.cpp.o.d -o CMakeFiles/cmTC_ec99f.dir/lapack_check.cpp.o -c /build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:11:2: error: Developper needs to figure this out as both LAPACK_GLOBAL and LAPACK_NAME are undefined#error Developper needs to figure this out as both LAPACK_GLOBAL and LAPACK_NAME are undefined ^/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:15:47: error: use of undeclared identifier 'sgesv'static char* check_fn1 = (char*)LAPACK_GLOBAL(sgesv,SGESV);                                              ^/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:15:53: error: use of undeclared identifier 'SGESV'static char* check_fn1 = (char*)LAPACK_GLOBAL(sgesv,SGESV);                                                    ^/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:16:47: error: use of undeclared identifier 'sposv'static char* check_fn2 = (char*)LAPACK_GLOBAL(sposv,SPOSV);                                              ^/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:16:53: error: use of undeclared identifier 'SPOSV'static char* check_fn2 = (char*)LAPACK_GLOBAL(sposv,SPOSV);                                                    ^/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:17:47: error: use of undeclared identifier 'spotrf'static char* check_fn3 = (char*)LAPACK_GLOBAL(spotrf,SPOTRF);                                              ^/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:17:54: error: use of undeclared identifier 'SPOTRF'static char* check_fn3 = (char*)LAPACK_GLOBAL(spotrf,SPOTRF);                                                     ^/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:18:47: error: use of undeclared identifier 'sgesdd'static char* check_fn4 = (char*)LAPACK_GLOBAL(sgesdd,SGESDD);                                              ^/build/precommit_macosx/4.x/opencv/cmake/checks/lapack_check.cpp:18:54: error: use of undeclared identifier 'SGESDD'static char* check_fn4 = (char*)LAPACK_GLOBAL(sgesdd,SGESDD);                                                     ^9 errors generated.ninja: build stopped: subcommand failed.

Can you test with the lattest patch I just pushed ?

@dwardor
Copy link
ContributorAuthor

OK so Mac build fails... suggesting Accelerate implementation does not use LAPACK_xxxx preprocessor macros as does the reference implementation...
---> So I guess this approach is dead... and we are back to#21114

@dwardordwardor deleted the alternate branchDecember 22, 2021 14:18
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@dwardor@alalek

[8]ページ先頭

©2009-2025 Movatter.jp