Skip to content

Commit 23fe1b7

Browse files
Merge pull request #46 from CFMIP/CI_with_ifort
Adding ifort to continuous itegration tests
2 parents 562b7b3 + ab8e0a4 commit 23fe1b7

File tree

2 files changed

+39
-8
lines changed

2 files changed

+39
-8
lines changed

.github/workflows/continous_integration.yml

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@ jobs:
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()

build/Makefile.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#F90 = gfortran
2-
F90FLAGS = -O3 -ffree-line-length-none -fcheck=bounds -finit-real=nan
2+
#F90FLAGS = -O3 -ffree-line-length-none -fcheck=bounds -finit-real=nan
33

44
F90_LIB = /usr
55
NC_INC = -I$(F90_LIB)/include

0 commit comments

Comments
 (0)