diff --git a/.github/workflows/containerized-ci.yml b/.github/workflows/containerized-ci.yml index c9a8dd75e..50ee48e68 100644 --- a/.github/workflows/containerized-ci.yml +++ b/.github/workflows/containerized-ci.yml @@ -51,9 +51,10 @@ jobs: FCFLAGS: ${{ matrix.fcflags }} # CMake variables: NFHOME: /opt/netcdf-fortran - FP_MODEL: ${{ matrix.fpmodel }} + RTE_BOOL: C RTE_KERNELS: ${{ matrix.rte-kernels }} RRTMGP_DATA_VERSION: v1.8.2 + BUILD_TYPE: Debug RUN_CMD: # https://github.com/earth-system-radiation/rte-rrtmgp/issues/194 OMP_TARGET_OFFLOAD: DISABLED @@ -71,7 +72,7 @@ jobs: - name: Install Required Tools run: | apt-get update - apt-get install -y git cmake + apt-get install -y git cmake ninja-build # # Update Failure threshold if single precision # @@ -85,16 +86,20 @@ jobs: id: build-success if: matrix.fortran-compiler != 'ifx' || matrix.rte-kernels != 'accel' run: | - $FC --version - cmake -S . -B build \ - -DCMAKE_Fortran_COMPILER=$FC \ - -DCMAKE_Fortran_FLAGS="$FCFLAGS" \ - -DRRTMGP_DATA_VERSION=$RRTMGP_DATA_VERSION \ - -DPRECISION=$FP_MODEL \ - -DKERNEL_MODE=$RTE_KERNELS \ - -DENABLE_TESTS=ON \ - -DFAILURE_THRESHOLD=$FAILURE_THRESHOLD - cmake --build build --config Release -- -j8 + # Run CMake + cmake -S . -B build -G "Ninja" \ + -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ + -DCMAKE_Fortran_COMPILER=${{ env.FC }} \ + -DCMAKE_Fortran_FLAGS="${{ env.FCFLAGS }}" \ + -DRRTMGP_DATA_VERSION=${{ env.RRTMGP_DATA_VERSION }} \ + -DPRECISION=${{ matrix.fpmodel }} \ + -DBOOL_TYPE=${{ env.RTE_BOOL }} \ + -DKERNEL_MODE=${{ env.RTE_KERNELS }} \ + -DENABLE_TESTS=ON \ + -DFAILURE_THRESHOLD=${{ env.FAILURE_THRESHOLD }} + + # Build the project + cmake --build build -- -j8 # # Run examples and tests # diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index e4825ef9f..37cc49c98 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -21,42 +21,41 @@ jobs: fail-fast: false matrix: os: [ubuntu-22.04, macos-13, windows-2022] - toolchain: - - {compiler: gcc, version: 10} - - {compiler: gcc, version: 11} - - {compiler: gcc, version: 12} - - {compiler: gcc, version: 13} + compiler: [gfortran-10, gfortran-11, gfortran-12, gfortran-13] + use-conda-compiler: [true, false] fpmodel: [DP, SP] + # Conda does not contain gfortran-10/11/12 for windows exclude: - os: windows-2022 - toolchain: {compiler: gcc, version: 10} + compiler: gfortran-10 - os: windows-2022 - toolchain: {compiler: gcc, version: 11} - include: - - toolchain: {compiler: gcc, version: 10} - FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan -g" - - toolchain: {compiler: gcc, version: 11} - FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan -g" - - toolchain: {compiler: gcc, version: 12} - FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan -g" - - toolchain: {compiler: gcc, version: 13} - FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan -g" + compiler: gfortran-11 + - os: windows-2022 + compiler: gfortran-12 + - os: windows-2022 + use-conda-compiler: false + + - os: macos-13 + use-conda-compiler: false + + - os: ubuntu-22.04 + use-conda-compiler: false + compiler: gfortran-13 env: + FC: ${{ matrix.compiler }} + FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan" RTE_KERNELS: default RTE_BOOL: C RRTMGP_DATA_VERSION: v1.8.2 FAILURE_THRESHOLD: 7.e-4 + # Debug - works + # Release - works with conda gfortran + # RelWithDebInfo - works + # MinSizeRel - works + BUILD_TYPE: Debug runs-on: ${{ matrix.os }} steps: # - # Set up Fortran compilers - # - - uses: fortran-lang/setup-fortran@v1 - id: setup-fortran - with: - compiler: ${{ matrix.toolchain.compiler }} - version: ${{ matrix.toolchain.version }} - # # Relax failure thresholds for single precision # - name: Relax failure threshold for single precision @@ -93,23 +92,44 @@ jobs: # - name: Install dependencies run: | + FC_VERSION="${{ env.FC }}" + FC_VERSION="${FC_VERSION##*-}" + echo "FC version: $FC_VERSION" + conda install -c conda-forge netcdf-fortran ninja -y + + if ${{ matrix.use-conda-compiler }}; then + conda install -c conda-forge gfortran=$FC_VERSION -y + fi # # Build libraries, examples, and tests # - name: Build libraries and tests run: | - # Set platform-specific variables AR_PATH="$(which ar)" RANLIB_PATH="$(which ranlib)" + FC_PATH="$(which gfortran)" + + if [[ "${{ matrix.os }}" == "windows-2022" ]]; then + AR_PATH="$AR_PATH.exe" + RANLIB_PATH="$RANLIB_PATH.exe" + FC_PATH="$FC_PATH.exe" + fi + + # If not using conda, use the environment's FC variable instead of which gfortran + if ! ${{ matrix.use-conda-compiler }}; then + FC_PATH=${{ env.FC }} + fi echo "Using AR: $AR_PATH" echo "Using RANLIB: $RANLIB_PATH" + echo "Using FC: $FC_PATH" # Run CMake cmake -S . -B build -G "Ninja" \ - -DCMAKE_Fortran_COMPILER="${{ env.FC }}" \ - -DCMAKE_Fortran_FLAGS="${{ matrix.FCFLAGS }}" \ + -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ + -DCMAKE_Fortran_COMPILER="$FC_PATH" \ + -DCMAKE_Fortran_FLAGS="${{ env.FCFLAGS }}" \ -DCMAKE_AR="$AR_PATH" \ -DCMAKE_RANLIB="$RANLIB_PATH" \ -DRRTMGP_DATA_VERSION=${{ env.RRTMGP_DATA_VERSION }} \ @@ -120,7 +140,7 @@ jobs: -DFAILURE_THRESHOLD=${{ env.FAILURE_THRESHOLD }} # Build the project - cmake --build build --config Release -- -j8 + cmake --build build -- -j8 # # Run examples, tests and checks # diff --git a/CMakeLists.txt b/CMakeLists.txt index ef83cdbf8..95db7a5ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,7 @@ message(STATUS "Adding compiler definition -DRTE_USE_${BOOL_TYPE}BOOL") set(CMAKE_Fortran_FLAGS "" CACHE STRING "Select Fortran compile flags") -set(PREFERRED_FC_COMPILERS "gfortran" "gfortran-10" "gfortran-11" "gfortran-12" "ifort" "ifx" "nvfortran" "f77") +set(PREFERRED_FC_COMPILERS "gfortran" "gfortran-10" "gfortran-11" "gfortran-12" "gfortran-13" "ifort" "ifx" "nvfortran" "f77") if(NOT WINDOWS) set(CMAKE_Fortran_COMPILER "gfortran" CACHE STRING "Select the Fortran compiler: ${PREFERRED_FC_COMPILERS}")