Fix script for preprocessing LAI for sites #863
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build | |
| # Controls when the action will run | |
| on: | |
| # Trigger the workflow on all pushes, except on tag creation | |
| push: | |
| branches: | |
| - '**' | |
| tags-ignore: | |
| - '**' | |
| # Trigger the workflow on all pull requests | |
| pull_request: ~ | |
| # Allow workflow to be dispatched on demand | |
| workflow_dispatch: ~ | |
| env: | |
| ECLAND_TOOLS: ${{ github.workspace }}/.github/tools | |
| CTEST_PARALLEL_LEVEL: 1 | |
| CACHE_SUFFIX: v1 # Increase to force new cache to be created | |
| jobs: | |
| ci: | |
| name: ci | |
| strategy: | |
| fail-fast: false # false: try to complete all jobs | |
| matrix: | |
| build_type: [Bit, Debug] # Not passing tests with Release | |
| name: | |
| - linux gnu-14 | |
| - linux nvhpc-25.9 | |
| - linux intel-classic | |
| - linux intel-modern | |
| - macos | |
| - linux flang-20 | |
| include: | |
| - name: linux gnu-14 | |
| os: ubuntu-24.04 | |
| compiler: gnu-14 | |
| compiler_cc: gcc-14 | |
| compiler_cxx: g++-14 | |
| compiler_fc: gfortran-14 | |
| caching: true | |
| - name: linux nvhpc-25.9 | |
| os: ubuntu-24.04 | |
| compiler: nvhpc-25.9 | |
| compiler_cc: nvc | |
| compiler_cxx: nvc++ | |
| compiler_fc: nvfortran | |
| cmake_options: -DCMAKE_CXX_FLAGS=--diag_suppress177 -DECBUILD_Fortran_FLAGS=-tp=haswell | |
| # nvc++ 25.9 has a codegen bug where an AVX-512 SCALEFS node is | |
| # emitted by an idiom-recognition pass even on non-AVX-512 targets, | |
| # causing llc to ICE on some GH runner CPUs. Pin -tp=haswell to | |
| # constrain the target features so the pass cannot emit it. | |
| dep_eccodes_extra_options: -DCMAKE_CXX_FLAGS=-tp=haswell | |
| caching: true | |
| - name : linux intel-classic | |
| os: ubuntu-22.04 | |
| compiler: intel-classic | |
| compiler_cc: icc | |
| compiler_cxx: icpc | |
| compiler_fc: ifort | |
| caching: true | |
| - name : linux intel-modern | |
| os: ubuntu-24.04 | |
| compiler: intel-modern | |
| compiler_cc: icx | |
| compiler_cxx: icpx | |
| compiler_fc: ifx | |
| caching: true | |
| ctest_options: | | |
| --test-command "bash -c 'ulimit -s unlimited && ctest -VV --output-on-failure'" | |
| - name: macos | |
| # Xcode compiler requires empty environment variables, so we pass null (~) here | |
| os: macos-15 | |
| compiler: clang-17 | |
| compiler_cc: ~ | |
| compiler_cxx: ~ | |
| compiler_fc: gfortran-15 | |
| caching: true | |
| - name: linux flang-20 | |
| os: ubuntu-24.04 | |
| compiler: flang-20 | |
| compiler_cc: clang-20 | |
| compiler_cxx: clang++-20 | |
| compiler_fc: flang-20 | |
| caching: true | |
| openmpi_version: 5.0.7 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v2 | |
| - name: Environment | |
| run: | | |
| echo "DEPS_DIR=${{ runner.temp }}/deps" >> $GITHUB_ENV | |
| echo "CC=${{ matrix.compiler_cc }}" >> $GITHUB_ENV | |
| echo "CXX=${{ matrix.compiler_cxx }}" >> $GITHUB_ENV | |
| echo "FC=${{ matrix.compiler_fc }}" >> $GITHUB_ENV | |
| if [[ "${{ matrix.os }}" =~ macos ]]; then | |
| export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 | |
| export HOMEBREW_NO_AUTO_UPDATE=1 | |
| export HOMEBREW_NO_INSTALL_CLEANUP=1 | |
| export SDKROOT=$(xcrun --show-sdk-path) | |
| echo "HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1" >> $GITHUB_ENV | |
| echo "HOMEBREW_NO_AUTO_UPDATE=1" >> $GITHUB_ENV | |
| echo "HOMEBREW_NO_INSTALL_CLEANUP=1" >> $GITHUB_ENV | |
| echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV | |
| brew install ninja | |
| brew install libomp | |
| brew install libaec | |
| brew install coreutils | |
| brew install netcdf-fortran | |
| pip install fypp | |
| else | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential | |
| sudo apt-get install libaec-dev | |
| sudo apt-get install ninja-build libcurl4-openssl-dev | |
| fi | |
| if [[ "${{ matrix.name }}" =~ gnu ]]; then | |
| sudo apt-get install libnetcdff-dev | |
| sudo apt-get install libopenmpi-dev openmpi-bin | |
| fi | |
| printenv | |
| - name: Cache Dependencies | |
| # There seems to be a problem with cached NVHPC dependencies, | |
| # leading to SIGILL perhaps due to slightly different architectures | |
| if: matrix.caching | |
| id: deps-cache | |
| uses: pat-s/always-upload-cache@v2.1.5 | |
| with: | |
| path: ${{ env.DEPS_DIR }} | |
| key: deps-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.build_type }}-${{ matrix.prec }}-${{ env.CACHE_SUFFIX }} | |
| # Free up disk space for nvhpc | |
| - name: Free Disk Space (Ubuntu) | |
| uses: jlumbroso/free-disk-space@main | |
| if: contains( matrix.compiler, 'nvhpc' ) | |
| continue-on-error: true | |
| with: | |
| # this might remove tools that are actually needed, | |
| # if set to "true" but frees about 6 GB | |
| tool-cache: false | |
| # all of these default to true, but feel free to set to | |
| # "false" if necessary for your workflow | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: true | |
| swap-storage: true | |
| - name: Install NVHPC compiler | |
| if: contains( matrix.compiler, 'nvhpc' ) | |
| shell: bash -eux {0} | |
| run: | | |
| ${ECLAND_TOOLS}/install-nvhpc.sh --prefix /opt/nvhpc --version 25.9 | |
| source /opt/nvhpc/env.sh | |
| echo "${NVHPC_DIR}/compilers/bin" >> $GITHUB_PATH | |
| [ -z ${MPI_HOME+x} ] || echo "MPI_HOME=${MPI_HOME}" >> $GITHUB_ENV | |
| - name: Download Intel compiler | |
| if: contains( matrix.compiler, 'intel' ) | |
| run: | | |
| wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | |
| sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | |
| rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | |
| sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main" | |
| - name: Install Intel oneAPI compiler | |
| if: contains( matrix.compiler, 'intel-classic' ) | |
| run: | | |
| ${ECLAND_TOOLS}/install-intel-oneapi.sh | |
| source /opt/intel/oneapi/setvars.sh | |
| printenv >> $GITHUB_ENV | |
| echo "CACHE_SUFFIX=$CC-$($CC -dumpversion)" >> $GITHUB_ENV | |
| - name: Install Intel modern compiler | |
| if: contains( matrix.compiler, 'intel-modern' ) | |
| run: | | |
| sudo apt update | |
| sudo apt install intel-hpckit | |
| source /opt/intel/oneapi/2025.3/oneapi-vars.sh | |
| source /opt/intel/oneapi/setvars.sh --force | |
| printenv >> $GITHUB_ENV | |
| echo "CACHE_SUFFIX=$CC-$($CC -dumpversion)" >> $GITHUB_ENV | |
| - name: Install flang compiler | |
| if: contains( matrix.compiler, 'flang' ) | |
| run: | | |
| sudo apt-get install -y flang-20 clang-20 libomp-20-dev | |
| - name: Install MPI | |
| if: ${{ !contains(matrix.name, 'gnu') }} | |
| shell: bash -eux {0} | |
| run: | | |
| MPI_VERSION_FLAG="${{ matrix.openmpi_version && format('--version {0}', matrix.openmpi_version) || '' }}" | |
| FCFLAGS=-fPIC CFLAGS=-fPIC FFLAGS=-fPIC ${ECLAND_TOOLS}/install-mpi.sh --mpi openmpi --prefix ${DEPS_DIR}/openmpi ${MPI_VERSION_FLAG} | |
| [ -f ${DEPS_DIR}/openmpi/env.sh ] && source ${DEPS_DIR}/openmpi/env.sh | |
| [ -z ${MPI_HOME+x} ] || echo "MPI_HOME=${MPI_HOME}" >> $GITHUB_ENV | |
| - name: Set Build & Test Environment | |
| run: | | |
| # Add mpirun to path for testing | |
| [ -z ${MPI_HOME+x} ] || echo "${MPI_HOME}/bin" >> $GITHUB_PATH | |
| # Force UCX (and thus OpenMPI's UCX PML) onto TCP + shared-memory transports. | |
| # The GitHub-hosted Azure runners intermittently expose a MANA (mana_0) RDMA/ | |
| # InfiniBand device on which UCX fails to create UD queue-pairs, causing | |
| # MPI_Init to abort ("failed to create UD QP ... Operation not supported"). | |
| # These are single-node tests that never need RDMA, so restrict transports to | |
| # loopback TCP + shared memory to make MPI startup deterministic. | |
| echo "UCX_TLS=tcp,self,sm" >> $GITHUB_ENV | |
| echo "UCX_NET_DEVICES=lo" >> $GITHUB_ENV | |
| echo "UCX_LOG_LEVEL=error" >> $GITHUB_ENV | |
| - name: Install HDF5 | |
| if: contains( matrix.compiler, 'intel' ) || contains(matrix.compiler, 'nvhpc') || contains(matrix.compiler, 'flang') | |
| run: | | |
| if [[ -f ${{ env.DEPS_DIR }}/hdf5/lib/libhdf5.settings ]]; then | |
| echo "::debug::HDF5 restored from cache" | |
| else | |
| ${ECLAND_TOOLS}/install-hdf5.sh --prefix ${{ env.DEPS_DIR }}/hdf5 | |
| fi | |
| echo "HDF5_ROOT=${{ env.DEPS_DIR }}/hdf5" >> $GITHUB_ENV | |
| - name: Install NetCDF C | |
| if: contains( matrix.compiler, 'intel' ) || contains(matrix.compiler, 'nvhpc') || contains(matrix.compiler, 'flang') | |
| run: | | |
| if [[ -f ${{ env.DEPS_DIR }}/netcdf/bin/nc-config ]]; then | |
| echo "::debug::NetCDF C restored from cache" | |
| else | |
| ${ECLAND_TOOLS}/install-netcdf-c.sh --prefix ${{ env.DEPS_DIR }}/netcdf --hdf5-root ${HDF5_ROOT} --version 4.9.2 | |
| fi | |
| echo "NETCDF_ROOT=${{ env.DEPS_DIR }}/netcdf" >> $GITHUB_ENV | |
| - name: Install NetCDF Fortran | |
| if: contains( matrix.compiler, 'intel' ) || contains(matrix.compiler, 'nvhpc') || contains(matrix.compiler, 'flang') | |
| run: | | |
| if [[ -f ${NETCDF_ROOT}/bin/nf-config ]]; then | |
| echo "::debug::NetCDF Fortran restored from cache" | |
| else | |
| ${ECLAND_TOOLS}/install-netcdf-fortran.sh --prefix ${{ env.DEPS_DIR }}/netcdf --netcdf-root ${NETCDF_ROOT} --version 4.6.2 | |
| fi | |
| - name: Set Intel Classic Fortran compiler flags | |
| if: contains(matrix.compiler, 'intel-classic') | |
| run: echo "FC_FLAGS_CMAKE=-C ${{ github.workspace }}/.github/cmake-flags-intel-classic.cmake" >> $GITHUB_ENV | |
| - name: Build with CMake | |
| id: buildcmake | |
| env: | |
| VERBOSE: 1 | |
| uses: ecmwf-actions/build-package@v2 | |
| with: | |
| save_cache: false | |
| self_coverage: false | |
| force_build: true | |
| cache_suffix: "${{ matrix.compiler }}-${{ matrix.build_type }}-${{matrix.prec}}-${{ env.CACHE_SUFFIX }}" | |
| recreate_cache: ${{ !matrix.caching }} | |
| dependencies: | | |
| ecmwf/ecbuild@develop | |
| ecmwf-ifs/fiat@develop | |
| ecmwf-ifs/field_api@main | |
| ecmwf/eccodes@refs/tags/2.44.0 | |
| dependency_cmake_options: >- | |
| ecmwf/eccodes: | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
| -DENABLE_MEMFS=ON -DENABLE_JPG=OFF | |
| -DENABLE_PNG=OFF -DENABLE_NETCDF=OFF | |
| -DENABLE_JPG_LIBJASPER=OFF -DENABLE_JPG_LIBOPENJPEG=OFF | |
| -DENABLE_PRODUCT_GRIB=OFF ${{ matrix.dep_eccodes_extra_options }} | |
| ecmwf-ifs/fiat: | |
| -G Ninja | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
| -DENABLE_TESTS=OFF | |
| -DENABLE_DR_HOOK_NVTX=OFF | |
| -DENABLE_MPI=ON | |
| -DENABLE_SINGLE_PRECISION=ON | |
| -DENABLE_DOUBLE_PRECISION=ON | |
| ecmwf-ifs/field_api: | |
| -Dfiat_ROOT=${{ env.DEPS_DIR }}/fiat | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
| -DENABLE_TESTS=OFF | |
| -DENABLE_MPI=ON | |
| -DENABLE_SINGLE_PRECISION=ON | |
| -DENABLE_DOUBLE_PRECISION=ON | |
| -DENABLE_ACC=OFF | |
| ${{ env.FC_FLAGS_CMAKE }} | |
| cmake_options: >- | |
| -G Ninja | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
| -DENABLE_SINGLE_PRECISION=ON | |
| -DENABLE_DOUBLE_PRECISION=ON | |
| ${{ matrix.cmake_options }} | |
| ${{ env.FC_FLAGS_CMAKE }} | |
| self_build: true | |
| self_test: false | |
| - name: Run Tests | |
| shell: bash | |
| run: | | |
| if [[ "$(uname)" != "Darwin" ]]; then | |
| ulimit -s unlimited | |
| fi | |
| ctest -VV --output-on-failure ${{ matrix.ctest_options }} | |
| working-directory: build | |
| - name: Verify tools | |
| run: | | |
| export PATH=${{ steps.buildcmake.outputs.bin_path }}:$PATH | |
| echo "+ ecland --info" | |
| ecland --info | |
| # - name: Codecov Upload | |
| # if: steps.build-test.outputs.coverage_file | |
| # uses: codecov/codecov-action@v2 | |
| # with: | |
| # files: ${{ steps.build-test.outputs.coverage_file }} |