forked from ufs-community/UFS_UTILS
-
Notifications
You must be signed in to change notification settings - Fork 2
259 lines (235 loc) · 8.34 KB
/
linux-mac-nceplibs-mpi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
name: linux-mac-mpi-nceplibs
on:
push:
branches:
- develop
paths-ignore:
- README.md
pull_request:
branches:
- develop
paths-ignore:
- README.md
defaults:
run:
shell: bash -exo pipefail {0}
jobs:
matrix-build-and-test:
runs-on: ${{ matrix.os }}
env:
CC: gcc-9
FC: gfortran-9
CXX: g++-9
strategy:
fail-fast: true
matrix:
os: [macos-11, ubuntu-latest]
compiler: [gcc-9]
nceplibs_version: [develop, 1.4.0]
mpi_type: [mpich, openmpi]
netcdf_version: [4.7.4]
steps:
- name: install-dependencies
run: |
echo "$HOME/mpi/bin" >> $GITHUB_PATH
if [[ ${{ matrix.os }} == "ubuntu-latest" ]]; then
sudo apt-get update
sudo apt-get install libpng-dev
sudo apt-get install libjpeg-dev
elif [[ ${{ matrix.os }} == "macos-11" ]]; then
brew update
brew install wget
brew install jpeg-turbo
if [[ ${{ matrix.compiler }} == "gcc-9" ]]; then
sudo ln -sf /usr/local/bin/gfortran-9 /usr/local/bin/gfortran
elif [[ ${{ matrix.compiler }} == "gcc-10" ]]; then
sudo ln -sf /usr/local/bin/gfortran-10 /usr/local/bin/gfortran
fi
fi
- name: cache-mpi
id: cache-mpi
uses: actions/cache@v2
with:
path: ~/mpi
key: mpi-${{ matrix.mpi_type }}-${{ runner.os }}
- name: build-mpi
if: steps.cache-mpi.outputs.cache-hit != 'true'
run: |
if [[ ${{ matrix.mpi_type}} == "mpich" ]]; then
wget http://www.mpich.org/static/downloads/3.3.2/mpich-3.3.2.tar.gz &> /dev/null
tar -xzf mpich-3.3.2.tar.gz
cd mpich-3.3.2
./configure --prefix=$HOME/mpi --enable-fortran --enable-cxx
make -j2
make install
elif [[ ${{ matrix.mpi_type }} == "openmpi" ]]; then
wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.1.tar.gz &> /dev/null
tar -xzf openmpi-4.1.1.tar.gz
cd openmpi-4.1.1
if [[ ${{ matrix.os }} == "ubuntu-latest" ]]; then
./configure --prefix=$HOME/mpi --enable-mpi-fortran --enable-mpi-cxx
elif [[ ${{ matrix.os }} == "macos-11" ]]; then
./configure --prefix=$HOME/mpi --enable-mpi-fortran --enable-mpi-cxx --enable-two-level-namespace
fi
make -j2
make install
fi
- name: cache-netcdf
id: cache-netcdf
uses: actions/cache@v2
with:
path: ~/netcdf
key: netcdf-c-${{ matrix.netcdf_version }}-${{ runner.os }}-${{ matrix.mpi_type }}3
- name: build-hdf5
if: steps.cache-netcdf.outputs.cache-hit != 'true'
run: |
export CC=mpicc
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.7/src/hdf5-1.10.7.tar.gz &> /dev/null
tar -xzf hdf5-1.10.7.tar.gz
pushd hdf5-1.10.7
./configure --prefix=${HOME}/netcdf --enable-parallel --disable-tools --disable-fortran --disable-cxx --enable-parallel-tests --disable-shared --enable-static
make -j2
make install
- name: build-netcdf-c
if: steps.cache-netcdf.outputs.cache-hit != 'true'
run: |
export CC=mpicc
export CPPFLAGS=-I${HOME}/netcdf/include
export LDFLAGS=-L${HOME}/netcdf/lib
wget https://github.com/Unidata/netcdf-c/archive/refs/tags/v${{ matrix.netcdf_version }}.tar.gz &> /dev/null
tar -xzf v${{ matrix.netcdf_version }}.tar.gz
cd netcdf-c-${{ matrix.netcdf_version }}
./configure --prefix=${HOME}/netcdf --disable-dap --disable-utilities --disable-shared
make -j2
make install
- name: build-netcdf-fortran
if: steps.cache-netcdf.outputs.cache-hit != 'true'
run: |
set -x
export PATH="${HOME}/netcdf/bin:$PATH"
export CC=mpicc
export FC=mpifort
export CPPFLAGS=-I${HOME}/netcdf/include
export LDFLAGS=-L${HOME}/netcdf/lib
export LIBS=`nc-config --libs`
wget https://github.com/Unidata/netcdf-fortran/archive/v4.5.3.tar.gz &> /dev/null
tar -xzf v4.5.3.tar.gz
pushd netcdf-fortran-4.5.3
./configure --prefix=${HOME}/netcdf --disable-shared
make -j2
make install
- name: cache-esmf
id: cache-esmf
uses: actions/cache@v2
with:
path: ~/esmf
key: esmf--8.2.0-${{ runner.os }}-${{ matrix.mpi_type }}-netcdf-${{ matrix.netcdf_version }}3
- name: build-esmf
if: steps.cache-esmf.outputs.cache-hit != 'true'
run: |
set -x
pushd ~
export ESMF_DIR=~/esmf-ESMF_8_2_0
wget https://github.com/esmf-org/esmf/archive/ESMF_8_2_0.tar.gz &> /dev/null
tar zxf ESMF_8_2_0.tar.gz
cd esmf-ESMF_8_2_0
if [[ ${{ matrix.mpi_type}} == "mpich" ]]; then
export ESMF_COMM=mpich3
elif [[ ${{ matrix.mpi_type}} == "openmpi" ]]; then
export ESMF_COMM=openmpi
fi
export ESMF_INSTALL_BINDIR=bin
export ESMF_INSTALL_LIBDIR=lib
export ESMF_INSTALL_MODDIR=mod
export ESMF_COMPILER=gfortran
export ESMF_INSTALL_PREFIX=~/esmf
export ESMF_NETCDF=split
export ESMF_NETCDF_INCLUDE=${HOME}/netcdf/include
export ESMF_NETCDF_LIBPATH=${HOME}/netcdf/lib
export ESMF_NETCDF_LIBS="-lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz"
make -j2
make install
- name: cache-jasper
id: cache-jasper
uses: actions/cache@v2
with:
path: ~/jasper
key: jasper-2.0.25-${{ runner.os }}3
- name: build-jasper
if: steps.cache-jasper.outputs.cache-hit != 'true'
run: |
set -x
pwd
wget https://github.com/jasper-software/jasper/archive/version-2.0.25.tar.gz &> /dev/null
tar zxf version-2.0.25.tar.gz
cd jasper-version-2.0.25
mkdir build-jasper && cd build-jasper
cmake .. -DCMAKE_INSTALL_PREFIX=~/jasper -DJAS_ENABLE_SHARED=OFF
make -j2
make install
- name: checkout-nceplibs
run: |
git clone https://github.com/NOAA-EMC/NCEPLIBS.git nceplibs
cd nceplibs
if [[ ${{ matrix.nceplibs_version }} == "1.4.0" ]]; then
git checkout v1.4.0
fi
- name: get-git-hash
run: |
cd nceplibs
git rev-parse HEAD > hash.txt
- name: cache-nceplibs
id: cache-nceplibs
uses: actions/cache@v2
with:
path: ~/nceplibs
key: nceplibs-${{ matrix.nceplibs_version }}-${{ runner.os }}-${{ matrix.mpi_type }}-${{ hashFiles('nceplibs/hash.txt') }}3
- name: build-nceplibs
if: steps.cache-nceplibs.outputs.cache-hit != 'true'
run: |
set -x
export ESMFMKFILE=~/esmf/lib/esmf.mk
cd nceplibs
mkdir build && cd build
cmake .. -DCMAKE_PREFIX_PATH='~;~/jasper;~/netcdf' -DCMAKE_INSTALL_PREFIX='~/nceplibs' -DFLAT=ON
make -j2
- name: checkout-ufs-utils
uses: actions/checkout@v2
with:
path: ufs_utils
submodules: recursive
- name: cache-data
id: cache-data
uses: actions/cache@v2
with:
path: ~/data
key: data-2
- name: build
run: |
export ESMFMKFILE=~/esmf/lib/esmf.mk
cd ufs_utils
mkdir build && cd build
export CC=mpicc
export CXX=mpicxx
export FC=mpifort
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:~/jasper/lib;~/jasper/lib64"
export DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}:~/jasper/lib;~/jasper/lib64"
cmake -DTEST_FILE_DIR=/home/runner/data -DCMAKE_PREFIX_PATH='~/jasper;~/nceplibs;~/netcdf' ..
make -j2
- name: test
run: |
cd ufs_utils/build
# Oversubscribe for OpenMPI to run more processes than CPUs
export OMPI_MCA_rmaps_base_oversubscribe=1
ctest --rerun-failed --output-on-failure
- name: cache-data
if: steps.cache-data.outputs.cache-hit != 'true'
run: |
mkdir ~/data
cp ufs_utils/build/tests/chgres_cube/data/* ~/data
cp ufs_utils/build/tests/sfc_climo_gen/data/* ~/data
cp ufs_utils/build/tests/cpld_gridgen/data/* ~/data
cp ufs_utils/tests/filter_topo/data/* ~/data
cp ufs_utils/tests/emcsfc_snow2mdl/data/* ~/data
cp ufs_utils/tests/chgres_cube/data/* ~/data
ls -l ~/data