diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 386bc3d7..89bfa4de 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -2,16 +2,9 @@ name: CMake CI on: push: - paths-exclude: - - '.github/workflows/make.yml' - - '.gitignore' - - 'README' - - '**README' - - 'LICENSE' - - '**Makefile' - - 'SLmake.inc.example' + branches: [master] pull_request: - paths-exclude: + paths-ignore: - '.github/workflows/make.yml' - '.gitignore' - 'README' @@ -20,10 +13,14 @@ on: - '**Makefile' - 'SLmake.inc.example' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + env: CFLAGS: "-Wall -pedantic" FFLAGS: "-fcheck=all,no-bounds" - BUILD_TYPE: Release + CMAKE_BUILD_TYPE: Release MPIEXEC_PREFLAGS: "--oversubscribe" defaults: @@ -33,15 +30,22 @@ defaults: jobs: build-all: + name: > + CMake ${{ matrix.cmake }} runs-on: ubuntu-latest - + strategy: + matrix: + # CMake versions to test: + # - minimum and maximum in the `cmake_minimum_required` + # (if needed expand this to add all intermediate values + # for *temporary* CI testing) + # - latest version + cmake: ["3.26", "4.0", latest] + fail-fast: false steps: - name: Checkout ScaLAPACK - uses: actions/checkout@v2 - - - name: Install ninja-build tool - uses: seanmiddleditch/gha-setup-ninja@v3 + uses: actions/checkout@v4 - name: Setup MPI # uses: mpi4py/setup-mpi@v1 @@ -51,29 +55,32 @@ jobs: - name: Install BLAS and LAPACK run: sudo apt -y install libblas-dev liblapack-dev - + + - name: Setup CMake + uses: jwlawson/actions-setup-cmake@v2 + with: + cmake-version: ${{ matrix.cmake }} + - name: CMake configuration + # TODO: Use cmake presets for newer versions + # TODO: Simplify the defaults to not require configuration run: > - cmake -B build - -G Ninja - -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - -D CMAKE_INSTALL_PREFIX=${{github.workspace}}/scalapack_install - -D BUILD_SHARED_LIBS=ON - -D SCALAPACK_BUILD_TESTS=ON - -D MPIEXEC_PREFLAGS=${{env.MPIEXEC_PREFLAGS}} - + cmake -B build \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=${{env.CMAKE_BUILD_TYPE}} \ + -DBUILD_SHARED_LIBS=ON \ + -DSCALAPACK_BUILD_TESTS=ON \ + -DMPIEXEC_PREFLAGS=${{env.MPIEXEC_PREFLAGS}} + - name: Build - working-directory: ${{github.workspace}}/build - run: | - ctest -D ExperimentalStart - ctest -D ExperimentalConfigure - ctest -D ExperimentalBuild + run: > + cmake --build build - name: Test + # CMake<3.20 does not have -B option working-directory: ${{github.workspace}}/build - run: | - ctest -D ExperimentalTest --schedule-random --output-on-failure --timeout 180 - ctest -D ExperimentalSubmit - + run: > + ctest --output-on-failure + - name: Install - run: cmake --build build --target install + run: cmake --install build --prefix scalapack_install diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index 5c49e618..dbb0e50f 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -2,16 +2,9 @@ name: Makefile CI on: push: - paths-exclude: - - '.github/workflows/cmake.yml' - - '.gitignore' - - 'README' - - '**README' - - 'LICENSE' - - 'CMAKE**' - - '**CMakeLists.txt' + branches: [master] pull_request: - paths-exclude: + paths-ignore: - '.github/workflows/cmake.yml' - '.gitignore' - 'README' @@ -20,6 +13,10 @@ on: - 'CMAKE**' - '**CMakeLists.txt' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + defaults: run: shell: bash diff --git a/BLACS/INSTALL/CMakeLists.txt b/BLACS/INSTALL/CMakeLists.txt index c75773cd..acbb7430 100644 --- a/BLACS/INSTALL/CMakeLists.txt +++ b/BLACS/INSTALL/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.26...4.0) project(INSTALL C Fortran) add_executable(xintface Fintface.f Cintface.c) diff --git a/CMAKE/CTestCustom.cmake.in b/CMAKE/CTestCustom.cmake.in deleted file mode 100644 index ab940fa7..00000000 --- a/CMAKE/CTestCustom.cmake.in +++ /dev/null @@ -1,42 +0,0 @@ -# -# For further details regarding this file, -# see http://www.vtk.org/Wiki/CMake_Testing_With_CTest#Customizing_CTest -# - -SET(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 0) -SET(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 0) -SET(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 500) -SET(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 500) - -# Files to explicitly exclude from code coverage -SET(CTEST_CUSTOM_COVERAGE_EXCLUDE - ${CTEST_CUSTOM_COVERAGE_EXCLUDE} - - # Exclude the testing code itself from code coverage - "/TESTING/" -) - -# Warnings to explicitly ignore -SET(CTEST_CUSTOM_WARNING_EXCEPTION - ${CTEST_CUSTOM_WARNING_EXCEPTION} - - # Common warning when linking ATLAS built with GNU Fortran 4.1 and building - # with GNU Fortran 4.4. It can be safely ignored. - "libgfortran.*may conflict with libgfortran" - - # Harmless warning often seen on IRIX - "WARNING 84 : .*libm.* is not used for resolving any symbol" - - # Warnings caused by sun compilers when building code to only run on your - # native platform - "xarch=native on this architecture implies -xarch=.*which generates code that does not run" - - # Harmless warnings from the Intel compiler on Windows - "ipo: warning #11010: file format not recognized for .*\\.exe\\.embed\\.manifest\\.res" - "LINK : warning LNK4224: /INCREMENTAL:YES is no longer supported; ignored" - - # Warnings caused by string truncation in the test code. The truncation is - # intentional - "Character string truncated to length 1 on assignment" -) - diff --git a/CMAKE/FortranMangling.cmake b/CMAKE/FortranMangling.cmake index d03811c3..a8fd3524 100644 --- a/CMAKE/FortranMangling.cmake +++ b/CMAKE/FortranMangling.cmake @@ -8,67 +8,36 @@ # NoChange # f77IsF2C # UpCase -# - -FUNCTION(COMPILE RESULT) - MESSAGE(STATUS "=========") - MESSAGE(STATUS "Compiling and Building BLACS INSTALL Testing to set correct variables") +# - if(CMAKE_BUILD_TYPE) - SET(BUILD_TYPE -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}) - endif() +include_guard() - # Configure: - EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} - "${PROJECT_SOURCE_DIR}/BLACS/INSTALL" - -G ${CMAKE_GENERATOR} ${BUILD_TYPE} - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/BLACS/INSTALL/ - RESULT_VARIABLE RESVAR OUTPUT_VARIABLE LOG1_OUT ERROR_VARIABLE LOG1_ERR +block() + # TODO: This path is hard-coded + set(BLACS_INSTALL_SRC + ${CMAKE_CURRENT_LIST_DIR}/../BLACS/INSTALL ) - if(RESVAR EQUAL 0) - MESSAGE(STATUS "Configure in the INSTALL directory successful") - else() - MESSAGE(STATUS " Build Output:\n ${LOG1_OUT}") - MESSAGE(STATUS " Error Output:\n ${LOG1_ERR}") - MESSAGE(FATAL_ERROR " Configure in the BLACS INSTALL directory FAILED") - endif() - # Build: - EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} --build - ${PROJECT_SOURCE_DIR}/BLACS/INSTALL/ - RESULT_VARIABLE RESVAR OUTPUT_VARIABLE LOG2_OUT ERROR_VARIABLE LOG2_ERR + try_run(xintface_res xintface_compile_res + SOURCES + ${BLACS_INSTALL_SRC}/Fintface.f + ${BLACS_INSTALL_SRC}/Cintface.c + NO_CACHE + COMPILE_OUTPUT_VARIABLE xintface_compile_output + RUN_OUTPUT_VARIABLE xintface_output ) - if(RESVAR EQUAL 0) - MESSAGE(STATUS "Build in the BLACS INSTALL directory successful") - else() - MESSAGE(STATUS " Build Output:\n ${LOG2_OUT}") - MESSAGE(STATUS " Error Output:\n ${LOG2_ERR}") - MESSAGE(FATAL_ERROR " Build in the BLACS INSTALL directory FAILED") + if(NOT xintface_compile_res) + message(FATAL_ERROR + "Could not compile BLACS/INSTALL:\n" + "${xintface_compile_output}" + ) endif() - # Clean up: - FILE(REMOVE_RECURSE ${PROJECT_SOURCE_DIR}/BLACS/INSTALL/CMakeCache.txt) - FILE(REMOVE_RECURSE ${PROJECT_SOURCE_DIR}/BLACS/INSTALL/CMakeFiles ) -ENDFUNCTION() - - -macro(FORTRAN_MANGLING CDEFS) -MESSAGE(STATUS "=========") -MESSAGE(STATUS "Testing FORTRAN_MANGLING") - - execute_process ( COMMAND ${PROJECT_SOURCE_DIR}/BLACS/INSTALL/xintface - RESULT_VARIABLE xintface_RES - OUTPUT_VARIABLE xintface_OUT - ERROR_VARIABLE xintface_ERR) - - -# MESSAGE(STATUS "FORTRAN MANGLING:RUN \n${xintface_OUT}") - - if (xintface_RES EQUAL 0) - STRING(REPLACE "\n" "" xintface_OUT "${xintface_OUT}") - MESSAGE(STATUS "CDEFS set to ${xintface_OUT}") - SET(CDEFS ${xintface_OUT} CACHE STRING "Fortran Mangling" FORCE) - else() - MESSAGE(STATUS " xintface Output:\n ${xintface_OUT}") - MESSAGE(FATAL_ERROR "FORTRAN_MANGLING:ERROR ${xintface_ERR}") - endif() -endmacro(FORTRAN_MANGLING) + if(NOT ${xintface_res} EQUAL 0) + message(FATAL_ERROR + "xintface did not execute properly:\n" + "${xintface_output}" + ) + endif() + string(STRIP "${xintface_output}" xintface_output) + set(CDEFS ${xintface_output} CACHE STRING "Fortran Mangling") +endblock() diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d599305..2a6d0180 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,7 @@ -cmake_minimum_required(VERSION 3.9) +cmake_minimum_required(VERSION 3.26...4.0) project(SCALAPACK VERSION 2.2.2 LANGUAGES C Fortran) -# Configure the warning and code coverage suppression file -configure_file( - "${SCALAPACK_SOURCE_DIR}/CMAKE/CTestCustom.cmake.in" - "${SCALAPACK_BINARY_DIR}/CTestCustom.cmake" - COPYONLY -) - # Add the CMake directory for custon CMake modules set(CMAKE_MODULE_PATH "${SCALAPACK_SOURCE_DIR}/CMAKE" ${CMAKE_MODULE_PATH}) @@ -87,8 +80,6 @@ endmacro() # Testing SET(DART_TESTING_TIMEOUT 600) -enable_testing() -include(CTest) enable_testing() # -------------------------------------------------- @@ -127,11 +118,7 @@ set(PKG_CONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig CACHE PATH "pkg-config inst # Fortran Mangling, MPI Tests and BLACS settings # include(FortranMangling) -COMPILE(install_COMPILED) -if (NOT DEFINED CDEFS) - FORTRAN_MANGLING(CDEFS) -endif () #MESSAGE(STATUS "Setting CDEFS = ${CDEFS}") #set(CDEFS ${CDEFS} CACHE STRING "Fortran Mangling" FORCE) MESSAGE(STATUS "=========") diff --git a/CTestConfig.cmake b/CTestConfig.cmake deleted file mode 100644 index 751db235..00000000 --- a/CTestConfig.cmake +++ /dev/null @@ -1,13 +0,0 @@ -## This file should be placed in the root directory of your project. -## Then modify the CMakeLists.txt file in the root directory of your -## project to incorporate the testing dashboard. -## # The following are required to uses Dart and the Cdash dashboard -## ENABLE_TESTING() -## INCLUDE(CTest) -set(CTEST_PROJECT_NAME "ScaLAPACK") -set(CTEST_NIGHTLY_START_TIME "00:00:00 EST") - -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "icl.cs.utk.edu/cdash") -set(CTEST_DROP_LOCATION "/submit.php?project=ScaLAPACK") -set(CTEST_DROP_SITE_CDASH TRUE)