Skip to content

Commit

Permalink
Adds test in the CI for the installation of CBLAS and LAPACKE without…
Browse files Browse the repository at this point in the history
… Fortran compiler
  • Loading branch information
weslleyspereira committed Oct 31, 2023
1 parent 981af11 commit bf50aff
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 11 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,34 @@ jobs:
echo "Coverage"
cmake --build build --target coverage
bash <(curl -s https://codecov.io/bash) -X gcov
test-install-cblas-lapacke-without-fortran-compiler:
runs-on: ubuntu-latest
steps:
- name: Checkout LAPACK
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 # v3

- name: Install basics
run: |
sudo apt update
sudo apt install -y cmake liblapack-dev libblas-dev
sudo apt purge gfortran
- name: Configure CMake
run: >
cmake -B build -G Ninja
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/lapack_install
-D CBLAS:BOOL=ON
-D LAPACKE:BOOL=ON
-D USE_OPTIMIZED_BLAS:BOOL=ON
-D USE_OPTIMIZED_LAPACK:BOOL=ON
-D BUILD_TESTING:BOOL=OFF
-D LAPACKE_WITH_TMG:BOOL=OFF
-D BUILD_SHARED_LIBS:BOOL=ON
- name: Install
run: cmake --build build --target install -j2
32 changes: 21 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -278,18 +278,27 @@ endif()

# Check the usage of the user provided or automatically found LAPACK libraries
if(LAPACK_LIBRARIES)
include(CheckFortranFunctionExists)
set(CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES})
# Check if new routine of 3.4.0 is in LAPACK_LIBRARIES
CHECK_FORTRAN_FUNCTION_EXISTS("dgeqrt" LATESTLAPACK_FOUND)
unset(CMAKE_REQUIRED_LIBRARIES)
if(LATESTLAPACK_FOUND)
message(STATUS "--> LAPACK supplied by user is WORKING, will use ${LAPACK_LIBRARIES}.")
include(CheckLanguage)
check_language(Fortran)
if(CMAKE_Fortran_COMPILER)
enable_language(Fortran)
include(CheckFortranFunctionExists)
set(CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES})
# Check if new routine of 3.4.0 is in LAPACK_LIBRARIES
CHECK_FORTRAN_FUNCTION_EXISTS("dgeqrt" LATESTLAPACK_FOUND)
unset(CMAKE_REQUIRED_LIBRARIES)
if(LATESTLAPACK_FOUND)
message(STATUS "--> LAPACK supplied by user is WORKING, will use ${LAPACK_LIBRARIES}.")
else()
message(ERROR "--> LAPACK supplied by user is not WORKING or is older than LAPACK 3.4.0, CANNOT USE ${LAPACK_LIBRARIES}.")
message(ERROR "--> Will use REFERENCE LAPACK (by default)")
message(ERROR "--> Or Correct your LAPACK_LIBRARIES entry ")
message(ERROR "--> Or Consider checking USE_OPTIMIZED_LAPACK")
endif()
else()
message(ERROR "--> LAPACK supplied by user is not WORKING or is older than LAPACK 3.4.0, CANNOT USE ${LAPACK_LIBRARIES}.")
message(ERROR "--> Will use REFERENCE LAPACK (by default)")
message(ERROR "--> Or Correct your LAPACK_LIBRARIES entry ")
message(ERROR "--> Or Consider checking USE_OPTIMIZED_LAPACK")
message(STATUS "--> LAPACK supplied by user is ${LAPACK_LIBRARIES}.")
message(STATUS "--> CMake couldn't find a Fortran compiler, so it cannot check if the provided LAPACK library works.")
set(LATESTLAPACK_FOUND TRUE)
endif()
endif()

Expand Down Expand Up @@ -350,6 +359,7 @@ endif()
# Cache export target
set(LAPACK_INSTALL_EXPORT_NAME_CACHE ${LAPACK_INSTALL_EXPORT_NAME})
if(BUILD_TESTING OR LAPACKE_WITH_TMG)
enable_language(Fortran)
if(LATESTLAPACK_FOUND AND LAPACKE_WITH_TMG)
set(CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES})
# Check if dlatms (part of tmg) is found
Expand Down

0 comments on commit bf50aff

Please sign in to comment.