diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index 8f5deb9fb1..ba161c239a 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -37,11 +37,12 @@ jobs: strategy: fail-fast: false matrix: - compiler: [gfortran-10, gfortran-11, gfortran-12, ifort] + compiler: [gfortran-10, gfortran-11, gfortran-12] env: F90: ${{ matrix.compiler }} FC: ${{ matrix.compiler }} F90FLAGS: "-O3 -ffree-line-length-none -fcheck=bounds -finit-real=nan" + NFHOME: /usr ATOL: 0.0 RTOL: 0.0 KGO_VERSION: v002 @@ -63,96 +64,18 @@ jobs: python-version: 3.11 - name: Install python packages run: conda install --yes cartopy matplotlib netcdf4 - ############################################################################### - # FORTRAN compilers - ############################################################################### - # - # Intel compilers - # - - name: cache-intel-compilers - id: cache-intel-compilers - if: contains(matrix.compiler, 'ifort') - uses: actions/cache@v2 - with: - path: /opt/intel - key: intel-${{ runner.os }}-compilers-b - - # https://software.intel.com/content/www/us/en/develop/articles/installing-intel-oneapi-toolkits-via-apt.html - # List of packages from Docler file at - # https://github.com/intel/oneapi-containers/blob/master/images/docker/hpckit-devel-ubuntu18.04/Dockerfile - - name: Install Intel compilers and libraries - if: contains(matrix.compiler, 'ifort') && steps.cache-intel-compilers.outputs.cache-hit != 'true' - run: | - wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB - sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB - sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main" - sudo apt-get update - sudo apt-get install intel-hpckit-getting-started intel-oneapi-clck intel-oneapi-common-licensing intel-oneapi-common-vars - sudo apt-get install intel-oneapi-dev-utilities intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic intel-oneapi-compiler-fortran intel-oneapi-itac - - ############################################################################### - # Compiler-specific environment - ############################################################################### - - name: Environment for Gfortran compiler - if: contains(matrix.compiler, 'gfortran') - run: echo "NFHOME=/usr" > $GITHUB_ENV - - - name: Environment for ifort compiler - if: contains(matrix.compiler, 'ifort') - run: | - echo "CC=icx" > $GITHUB_ENV - echo "FC=ifort" > $GITHUB_ENV - echo "F90FLAGS=-O3 -heap-arrays" > $GITHUB_ENV - echo "NFHOME=/home/runner/netcdf-fortran" > $GITHUB_ENV - echo "LD_LIBRARY_PATH=/home/runner/netcdf-fortran/lib" > $GITHUB_ENV - - ############################################################################### # NetCDF C and FORTRAN libraries - ############################################################################### - # NetCDF C library - name: Install NetCDF library run: | sudo apt-get update - sudo apt-get install libnetcdf-dev - - - name: Install NetCDF Fortran library - if: contains(matrix.compiler, 'gfortran') - run: sudo apt-get install libnetcdff-dev - - # Cache netcdf FORTRAN library - - name: cache-netcdf-fortran - id: cache-netcdf-fortran - if: contains(matrix.compiler, 'ifort') - uses: actions/cache@v2 - with: - path: /home/runner/netcdf-fortran - key: netcdf-fortran-4.4.4a-${{ runner.os }}-${{ matrix.compiler }}-v02 + sudo apt-get install libnetcdff-dev - # Build NetCDF FORTRAN library for current compiler - - name: Build NetCDF FORTRAN library - if: contains(matrix.compiler, 'ifort') && steps.cache-netcdf-fortran.outputs.cache-hit != 'true' - env: - FCFLAGS: -fPIC - run: | - source /opt/intel/oneapi/setvars.sh || true - which ifort - which ifx - ${F90} --version - git clone https://github.com/Unidata/netcdf-fortran.git --branch v4.4.4 - cd netcdf-fortran - ./configure --prefix=${NFHOME} - make -j - sudo make install ############################################################################### # Build COSP and retrieve input and test files ############################################################################### - # Build COSP2 driver. Intel Fortran stores automatic arrays in the stack - # by default, whereas GNU Fortran stores them in the heap. This can cause - # segmentation faults with ifort, especially in memory-intensive applications - # like COSP. We tell ifort to use heap arrays. + # Build COSP2 driver. - name: Build driver run: | - source /opt/intel/oneapi/setvars.sh || true ${F90} --version cd build make -j driver @@ -199,7 +122,6 @@ jobs: ./cosp2_test cosp2_input_nl.um_global.txt # 2. UM global snapshot. Diagnostics on model levels. - name: UM global snapshot. Diagnostics on model levels. - if: contains(matrix.compiler, 'gfortran') run: | cd driver/run ./cosp2_test cosp2_input_nl.um_global_model_levels.txt cosp2_output_nl.um_global_model_levels.txt @@ -210,36 +132,19 @@ jobs: # 1. Basic test - name: Basic against known good output (KGO) run: | - if [[ "${F90}" != 'gfortran' ]]; then - ATOL=1.0e-20 - RTOL=0.0006 - fi cd driver KGO=data/outputs/UKMO/cosp2_output_um.gfortran.kgo.$KGO_VERSION.nc TST=data/outputs/UKMO/cosp2_output_um.nc python compare_to_kgo.py ${KGO} ${TST} --atol=${ATOL} --rtol=${RTOL} - # 2. UM global snapshot. The approach used for the basic test would needed - # large tolerances for the ifort compiler. We keep tolerances small for ifort, - # and then we test against the output table. + # 2. UM global snapshot. - name: UM global against known good output (KGO) run: | cd driver KGO=data/outputs/UKMO/cosp2_output.um_global.gfortran.kgo.$KGO_VERSION.nc TST=data/outputs/UKMO/cosp2_output.um_global.nc - if [[ "${F90}" = 'gfortran' ]]; then - python compare_to_kgo.py ${KGO} ${TST} --atol=${ATOL} --rtol=${RTOL} - else - ATOL=1.0e-20 - RTOL=0.0006 - OUTTST=data/outputs/UKMO/cosp2_output.um_global.out - OUTKGO=data/outputs/UKMO/cosp2_output.um_global.${F90}.kgo.${KGO_VERSION}.out - python compare_to_kgo.py ${KGO} ${TST} --atol=${ATOL} --rtol=${RTOL} \ - --noerror=True --stats_file=${OUTTST} - diff ${OUTKGO} ${OUTTST} - fi - # 3. UM global snapshot. Diagnostics on model levels. Only gfortran. + python compare_to_kgo.py ${KGO} ${TST} --atol=${ATOL} --rtol=${RTOL} + # 3. UM global snapshot. Diagnostics on model levels. - name: UM global on model levels against known good output (KGO) - if: contains(matrix.compiler, 'gfortran') run: | cd driver KGO=data/outputs/UKMO/cosp2_output.um_global_model_levels.gfortran.kgo.$KGO_VERSION.nc