[Hugin-devs] [Bug 1892420] Re: levmar uses BLAS when built with LAPACK, but Hugin does not link against BLAS
> Our own FindLAPACK and also CMake FindLAPACK include both the BLAS library in the LAPACK_LIBRARIES (both tested!) Interesting. I also see that in /usr/share/cmake/Modules/FindLAPACK.cmake:231-502: if(BLAS_FOUND) [...] else() message(STATUS "LAPACK requires BLAS") endif() For me the output is: -- Checking for module 'lapack' -- Found lapack, version 3.8.0 -- Found LAPACK: /usr/lib64/liblapack.so -- LAPACK found (/usr/lib64/liblapack.so) And not: -- LAPACK found (/usr/lib/i386-linux-gnu/liblapack.so;/usr/lib/i386-linux-gnu/libblas.so) I will investigate why there is this difference. > If I request CMake to use a library I assume it returns all needed libraries > to use the requested library - so I have not to check which other libs the > requested library is using internal. That is correct. But Hugin (via levmar) also uses BLAS, which at that point is no longer an implementation detail of LAPACK, but a direct dependency of Hugin. -- You received this bug notification because you are a member of Hugin Developers, which is subscribed to Hugin. https://bugs.launchpad.net/bugs/1892420 Title: levmar uses BLAS when built with LAPACK, but Hugin does not link against BLAS Status in Hugin: Invalid Status in hugin package in Gentoo Linux: New Bug description: ``` hugin-2019.2.0/src/foreign/levmar/misc_core.c:45:#define GEMM LM_MK_BLAS_NAME(gemm) ``` This function is a BLAS function: https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3 Thus, since levmar is built as a static library, Hugin itself should call `find_package(BLAS)` and `huginbase` should link against `BLAS_LIBRARIES`. Attached patch fixes this (in an admittedly slightly crude way) for me. To manage notifications about this bug go to: https://bugs.launchpad.net/hugin/+bug/1892420/+subscriptions ___ Mailing list: https://launchpad.net/~hugin-devs Post to : hugin-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~hugin-devs More help : https://help.launchpad.net/ListHelp
[Hugin-devs] [Bug 1892420] Re: levmar uses BLAS when built with LAPACK, but Hugin does not link against BLAS
If I request CMake to use a library I assume it returns all needed libraries to use the requested library - so I have not to check which other libs the requested library is using internal. So FindPackage should hide the internal details for the user - this is what our own FindLAPACK does. Also looking into CMakes own FindLAPACK: at the beginning there is a note: ``LAPACK_LIBRARIES`` uncached list of libraries (using full path name) to link against to use LAPACK as I wrote above. Also scrolling down I find: find_package(BLAS) So also CMake own FindLAPACK should also find BLAS. I tested now also on Ubuntu. Our own FindLAPACK and also CMake FindLAPACK include both the BLAS library in the LAPACK_LIBRARIES (both tested!) >From the log: LAPACK found (/usr/lib/i386-linux-gnu/liblapack.so;/usr/lib/i386-linux-gnu/libblas.so) So - without more information - I don't see the point of explicitly searching for BLAS. So maybe Gentoo is also modifying files in CMake(?)/LAPACK(?)/BLAS(?) - as deleting the file in Hugins build system, which breaks then later. ** Changed in: hugin Status: Incomplete => Invalid -- You received this bug notification because you are a member of Hugin Developers, which is subscribed to Hugin. https://bugs.launchpad.net/bugs/1892420 Title: levmar uses BLAS when built with LAPACK, but Hugin does not link against BLAS Status in Hugin: Invalid Status in hugin package in Gentoo Linux: New Bug description: ``` hugin-2019.2.0/src/foreign/levmar/misc_core.c:45:#define GEMM LM_MK_BLAS_NAME(gemm) ``` This function is a BLAS function: https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3 Thus, since levmar is built as a static library, Hugin itself should call `find_package(BLAS)` and `huginbase` should link against `BLAS_LIBRARIES`. Attached patch fixes this (in an admittedly slightly crude way) for me. To manage notifications about this bug go to: https://bugs.launchpad.net/hugin/+bug/1892420/+subscriptions ___ Mailing list: https://launchpad.net/~hugin-devs Post to : hugin-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~hugin-devs More help : https://help.launchpad.net/ListHelp
[Hugin-devs] [Bug 1892420] Re: levmar uses BLAS when built with LAPACK, but Hugin does not link against BLAS
Thank you for taking a look. Gentoo's package manager removes that file in favour of the one provided by CMake itself: ❯ q file -v /usr/share/cmake/Modules/FindLAPACK.cmake dev-util/cmake-3.18.1: /usr/share/cmake/Modules/FindLAPACK.cmake Now one might argue that CMake is correct in having the LAPACK target only include the LAPACK library and not BLAS, since programs using BLAS should probably explicitly link against the BLAS target. -- You received this bug notification because you are a member of Hugin Developers, which is subscribed to Hugin. https://bugs.launchpad.net/bugs/1892420 Title: levmar uses BLAS when built with LAPACK, but Hugin does not link against BLAS Status in Hugin: Incomplete Status in hugin package in Gentoo Linux: New Bug description: ``` hugin-2019.2.0/src/foreign/levmar/misc_core.c:45:#define GEMM LM_MK_BLAS_NAME(gemm) ``` This function is a BLAS function: https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3 Thus, since levmar is built as a static library, Hugin itself should call `find_package(BLAS)` and `huginbase` should link against `BLAS_LIBRARIES`. Attached patch fixes this (in an admittedly slightly crude way) for me. To manage notifications about this bug go to: https://bugs.launchpad.net/hugin/+bug/1892420/+subscriptions ___ Mailing list: https://launchpad.net/~hugin-devs Post to : hugin-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~hugin-devs More help : https://help.launchpad.net/ListHelp
[Hugin-devs] [Bug 1892420] Re: levmar uses BLAS when built with LAPACK, but Hugin does not link against BLAS
I checked the build system. Our FindPackage(LAPACK) does already search for the blas libraries. So maybe you are using a slightly different name of the BLAS library (other implementation) so that CMake does not pick up this variant. So the easiest way to fix would be to update CMakeModules/FindLAPACK.cmake for this BLAS variant. -- You received this bug notification because you are a member of Hugin Developers, which is subscribed to Hugin. https://bugs.launchpad.net/bugs/1892420 Title: levmar uses BLAS when built with LAPACK, but Hugin does not link against BLAS Status in Hugin: Incomplete Status in hugin package in Gentoo Linux: New Bug description: ``` hugin-2019.2.0/src/foreign/levmar/misc_core.c:45:#define GEMM LM_MK_BLAS_NAME(gemm) ``` This function is a BLAS function: https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3 Thus, since levmar is built as a static library, Hugin itself should call `find_package(BLAS)` and `huginbase` should link against `BLAS_LIBRARIES`. Attached patch fixes this (in an admittedly slightly crude way) for me. To manage notifications about this bug go to: https://bugs.launchpad.net/hugin/+bug/1892420/+subscriptions ___ Mailing list: https://launchpad.net/~hugin-devs Post to : hugin-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~hugin-devs More help : https://help.launchpad.net/ListHelp
[Hugin-devs] [Bug 1892420] Re: levmar uses BLAS when built with LAPACK, but Hugin does not link against BLAS
Launchpad has imported 2 comments from the remote bug at https://bugs.gentoo.org/show_bug.cgi?id=738274. If you reply to an imported comment from within Launchpad, your comment will be sent to the remote bug automatically. Read more about Launchpad's inter-bugtracker facilities at https://help.launchpad.net/InterBugTracking. On 2020-08-20T21:11:59+00:00 devurandom wrote: Created attachment 655810 hugin-2019.2-lapack-blas.patch cd /tmp/portage/media-gfx/hugin-2019.2.0/work/hugin-2019.2.0_build/src/tools && /usr/bin/cmake -E cmake_link_script CMakeFiles/cpclean.dir/link.txt --verbose=1 /usr/sbin/x86_64-pc-linux-gnu-g++ -pipe -O2 -march=znver1 -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -fopenmp CMakeFiles/cpclean.dir/cpclean.cpp.o -o cpclean -Wl,-rpath,/tmp/portage/media-gfx/hugin-2019.2.0/work/hugin-2019.2.0_build/src/hugin_base: ../hugin_base/libhuginbase.so.0.0 /usr/lib64/libpano13.so ../foreign/levmar/libhuginlevmar.a /usr/lib64/libGLEW.so /usr/lib64/libboost_filesystem-mt.so /usr/lib64/libboost_system-mt.so /usr/lib64/liblapack.so /usr/lib64/libfftw3.so /usr/lib64/libvigraimpex.so /usr/lib64/libImath.so /usr/lib64/libIlmImf.so /usr/lib64/libIex.so /usr/lib64/libHalf.so /usr/lib64/libIlmThread.so /usr/lib64/libz.so /usr/lib64/libjpeg.so /usr/lib64/libtiff.so /usr/lib64/libpng.so /usr/lib64/libz.so /usr/lib64/libz.so /usr/lib64/libexiv2.so /usr/lib64/liblcms2.so -pthread /usr/lib64/libX11.so /usr/lib64/libpano13.so /usr/lib64/libboost_filesystem-mt.so /usr/lib64/libboost_system-mt.so /usr/lib64/liblapack.so /usr/lib64/libGL.so /usr/lib64/libGLU.so /usr/lib64/libGLEW.so /usr/lib64/libsqlite3.so /usr/lib64/libvigraimpex.so /usr/lib64/libjpeg.so /usr/lib64/libpng.so /usr/lib64/libtiff.so /usr/lib64/libexiv2.so /usr/lib64/liblcms2.so ../hugin_base/libhuginbase.so.0.0: error: undefined reference to 'dgemm_' collect2: error: ld returned 1 exit status ``` hugin-2019.2.0/src/foreign/levmar/misc_core.c:45:#define GEMM LM_MK_BLAS_NAME(gemm) ``` This function is a BLAS function: https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3 Thus, since levmar is built as a static library, Hugin itself should call `find_package(BLAS)` and `huginbase` should link against `BLAS_LIBRARIES`. Attached patch fixes this (in an admittedly slightly crude way) for me. Upstream report: https://bugs.launchpad.net/hugin/+bug/1892420 Portage 3.0.4 (python 3.6.9-final-0, default/linux/amd64/17.1/desktop/plasma/systemd, gcc-10.2.0, glibc-2.32, 5.8.1 x86_64) = System Settings = System uname: Linux-5.8.1-x86_64-AMD_Ryzen_5_2400G_with_Radeon_Vega_Graphics-with-gentoo-2.7 KiB Mem:14194336 total, 1928084 free KiB Swap: 0 total, 0 free Timestamp of repository gentoo: Thu, 20 Aug 2020 18:45:01 + Head commit of repository gentoo: ff03def29006e7148fdf3efbe1ccd8f2ff2c646d Head commit of repository flatpak-overlay: 26c396aef4d2f8908eea9b3ad2ccf7dc843a0887 Head commit of repository local: 8e22343ec3e3332f91a6a171a891407c95a0d44d sh bash 5.0_p18 ld GNU gold (Gentoo 2.34 p6 2.34.0) 1.16 ccache version 3.7.11 [disabled] app-shells/bash: 5.0_p18::gentoo dev-java/java-config: 2.3.1::gentoo dev-lang/perl:5.30.3-r1::gentoo dev-lang/python: 2.7.18-r1::gentoo, 3.6.12::gentoo, 3.7.9::gentoo, 3.8.5::gentoo, 3.9.0_rc1::gentoo dev-util/ccache: 3.7.11::gentoo dev-util/cmake: 3.18.1::gentoo dev-util/pkgconfig: 0.29.2::gentoo sys-apps/baselayout: 2.7::gentoo sys-apps/sandbox: 2.20::gentoo sys-devel/autoconf: 2.13-r1::gentoo, 2.69-r5::gentoo sys-devel/automake: 1.13.4-r2::gentoo, 1.16.2::gentoo sys-devel/binutils: 2.34-r2::gentoo sys-devel/gcc:10.2.0::gentoo sys-devel/gcc-config: 2.3.1::gentoo sys-devel/libtool:2.4.6-r6::gentoo sys-devel/make: 4.3::gentoo sys-kernel/linux-headers: 5.8::gentoo (virtual/os-headers) sys-libs/glibc: 2.32::gentoo Repositories: gentoo location: /var/cache/portage/gentoo sync-type: rsync sync-uri: rsync://rsync.de.gentoo.org/gentoo-portage priority: -1000 sync-rsync-extra-opts: --new-compress sync-rsync-verify-jobs: 1 sync-rsync-verify-max-age: 24 sync-rsync-verify-metamanifest: yes flatpak-overlay location: /var/db/repos/flatpak-overlay sync-type: git sync-uri: https://github.com/fosero/flatpak-overlay.git masters: gentoo crossdev location: /var/cache/portage/crossdev masters: gentoo priority: 100 local location: /var/cache/portage/local sync-type: git sync-uri: https://github.com/devurandom/gentoo-overlay.git masters: gentoo priority: 1000 ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="@FREE" CBUILD="x86_64-pc-linux-gnu"
[Hugin-devs] [Bug 1892420] Re: levmar uses BLAS when built with LAPACK, but Hugin does not link against BLAS
> Also before applying the patch I would be interested in a comparison between self-contained levmar and levmar+LAPACK. [...] If there is no improvement of using LAPACK then maybe the LAPACK detection should be removed. If the benefits of this build-system feature of Hugin are unknown, I agree it is a good idea to remove it. Maybe someone will complain about the removal and provide you with insights on why the option was originally introduced. -- You received this bug notification because you are a member of Hugin Developers, which is subscribed to Hugin. https://bugs.launchpad.net/bugs/1892420 Title: levmar uses BLAS when built with LAPACK, but Hugin does not link against BLAS Status in Hugin: Incomplete Status in hugin package in Gentoo Linux: Unknown Bug description: ``` hugin-2019.2.0/src/foreign/levmar/misc_core.c:45:#define GEMM LM_MK_BLAS_NAME(gemm) ``` This function is a BLAS function: https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3 Thus, since levmar is built as a static library, Hugin itself should call `find_package(BLAS)` and `huginbase` should link against `BLAS_LIBRARIES`. Attached patch fixes this (in an admittedly slightly crude way) for me. To manage notifications about this bug go to: https://bugs.launchpad.net/hugin/+bug/1892420/+subscriptions ___ Mailing list: https://launchpad.net/~hugin-devs Post to : hugin-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~hugin-devs More help : https://help.launchpad.net/ListHelp
[Hugin-devs] [Bug 1892420] Re: levmar uses BLAS when built with LAPACK, but Hugin does not link against BLAS
> What is the error the build system report without the patch? cd /tmp/portage/media-gfx/hugin-2019.2.0/work/hugin-2019.2.0_build/src/tools && /usr/bin/cmake -E cmake_link_script CMakeFiles/cpclean.dir/link.txt --verbose=1 /usr/sbin/x86_64-pc-linux-gnu-g++ -pipe -O2 -march=znver1 -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -fopenmp CMakeFiles/cpclean.dir/cpclean.cpp.o -o cpclean -Wl,-rpath,/tmp/portage/media-gfx/hugin-2019.2.0/work/hugin-2019.2.0_build/src/hugin_base: ../hugin_base/libhuginbase.so.0.0 /usr/lib64/libpano13.so ../foreign/levmar/libhuginlevmar.a /usr/lib64/libGLEW.so /usr/lib64/libboost_filesystem-mt.so /usr/lib64/libboost_system-mt.so /usr/lib64/liblapack.so /usr/lib64/libfftw3.so /usr/lib64/libvigraimpex.so /usr/lib64/libImath.so /usr/lib64/libIlmImf.so /usr/lib64/libIex.so /usr/lib64/libHalf.so /usr/lib64/libIlmThread.so /usr/lib64/libz.so /usr/lib64/libjpeg.so /usr/lib64/libtiff.so /usr/lib64/libpng.so /usr/lib64/libz.so /usr/lib64/libz.so /usr/lib64/libexiv2.so /usr/lib64/liblcms2.so -pthread /usr/lib64/libX11.so /usr/lib64/libpano13.so /usr/lib64/libboost_filesystem-mt.so /usr/lib64/libboost_system-mt.so /usr/lib64/liblapack.so /usr/lib64/libGL.so /usr/lib64/libGLU.so /usr/lib64/libGLEW.so /usr/lib64/libsqlite3.so /usr/lib64/libvigraimpex.so /usr/lib64/libjpeg.so /usr/lib64/libpng.so /usr/lib64/libtiff.so /usr/lib64/libexiv2.so /usr/lib64/liblcms2.so ../hugin_base/libhuginbase.so.0.0: error: undefined reference to 'dgemm_' collect2: error: ld returned 1 exit status You can find more details at: https://bugs.gentoo.org/738274 ** Bug watch added: Gentoo Bugzilla #738274 https://bugs.gentoo.org/show_bug.cgi?id=738274 ** Also affects: hugin (Gentoo Linux) via https://bugs.gentoo.org/show_bug.cgi?id=738274 Importance: Unknown Status: Unknown ** Attachment added: "build.log" https://bugs.launchpad.net/gentoo/+source/hugin/+bug/1892420/+attachment/5403584/+files/build.log -- You received this bug notification because you are a member of Hugin Developers, which is subscribed to Hugin. https://bugs.launchpad.net/bugs/1892420 Title: levmar uses BLAS when built with LAPACK, but Hugin does not link against BLAS Status in Hugin: Incomplete Status in hugin package in Gentoo Linux: Unknown Bug description: ``` hugin-2019.2.0/src/foreign/levmar/misc_core.c:45:#define GEMM LM_MK_BLAS_NAME(gemm) ``` This function is a BLAS function: https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3 Thus, since levmar is built as a static library, Hugin itself should call `find_package(BLAS)` and `huginbase` should link against `BLAS_LIBRARIES`. Attached patch fixes this (in an admittedly slightly crude way) for me. To manage notifications about this bug go to: https://bugs.launchpad.net/hugin/+bug/1892420/+subscriptions ___ Mailing list: https://launchpad.net/~hugin-devs Post to : hugin-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~hugin-devs More help : https://help.launchpad.net/ListHelp