-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[openblas/clapack] FindLapack/FindBLAS was not working. #6786
Conversation
due to extra ascii symbol "%3b" in linker dependencies which is ";" (Lists in IMPORTED_LOCATION do not work as expected) This commit is based on CMakes FindLAPACK and adds f2c to be checked
could you please tell me if it works better for you what's in #6730? |
if it works, please let's work together there. We are wasting so much effort duplicating work for common broken things |
@cenit :
I think you have something wrong here. CMakes LAPACK does export BLAS! From FindLAPACK.cmake: My diff to CMakes supplied module: |
(I wrote the bugged FindLAPACK that you are trying to solve, sorry for the trouble) I think you almost catched the problem. It works both way: also FindBLAS sets up LAPACK_LIBRARIES, pointing to the same BLAS libraries! Because the two libraries are really entangled! Just as an example, clapack contains a blas reference implementation and openblas contains a lapack reference implementation!! But the problem here is that somehow it was decided to split them here instead of using one to do both (mostly due to the absence of a fortran reference implementation on vcpkg). OpenBLAS builds only BLAS functions Technically LAPACK depends on BLAS behind the doors, while the other way is not true. So if you trigger a default FindLAPACK.cmake or FindBLAS.cmake you find all libraries, while in reality half of them do not work here on vcpkg (on systems different than windows). The cmake cache mechanism also works against you, because if you search both libraries, the second one does nothing because cache is already filled and so you still get half of the cmake variables already filled with libraries that do not export the symbols that you need. So the mess, where in linux no port at the moment using lapack/blas really works. Note that they build (due to the static linking which does not check proper symbol resolution), but in the end they do not work! It was a nightmare at the beginning, but in that PR the lapack/blas mess is solved (and in the meantime I also improved the FindLAPACK that you see so that it should work also with VS generators). |
I don't see that in CMakes FindBLAS module. Maybe another port supplied FindBLAS ? So at least in CMake modules there is no cycle dependency between the find modules |
@cenit Concerning BLAS/LAPACK libraries. |
Which kind of implementation are you trying? OpenBLAS and CLapack? |
You had a small problem about a module I have written and never tested with vs generators. Official CMake modules fail for clapack and OpenBLAS, especially in the way vcpkg admins decided to use them. It is necessary to use custom module for lapack and self-configured config file for BLAS in order to be able to use them. IMHO no point at all in forcing a broken module by CMake with some additional (but still not sufficient) fixes! |
before i wrote my last comment I already changed the search name in FindBLAS to search without the trailing _ but the function TL;DR; OpenBLAS has bugs (setting BU too late?); FindBLAS also has bugs (missing thread library) |
should be
(probably true for all checked BLAS libraries; I'll think I will make a MR to CMake for this) |
Given the above, it seems like the right fix is then to:
It looks like this will also have impacts on #6730. |
After thinking about it and reading the discussion in #6786 I thing the linux error was to use clapack to begin with.... a) it is outdated (see http://nicolas.limare.net/pro/notes/2014/10/31_cblas_clapack_lapacke/); b) it is no longer maintained. So the solution should be: on windows: use openblas + clapack on linux: only use openblas + builtin lapack. And make ports depending on clapack using !linux so that clapack will not be used under linux (@seanwarren) (and maybe change openblas from cmake to configure scripts because i have the feeling that the cmakelists are not that well defined) Other solution would be: Althoug I solved the FindBLAS problem I still have not solved the FindLAPACK problem:
so have to check that symbol in openblas. It is there but missing the trailing _:
|
Ok I restored your PR and merged with master. There were many nice improvements that can still apply! Let's just see regressions for now, then we can better decide |
Thanks for the PR! |
due to extra ascii symbol "%3b" in linker dependencies which is ";"
(Lists in IMPORTED_LOCATION do not work as expected)
This commit is based on CMakes FindLAPACK and adds f2c to be checked