3636 runs-on : ubuntu-18.04
3737 strategy :
3838 matrix :
39- fortran-compiler : [gfortran, gfortran-8, gfortran-9]
39+ fortran-compiler : [gfortran, gfortran-8, gfortran-9, ifort ]
4040 env :
4141 F90 : ${{ matrix.fortran-compiler }}
42+ F90FLAGS : " -O3 -ffree-line-length-none -fcheck=bounds -finit-real=nan"
43+ ATOL : 0.0
44+ RTOL : 0.0
4245 # Sequence of tasks that will be executed as part of the job
4346 steps :
4447 # Checks-out repository under $GITHUB_WORKSPACE
@@ -52,16 +55,34 @@ jobs:
5255 run : |
5356 python -m pip install --upgrade pip
5457 pip install netCDF4 argparse numpy
55- # Install FORTRAN compiler and NetCDF libraries
56- - name : Install FORTRAN compiler and NetCDF
57- run : sudo apt-get install ${{ matrix.fortran-compiler }} libnetcdf-dev
58+ # Install FORTRAN compiler
59+ - name : Install gfortran compiler and NetCDF
60+ if : ${{ matrix.fortran-compiler != 'ifort' }}
61+ run : sudo apt-get install ${{ matrix.fortran-compiler }}
62+ # Intel compilers and libraries if needed
63+ # https://software.intel.com/content/www/us/en/develop/articles/oneapi-repo-instructions.html#aptpkg
64+ - name : Install Intel compilers and libraries
65+ if : ${{ matrix.fortran-compiler == 'ifort' }}
66+ run : |
67+ wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
68+ sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
69+ sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
70+ sudo apt-get update
71+ sudo apt-get install intel-oneapi-common-licensing
72+ sudo apt-get install intel-oneapi-common-vars
73+ sudo apt-get install intel-oneapi-dev-utilities
74+ sudo apt-get install intel-oneapi-ifort
75+ # Install NetCDF library
76+ - name : Install NetCDF library
77+ run : sudo apt-get install libnetcdf-dev
5878 # NetCDF FORTRAN library
59- - name : NetCDF FORTRAN library for standard gfortran
79+ - name : Install NetCDF FORTRAN library for standard gfortran
6080 if : ${{ matrix.fortran-compiler == 'gfortran' }}
6181 run : sudo apt-get install libnetcdff-dev
62- - name : NetCDF FORTRAN library for other gfortran
82+ - name : Build NetCDF FORTRAN library
6383 if : ${{ matrix.fortran-compiler != 'gfortran' }}
6484 run : |
85+ source /opt/intel/inteloneapi/setvars.sh || true
6586 git clone https://github.com/Unidata/netcdf-fortran.git --branch v4.4.4
6687 cd netcdf-fortran
6788 ./configure --prefix=/usr
@@ -70,20 +91,30 @@ jobs:
7091 # Build COSP2 driver
7192 - name : Build driver
7293 run : |
94+ if [[ -e /opt/intel/inteloneapi/setvars.sh ]]; then
95+ source /opt/intel/inteloneapi/setvars.sh;
96+ ifort --version
97+ export F90FLAGS="-O3"
98+ fi
7399 cd build
74100 make driver
75101 # Run COSP2 test
76102 - name : Run test
77103 run : |
104+ source /opt/intel/inteloneapi/setvars.sh || true
78105 cd driver/run
79106 ./cosp2_test
80107 # Compare results against known good outputs
81108 - name : Compare test output against known good output (KGO)
82109 run : |
110+ if [[ -e /opt/intel/inteloneapi/setvars.sh ]]; then
111+ ATOL=1.0e-20
112+ RTOL=0.0006
113+ fi
83114 cd driver
84115 KGO=data/outputs/UKMO/cosp2_output_um.gfortran.kgo.nc
85116 TST=data/outputs/UKMO/cosp2_output_um.nc
86- python compare_to_kgo.py ${KGO} ${TST} --atol=0.0 --rtol=0.0
117+ python compare_to_kgo.py ${KGO} ${TST} --atol=${ATOL} --rtol=${RTOL}
87118 # Make output file available if the test fails
88119 - name : Upload output file if test fails
89120 if : failure()
0 commit comments