-
Notifications
You must be signed in to change notification settings - Fork 6
192 lines (150 loc) · 4.76 KB
/
build.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
name: Build and Test
on: [push, pull_request]
env:
CI: "ON"
BUILD_DIR: _build
INSTALL_DIR: _install
jobs:
gcc-build:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
mpi: [nompi, mpich]
socket: [nosocket, socket]
config: [Debug]
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Set up miniforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
auto-activate-base: true
activate-environment: ""
- name: Install GCC (Linux)
run: mamba install c-compiler cxx-compiler fortran-compiler
- name: Enable MPI build
if: contains(matrix.mpi, 'openmpi') || contains(matrix.mpi, 'mpich')
run: echo "WITH_MPI=true" >> $GITHUB_ENV
- name: Disable MPI build
if: contains(matrix.mpi, 'nompi')
run: echo "WITH_MPI=false" >> $GITHUB_ENV
- name: Enable socket build
if: contains(matrix.socket, 'socket')
run: echo "WITH_SOCKETS=true" >> $GITHUB_ENV
- name: Disable socket build
if: contains(matrix.socket, 'nosocket')
run: echo "WITH_SOCKETS=false" >> $GITHUB_ENV
- name: Set Compiler
run: |
echo "FC=${CONDA_PREFIX}/bin/gfortran" >> $GITHUB_ENV
echo "CC=${CONDA_PREFIX}/bin/gcc" >> $GITHUB_ENV
- name: Install HDF5
run: mamba install hdf5
- name: Set HDF5 search paths
run: |
echo "CMAKE_PREFIX_PATH=${CONDA_PREFIX}/" >> $GITHUB_ENV
- name: Install OpenMPI
if: contains(matrix.mpi, 'openmpi')
run: mamba install openmpi openmpi-mpifort
- name: Install MPICH
if: contains(matrix.mpi, 'mpich')
run: mamba install mpich mpich-mpifort
- name: Install BLAS
run: mamba install openblas libopenblas
- name: Install requirements (conda)
run: mamba install cmake fypp numpy h5py
- name: Configure build
run: |
cmake -B ${BUILD_DIR} -DWITH_MPI=${WITH_MPI} -DWITH_SOCKETS=${WITH_SOCKETS} \
-DCMAKE_INSTALL_PREFIX=${PWD}/${BUILD_DIR}/${INSTALL_DIR} \
-DCMAKE_BUILD_TYPE=${{ matrix.config }} .
- name: Build project
run: cmake --build ${BUILD_DIR}
- name: Run regression tests
run: |
pushd ${BUILD_DIR}
ctest -j2 --output-on-failure
popd
- name: Install project
run: cmake --install ${BUILD_DIR}
intel-build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
mpi: [nompi]
socket: [nosocket, socket]
config: [RelWithDebInfo]
env:
FC: ifx
CC: icx
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Setup Intel compiler
uses: rscohn2/setup-oneapi@v0
with:
components: |
- name: Setup Intel environment
run: |
source /opt/intel/oneapi/setvars.sh
printenv >> ${GITHUB_ENV}
echo "FC=${FC}" >> ${GITHUB_ENV}
echo "F9X=${FC}" >> ${GITHUB_ENV}
echo "CC=${CC}" >> ${GITHUB_ENV}
echo "CXX=${CC}" >> ${GITHUB_ENV}
- name: Install HDF5
run: |
wget https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_4/downloads/hdf5-1.14.4-3.tar.gz
tar xfz hdf5-1.14.4-3.tar.gz
cd hdf5-1.14.4-3/
./configure --prefix=${PWD}/hdf5 --enable-fortran --enable-shared
make -j2
make install
export HDF5_ROOT=${PWD}/hdf5
cd ../../
printenv >> $GITHUB_ENV
- name: Disable MPI build
if: contains(matrix.mpi, 'nompi')
run: echo "WITH_MPI=false" >> $GITHUB_ENV
- name: Enable socket build
if: contains(matrix.socket, 'socket')
run: echo "WITH_SOCKETS=true" >> $GITHUB_ENV
- name: Disable socket build
if: contains(matrix.socket, 'nosocket')
run: echo "WITH_SOCKETS=false" >> $GITHUB_ENV
- name: Install cmake
run: |
pip3 install --upgrade pip
pip3 install cmake ninja fypp numpy h5py
- name: Configure build
run: |
cmake -B ${BUILD_DIR} -DWITH_MPI=${WITH_MPI} -DWITH_SOCKETS=${WITH_SOCKETS} \
-DCMAKE_INSTALL_PREFIX=${PWD}/${BUILD_DIR}/${INSTALL_DIR} \
-DCMAKE_BUILD_TYPE=${{ matrix.config }} .
- name: Build project
run: cmake --build ${BUILD_DIR}
- name: Run regression tests
run: |
pushd ${BUILD_DIR}
ctest -j2 --output-on-failure
popd
- name: Install project
run: cmake --install ${BUILD_DIR}