-
Notifications
You must be signed in to change notification settings - Fork 43
222 lines (204 loc) · 7.75 KB
/
build-hpc.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
name: build-hpc
# Controls when the action will run
on:
# Trigger the workflow on all pushes to main and develop, except on tag creation
push:
branches:
- main
- develop
- ci
tags-ignore:
- '**'
# Trigger the workflow on all pull requests
pull_request: ~
# Allow workflow to be dispatched on demand
workflow_dispatch: ~
# Trigger after public PR approved for CI
pull_request_target:
types: [labeled]
env:
ATLAS_TOOLS: ${{ github.workspace }}/tools
CTEST_PARALLEL_LEVEL: 1
CACHE_SUFFIX: v1 # Increase to force new cache to be created
jobs:
ci-hpc:
name: ci-hpc
if: ${{ !github.event.pull_request.head.repo.fork && github.event.action != 'labeled' || github.event.label.name == 'approved-for-ci' }}
strategy:
fail-fast: false # false: try to complete all jobs
matrix:
name:
- ac-gpu nvhpc
include:
- name: ac-gpu nvhpc
site: ac-batch
troika_user_secret: HPC_CI_GPU_SSH_USER
sbatch_options: |
#SBATCH --time=00:20:00
#SBATCH --nodes=1
#SBATCH --ntasks=4
#SBATCH --cpus-per-task=32
#SBATCH --gpus-per-task=1
#SBATCH --mem=200G
#SBATCH --qos=dg
modules:
- cmake
- ninja
- prgenv/nvidia
- hpcx-openmpi/2.14.0-cuda
- fftw
- qhull
- eigen
cmake_options: -DMPI_SLOTS=4 -DENABLE_WARNING_AS_ERROR=ON
runs-on: [self-hosted, linux, hpc]
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: ecmwf-actions/reusable-workflows/ci-hpc-generic@v2
with:
site: ${{ matrix.site }}
troika_user: ${{ secrets[matrix.troika_user_secret] }}
sbatch_options: ${{ matrix.sbatch_options }}
output_dir: ${{ matrix.output_dir || '' }}
workdir: ${{ matrix.workdir || '' }}
template_data: |
cmake_options:
- -DENABLE_MPI=ON
- -DENABLE_ACC=ON
- -DENABLE_CUDA=ON
- -DSKIP_TEST_atlas_test_field_foreach=TRUE
- ${{ matrix.cmake_options || '' }}
ctest_options: ${{ matrix.ctest_options || '' }}
dependencies:
ecmwf/ecbuild:
version: develop
ecmwf/eckit:
version: develop
cmake_options:
- -DENABLE_MPI=ON
- -DENABLE_CUDA=OFF
- -DENABLE_TESTS=OFF
- -DENABLE_ECKIT_SQL=OFF
- -DENABLE_ECKIT_CMD=OFF
- -DENABLE_AIO=OFF
- -DENABLE_WARNINGS=OFF
- ${{ matrix.cmake_options || '' }}
ecmwf/fckit:
version: develop
cmake_options:
- -DENABLE_TESTS=OFF
- ${{ matrix.cmake_options || '' }}
ecmwf-ifs/fiat:
version: develop
cmake_options:
- -DENABLE_MPI=ON
- -DENABLE_TESTS=OFF
- ${{ matrix.cmake_options || '' }}
ecmwf-ifs/ectrans:
version: develop
cmake_options:
- -DENABLE_MPI=ON
- -DENABLE_ACC=ON
- -DENABLE_GPU=ON
- -DENABLE_TESTS=OFF
- ${{ matrix.cmake_options || '' }}
template: |
set +x
module_load() {
echo "+ module load $1"
module load $1
}
{% for module in "${{ join(matrix.modules, ',') }}".split(',') %}
module_load {{module}}
{% endfor %}
echo "+ module list"
module list
BASEDIR=$PWD
export CMAKE_TEST_LAUNCHER="srun;-n;1"
export CMAKE_PREFIX_PATH=$BASEDIR/install:$CMAKE_PREFIX_PATH
{% for repo_name, options in dependencies.items() %}
name=$(basename {{repo_name}})
echo "::group::Get dependency $name"
echo "+ mkdir -p $name"
mkdir -p $name
echo "+ pushd $name"
pushd $name
echo "+ git init"
git init
echo "+ git remote add origin ${{ github.server_url }}/{{repo_name}}"
git remote add origin ${{ github.server_url }}/{{repo_name}}
echo "+ git fetch origin {{options['version']}}"
git fetch origin {{options['version']}}
echo "+ git reset --hard FETCH_HEAD"
git reset --hard FETCH_HEAD
echo "+ cmake -G Ninja -S . -B build {{ options['cmake_options']|join(' ') }}"
cmake -G Ninja -S . -B build {{ options['cmake_options']|join(' ') }}
start=`date +%s`
echo "+ cmake --build build"
cmake --build build
end=`date +%s`
runtime=$((end-start))
echo "Build $name took $runtime seconds"
echo "+ cmake --install build --prefix \$BASEDIR/install/$name"
cmake --install build --prefix $BASEDIR/install/$name
echo "+ export PATH=\$BASEDIR/install/$name/bin:\$PATH"
export PATH=$BASEDIR/install/$name/bin:$PATH
echo "+ popd"
popd
echo "::endgroup::"
{% endfor %}
REPO=${{ github.event.pull_request.head.repo.full_name || github.repository }}
SHA=${{ github.event.pull_request.head.sha || github.sha }}
name=$(basename $REPO)
echo "::group::Checkout $name"
echo "+ mkdir -p $name"
mkdir -p $name
echo "+ pushd $name"
pushd $name
echo "+ git init"
git init
echo "+ git remote add origin ${{ github.server_url }}/$REPO"
git remote add origin ${{ github.server_url }}/$REPO
echo "+ git fetch origin $SHA"
git fetch origin $SHA
echo "+git reset --hard FETCH_HEAD"
git reset --hard FETCH_HEAD
echo "+ popd"
popd
echo "::endgroup::"
echo "::group::Build $name"
echo "+ cmake -G Ninja -S $name -B build {{ cmake_options|join(' ') }}"
cmake -G Ninja -S $name -B build {{ cmake_options|join(' ') }}
start=`date +%s`
echo "+ cmake --build build"
cmake --build build
end=`date +%s`
runtime=$((end-start))
echo "Build $name took $runtime seconds"
echo "::endgroup::"
echo "::group::Test $name"
export ATLAS_FINALISES_MPI=1
echo "+ ctest --test-dir build --output-on-failure {{ ctest_options }}"
ctest --test-dir build --output-on-failure {{ ctest_options }}
echo "::endgroup::"
echo "::group::Install $name"
echo "+ cmake --install build --prefix $BASEDIR/install/$name"
cmake --install build --prefix $BASEDIR/install/$name
echo "+ export PATH=\$BASEDIR/install/$name/bin:\$PATH"
export PATH=$BASEDIR/install/$name/bin:$PATH
echo "::endgroup::"
echo "::group::Verify $name installation"
echo "+ atlas --info"
atlas --info
echo "::endgroup::"
echo "::group::Cleanup"
set -x
rm -r $name
rm -r build
rm -r $BASEDIR/install
{% for repo_name in dependencies.keys() %}
name=$(basename {{repo_name}})
rm -r $name
{% endfor %}
echo "::endgroup::"
set +x