dev-cafe / autocmake

CMake plugin composer.
http://autocmake.org
BSD 3-Clause "New" or "Revised" License
42 stars 18 forks source link

Detection of openblas on both Linux and MS Windows (as libopenblas.dll) #29

Closed miroi closed 9 years ago

miroi commented 9 years ago

Hi,

concerning the current openblas support we have: https://github.com/scisoft/autocmake/blob/master/modules/math_libs.cmake#L115

we are missing the Windows OpenBLAS support, which is described here: https://github.com/xianyi/OpenBLAS/issues/461#issuecomment-74715665

According to this thread it would be good to incorporate OpenBLASConfig.cmake commands into math_libs.cmake to enable linking against "libopenblas.dll".

For example, passing (and linking) of openblas library works for DIRAC on MS Windows (https://gitlab.com/dirac/dirac/blob/master/maintenance/cdash/cdash.WinS12-Miro.bat#L67, see also https://gitlab.com/dirac/dirac/blob/master/cmake/math/MathLibs.cmake#L80 ).

Windows OpenBLAS version (libopenblas.dll) is needed for the new fc_openblas test I am currently working on.

miroi commented 9 years ago

Well, to be more precise, we are missing the OpenBLASConfig.cmake (either standalone, or as part of FindBLAS.cmake, see also https://github.com/xianyi/OpenBLAS/issues/461 ) to detect OpenBLAS on both Linux and Windows operating systems.

Currently, we have the fc_blas test (https://github.com/scisoft/autocmake/tree/master/test/fc_blas) with 'pure' BLAS detection and linking on Linux only.

With the OpenBLASConfig.cmake working, we could have the previously wanted fc_openblas test, designed for both Linux and Windows.

So I suggest to keep this issue open until the OpenBLAS detection in CMake get officially established. Comments please ?

PS1: I already asked OpenBLAS people for OpenBLASConfig.cmake, see https://groups.google.com/forum/#!topic/openblas-users/y9g16qXiJPg .

bast commented 9 years ago

Sounds good.

miroi commented 9 years ago

Hi,

I am trying to add the OpenBLAS search into "math_libs.cmake" and extend the ${MATH_LIB_SEARCH_ORDER} to "MKL;ESSL;OPENBLAS;ATLAS;ACML;SYSTEM_NATIVE"

Any help how to do that ? I would try it with new project with the CI service of https://github.com/miroi/mathlibs-tester/blob/master/circle.yml .

miroi commented 9 years ago

Ah, what works on my machine is :

python setup.py --fc=gfortran  --cmake-options="-DMATH_LIB_SEARCH_ORDER=OPENBLAS" --lapack=off  build_openblas_gfortran_nolapack

However, it's more difficult to convince travis-ci for proper OPENBLAS linking.

miroi commented 9 years ago

It turns out that on travis-ci there is some conflict between SYSTEM_NATIVE libs and openblas libs... Maybe I should try ATLAS and openblas into travis-ci tests.

miroi commented 9 years ago

Well, the _fcopenblas test is passing on my linux cluster (with fixed test.py), but on travis-ci it crashing due to missing BLAS library. This is Ubuntu-Linaro.

My Linux cluster:
test/test.py::test_cxx_custom PASSED
test/test.py::test_extra_cmake_options PASSED
test/test.py::test_cxx PASSED
test/test.py::test_fc PASSED
test/test.py::test_fc_git_info PASSED
test/test.py::test_fc_int64 PASSED
test/test.py::test_fc_mpi PASSED
test/test.py::test_fc_omp PASSED
test/test.py::test_fc_blas PASSED
test/test.py::test_fc_openblas PASSED
test/test.py::test_fc_lapack PASSED
miroi commented 9 years ago

Well, circleci is - after setting PATH vriable pointing to OpenBLAS library files - process correctly, see https://circleci.com/gh/miroi/autocmake/tree/fc_blas_openblas .

However, travis-ci - despite arranged PATH - showing failures: https://travis-ci.org/miroi/autocmake

miroi commented 9 years ago

Aaaah, I see - I had to modify math_libs.cmake : https://github.com/miroi/autocmake/blob/fc_blas_openblas/modules/math_libs.cmake#L117 Will ask for PR.

bast commented 9 years ago

Excellent! Is this problem now solved? Can it be closed?

miroi commented 9 years ago

Wait, please, I have to apply first for PR of working openblas test; and, later, adapt it for Windows system.

miroi commented 9 years ago

Well, for now I can not get the OpenBLAS detection on MS Windows. Also I have to check thoroughly the OpenBLAS detection on Linux.

PS: For inspiration : http://www.nektar.info/browser/cmake/FindOpenBlas.cmake

miroi commented 9 years ago

Hi again,

in addition to the PR #82 , I see that OpenBLAS contains also (most part) of LAPACK - see https://github.com/xianyi/OpenBLAS/issues/203#issuecomment-15296123 .

Therefore later (after accepting PR #82), I will adapt the fc_lapack test for MS Windows by using the famous OpenBLAS. For that, I will have to modify slightly the corresponding _mathlibs.cmake macro.

Comments please ?

miroi commented 9 years ago

Closed due accepted PR #82 and PR #88.