forked from mom-ocean/MOM6
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
443 lines (402 loc) · 15.9 KB
/
.gitlab-ci.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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
stages:
- setup
- builds
- run
- tests
- cleanup
# JOB_DIR points to a persistent working space used for most stages in this pipeline but
# it is unique to this pipeline.
# We use the "fetch" strategy to speed up the startup of stages
variables:
JOB_DIR: "/lustre/f2/scratch/oar.gfdl.ogrp-account/runner/builds/$CI_PIPELINE_ID"
GIT_STRATEGY: fetch
# Start all stages in $JOB_DIR/.../MOM6-examples
# Exception: for "setup" stages MOM6-examples has not yet been cloned so the stage starts in $JOB_DIR
before_script:
- echo -e "\e[0Ksection_start:`date +%s`:dir_stuff[collapsed=true]\r\e[0KChanging directories to $JOB_DIR"
- echo Job directory set to $JOB_DIR
- mkdir -p $JOB_DIR
- cd $JOB_DIR
- test -d Gaea-stats-MOM6-examples/MOM6-examples && cd Gaea-stats-MOM6-examples/MOM6-examples
- pwd
- echo -e "\e[0Ksection_end:`date +%s`:dir_stuff\r\e[0K"
# Test that merge with dev/gfdl works.
merge:
stage: setup
tags:
- ncrc4
script:
- cd $CI_PROJECT_DIR
- git pull --no-edit https://github.com/NOAA-GFDL/MOM6.git dev/gfdl
# Setup the persistent JOB_DIR for all subsequent stages
#
# This basically setups up a complete tree much as a user would work
# EXCEPT that src/MOM6 is cloned from a file system
clone:
stage: setup
tags:
- ncrc4
before_script:
- echo -e "\e[0Ksection_start:`date +%s`:dir_stuff[collapsed=true]\r\e[0KChanging directories to $JOB_DIR"
- cd $CI_PROJECT_DIR
- git submodule init ; git submodule update
- echo Job directory set to $JOB_DIR
- mkdir -p $JOB_DIR
- cd $JOB_DIR
- test -d Gaea-stats-MOM6-examples && rm -rf Gaea-stats-MOM6-examples # In case we are re-running this stage
- pwd
- echo -e "\e[0Ksection_end:`date +%s`:dir_stuff\r\e[0K"
script:
- echo -e "\e[0Ksection_start:`date +%s`:clone[collapsed=true]\r\e[0KCloning repository tree"
- git clone https://gitlab.gfdl.noaa.gov/ogrp/Gaea-stats-MOM6-examples.git
- cd Gaea-stats-MOM6-examples
- git submodule update --init
- cd MOM6-examples
- git checkout dev/gfdl
- git submodule init
- git submodule set-url src/MOM6 $CI_PROJECT_DIR/.git # Easiest way to get MOM6 source to be tested
- git submodule update --recursive --jobs 8
- (cd src/MOM6 ; git checkout $CI_COMMIT_SHA ; git submodule update --recursive --init) # Get commit to be tested
- make -f tools/MRS/Makefile.clone clone_gfdl -j # Extras and link to datasets
- bash tools/MRS/generate_manifest.sh . tools/MRS/excluded-expts.txt > manifest.mk
- mkdir -p results
- echo -e "\e[0Ksection_end:`date +%s`:clone\r\e[0K"
# Make work spaces for running simultaneously in parallel jobs
#
# Each work space is a clone of MOM6-examples with symbolic links for the build and data directories
# so they can share executables which can run simultaneously without interfering with each other
work-space:pgi:
stage: setup
tags:
- ncrc4
needs: ["clone"]
script:
- echo 911
- echo -e "\e[0Ksection_start:`date +%s`:clone[collapsed=true]\r\e[0KCreating separate work space"
- git clone -s .git tmp-pgi-MOM6-examples
- cd tmp-pgi-MOM6-examples
- ln -s ../{build,results,.datasets} .
- cp ../manifest.mk .
- echo -e "\e[0Ksection_end:`date +%s`:clone\r\e[0K"
work-space:intel:
stage: setup
tags:
- ncrc4
needs: ["clone"]
script:
- echo 911
- echo -e "\e[0Ksection_start:`date +%s`:clone[collapsed=true]\r\e[0KCreating separate work space"
- git clone -s .git tmp-intel-MOM6-examples
- cd tmp-intel-MOM6-examples
- ln -s ../{build,results,.datasets} .
- cp ../manifest.mk .
- echo -e "\e[0Ksection_end:`date +%s`:clone\r\e[0K"
work-space:gnu:
stage: setup
tags:
- ncrc4
needs: ["clone"]
script:
- echo -e "\e[0Ksection_start:`date +%s`:clone[collapsed=true]\r\e[0KCreating separate work space"
- git clone -s .git tmp-gnu-MOM6-examples
- cd tmp-gnu-MOM6-examples
- ln -s ../{build,results,.datasets} .
- cp ../manifest.mk .
- echo -e "\e[0Ksection_end:`date +%s`:clone\r\e[0K"
work-space:gnu-restarts:
stage: setup
tags:
- ncrc4
needs: ["clone"]
script:
- echo -e "\e[0Ksection_start:`date +%s`:clone[collapsed=true]\r\e[0KCreating separate work space"
- git clone -s .git tmp-gnu-restarts-MOM6-examples
- cd tmp-gnu-restarts-MOM6-examples
- ln -s ../{build,results,.datasets} .
- cp ../manifest.mk .
- echo -e "\e[0Ksection_end:`date +%s`:clone\r\e[0K"
# Compile executables
#
# gnu:repro, gnu:debug, intel:repro and pgi:repro are used by their respective run:* jobs
# gnu:ice-only-nolib and gnu:ocean-only-nolibs are not used but simply test that the model compiles without libraries
compile:pgi:repro:
stage: builds
needs: ["clone"]
tags:
- ncrc4
script:
- echo -e "\e[0Ksection_start:`date +%s`:compile[collapsed=true]\r\e[0KCompiling target repro_pgi"
- time make -f tools/MRS/Makefile.build repro_pgi -s -j
- echo -e "\e[0Ksection_end:`date +%s`:compile\r\e[0K"
compile:intel:repro:
stage: builds
needs: ["clone"]
tags:
- ncrc4
script:
- echo -e "\e[0Ksection_start:`date +%s`:compile[collapsed=true]\r\e[0KCompiling target repro_intel"
- time make -f tools/MRS/Makefile.build repro_intel -s -j
- echo -e "\e[0Ksection_end:`date +%s`:compile\r\e[0K"
compile:gnu:repro:
stage: builds
needs: ["clone"]
tags:
- ncrc4
script:
- echo -e "\e[0Ksection_start:`date +%s`:compile[collapsed=true]\r\e[0KCompiling target repro_gnu"
- time make -f tools/MRS/Makefile.build repro_gnu -s -j
- echo -e "\e[0Ksection_end:`date +%s`:compile\r\e[0K"
- echo -e "\e[0Ksection_start:`date +%s`:compile2[collapsed=true]\r\e[0KCompiling target static_gnu"
- time make -f tools/MRS/Makefile.build static_gnu -s -j
- echo -e "\e[0Ksection_end:`date +%s`:compile2\r\e[0K"
compile:gnu:debug:
stage: builds
needs: ["clone"]
tags:
- ncrc4
script:
- echo -e "\e[0Ksection_start:`date +%s`:compile2[collapsed=true]\r\e[0KCompiling target debug_gnu"
- time make -f tools/MRS/Makefile.build debug_gnu -s -j
- echo -e "\e[0Ksection_end:`date +%s`:compile\r\e[0K"
compile:gnu:ocean-only-nolibs:
stage: builds
needs: ["clone"]
tags:
- ncrc4
script:
- echo 911
- echo -e "\e[0Ksection_start:`date +%s`:compile[collapsed=true]\r\e[0KCompiling target gnu ocean-only no-libs"
- mkdir -p build-ocean-only-nolibs
- cd build-ocean-only-nolibs
- make -f ../tools/MRS/Makefile.build ./gnu/env BUILD=. -s
- ../src/mkmf/bin/list_paths -l ../src/MOM6/config_src/{drivers/solo_driver,memory/dynamic_symmetric,infra/FMS1,ext*} ../src/MOM6/src ../src/FMS1
- sed -i '/FMS1\/.*\/test_/d' path_names
- ../src/mkmf/bin/mkmf -t ../src/mkmf/templates/ncrc-gnu.mk -p MOM6 -c"-Duse_libMPI -Duse_netCDF" path_names
- (source gnu/env ; make NETCDF=3 REPRO=1 MOM6 -s -j)
- echo -e "\e[0Ksection_end:`date +%s`:compile\r\e[0K"
compile:gnu:ice-ocean-nolibs:
stage: builds
needs: ["clone"]
tags:
- ncrc4
script:
- echo 911
- echo -e "\e[0Ksection_start:`date +%s`:compile[collapsed=true]\r\e[0KCompiling target gnu ice-ocean-SIS2 no-libs"
- mkdir -p build-ice-ocean-SIS2-nolibs
- cd build-ice-ocean-SIS2-nolibs
- make -f ../tools/MRS/Makefile.build ./gnu/env BUILD=. -s
- ../src/mkmf/bin/list_paths -l ../src/MOM6/config_src/{drivers/FMS_cap,memory/dynamic_symmetric,infra/FMS1,ext*} ../src/MOM6/src ../src/SIS2/*src ../src/{FMS1,coupler,icebergs,ice_param,land_null,atmos_null}
- sed -i '/FMS1\/.*\/test_/d' path_names
- ../src/mkmf/bin/mkmf -t ../src/mkmf/templates/ncrc-gnu.mk -p MOM6 -c"-Duse_libMPI -Duse_netCDF -D_USE_LEGACY_LAND_ -Duse_AM3_physics" path_names
- (source gnu/env ; make NETCDF=3 REPRO=1 MOM6 -s -j)
- echo -e "\e[0Ksection_end:`date +%s`:compile\r\e[0K"
# Runs
#
# The main "run" stage uses the script .gitlab/mom6-ci-run-script.sh
run:pgi:
stage: run
needs: ["work-space:pgi","compile:pgi:repro"]
tags:
- ncrc4
script:
- cd tmp-pgi-MOM6-examples
- cp ../src/MOM6/.gitlab/mom6-ci-run-pgi-script.sh .
- sbatch --clusters=c3,c4 --nodes=30 --time=0:20:00 --account=gfdl_o --qos=debug --job-name=mom6_pgi_tests --output=log.$CI_JOB_ID --wait mom6-ci-run-pgi-script.sh && ( egrep -v 'pagefaults|HiWaterMark=' log.$CI_JOB_ID ; echo Job returned normally ) || ( cat log.$CI_JOB_ID ; echo Job failed ; exit 911 )
- test -f .CI-PGI-BATCH-SUCCESS || ( echo Batch job did not complete ; exit 911 )
- git checkout . # reset working space so we can use it to compare against
run:intel:
stage: run
needs: ["work-space:intel","compile:intel:repro"]
tags:
- ncrc4
script:
- echo 911
- cd tmp-intel-MOM6-examples
- cp ../src/MOM6/.gitlab/mom6-ci-run-intel-script.sh .
- sbatch --clusters=c3,c4 --nodes=30 --time=0:20:00 --account=gfdl_o --qos=debug --job-name=mom6_intel_tests --output=log.$CI_JOB_ID --wait mom6-ci-run-intel-script.sh && ( egrep -v 'pagefaults|HiWaterMark=' log.$CI_JOB_ID ; echo Job returned normally ) || ( cat log.$CI_JOB_ID ; echo Job failed ; exit 911 )
- test -f .CI-INTEL-BATCH-SUCCESS || ( echo Batch job did not complete ; exit 911 )
- git checkout . # reset working space so we can use it to compare against
run:gnu:
stage: run
needs: ["work-space:gnu","compile:gnu:repro","compile:gnu:debug"]
tags:
- ncrc4
script:
- cd tmp-gnu-MOM6-examples
- cp ../src/MOM6/.gitlab/mom6-ci-run-gnu-script.sh .
- sbatch --clusters=c3,c4 --nodes=30 --time=0:20:00 --account=gfdl_o --qos=debug --job-name=mom6_gnu_tests --output=log.$CI_JOB_ID --wait mom6-ci-run-gnu-script.sh && ( egrep -v 'pagefaults|HiWaterMark=' log.$CI_JOB_ID ; echo Job returned normally ) || ( cat log.$CI_JOB_ID ; echo Job failed ; exit 911 )
- test -f .CI-GNU-BATCH-SUCCESS || ( echo Batch job did not complete ; exit 911 )
- git checkout . # reset working space so we can use it to compare against
run:gnu-restarts:
stage: run
needs: ["work-space:gnu","compile:gnu:repro"]
tags:
- ncrc4
script:
- echo 911
- cd tmp-gnu-restarts-MOM6-examples
- cp ../src/MOM6/.gitlab/mom6-ci-run-gnu-restarts-script.sh .
- sbatch --clusters=c3,c4 --nodes=30 --time=0:20:00 --account=gfdl_o --qos=debug --job-name=mom6_gnu_restarts --output=log.$CI_JOB_ID --wait mom6-ci-run-gnu-restarts-script.sh && ( egrep -v 'pagefaults|HiWaterMark=' log.$CI_JOB_ID ; echo Job returned normally ) || ( cat log.$CI_JOB_ID ; echo Job failed ; exit 911 )
- test -f .CI-GNU-RESTARTS-BATCH-SUCCESS || ( echo Batch job did not complete ; exit 911 )
- git checkout . # reset working space so we can use it to compare against
# These "run" stages replace the "before_script" and so start in the transient work-space provided by gitlab
# We work here to avoid collisions with parallel jobs
gnu.testing:
stage: run
needs: []
tags:
- ncrc4
before_script:
- echo -e "\e[0Ksection_start:`date +%s`:submodules[collapsed=true]\r\e[0KCloning submodules"
- git submodule init ; git submodule update
- echo -e "\e[0Ksection_end:`date +%s`:submodules\r\e[0K"
script:
- echo -e "\e[0Ksection_start:`date +%s`:compile[collapsed=true]\r\e[0KCompiling executables"
- cd .testing
- module unload PrgEnv-pgi PrgEnv-intel PrgEnv-gnu darshan ; module load PrgEnv-gnu ; module unload netcdf gcc ; module load gcc/7.3.0 cray-hdf5 cray-netcdf
- make work/local-env
- make -s -j
- echo -e "\e[0Ksection_end:`date +%s`:compile\r\e[0K"
- (echo '#!/bin/bash';echo '. ./work/local-env/bin/activate';echo 'make MPIRUN="srun -mblock --exclusive" test -s -j') > job.sh
- sbatch --clusters=c3,c4 --nodes=5 --time=0:05:00 --account=gfdl_o --qos=debug --job-name=MOM6.gnu.testing --output=log.$CI_JOB_ID --wait job.sh && make test || cat log.$CI_JOB_ID
intel.testing:
stage: run
needs: []
tags:
- ncrc4
before_script:
- echo -e "\e[0Ksection_start:`date +%s`:submodules[collapsed=true]\r\e[0KCloning submodules"
- git submodule init ; git submodule update
- echo -e "\e[0Ksection_end:`date +%s`:submodules\r\e[0K"
script:
- echo -e "\e[0Ksection_start:`date +%s`:compile[collapsed=true]\r\e[0KCompiling executables"
- cd .testing
- module unload PrgEnv-pgi PrgEnv-intel PrgEnv-gnu darshan; module load PrgEnv-intel; module unload netcdf intel; module load intel/18.0.6.288 cray-hdf5 cray-netcdf
- make work/local-env
- make -s -j
- echo -e "\e[0Ksection_end:`date +%s`:compile\r\e[0K"
- (echo '#!/bin/bash';echo '. ./work/local-env/bin/activate';echo 'make MPIRUN="srun -mblock --exclusive" test -s -j') > job.sh
- sbatch --clusters=c3,c4 --nodes=5 --time=0:05:00 --account=gfdl_o --qos=debug --job-name=MOM6.gnu.testing --output=log.$CI_JOB_ID --wait job.sh && make test || cat log.$CI_JOB_ID
# Tests
#
# stats file tests involve comparing the check sums of the generated files against the check sums in the stats-repo
# log file tests involve comparing the check sums of the generated files against the check sums in MOM6-examples
t:pgi:symmetric:
stage: tests
needs: ["run:pgi"]
tags:
- ncrc4
script:
- ( cd results/pgi_all_sym/ ; md5sum `find * -type f` ) | ( cd ../regressions/ ; md5sum -c )
t:pgi:non-symmetric:
stage: tests
needs: ["run:pgi"]
tags:
- ncrc4
script:
- ( cd results/pgi_all_nonsym/ ; md5sum `find * -type f` ) | ( cd ../regressions/ ; md5sum -c )
t:pgi:layout:
stage: tests
needs: ["run:pgi"]
tags:
- ncrc4
script:
- ( cd results/pgi_all_layout/ ; md5sum `find * -type f` ) | ( cd ../regressions/ ; md5sum -c )
t:pgi:params:
stage: tests
needs: ["run:pgi"]
tags:
- ncrc4
script:
- ( cd results/pgi_params/ ; md5sum `find * -type f` ) | md5sum -c
allow_failure: true
t:intel:symmetric:
stage: tests
needs: ["run:intel"]
tags:
- ncrc4
script:
- ( cd results/intel_all_sym/ ; md5sum `find * -type f` ) | ( cd ../regressions/ ; md5sum -c )
t:intel:non-symmetric:
stage: tests
needs: ["run:intel"]
tags:
- ncrc4
script:
- ( cd results/intel_all_nonsym/ ; md5sum `find * -type f` ) | ( cd ../regressions/ ; md5sum -c )
t:intel:layout:
stage: tests
needs: ["run:intel"]
tags:
- ncrc4
script:
- ( cd results/intel_all_layout/ ; md5sum `find * -type f` ) | ( cd ../regressions/ ; md5sum -c )
t:intel:params:
stage: tests
needs: ["run:intel"]
tags:
- ncrc4
script:
- ( cd results/intel_params/ ; md5sum `find * -type f` ) | md5sum -c
allow_failure: true
t:gnu:symmetric:
stage: tests
needs: ["run:gnu"]
tags:
- ncrc4
script:
- ( cd results/gnu_all_sym/ ; md5sum `find * -type f` ) | ( cd ../regressions/ ; md5sum -c )
t:gnu:non-symmetric:
stage: tests
needs: ["run:gnu"]
tags:
- ncrc4
script:
- ( cd results/gnu_all_nonsym/ ; md5sum `find * -type f` ) | ( cd ../regressions/ ; md5sum -c )
t:gnu:layout:
stage: tests
needs: ["run:gnu"]
tags:
- ncrc4
script:
- ( cd results/gnu_all_layout/ ; md5sum `find * -type f` ) | ( cd ../regressions/ ; md5sum -c )
t:gnu:static:
stage: tests
needs: ["run:gnu"]
tags:
- ncrc4
script:
- ( cd results/gnu_all_static/ ; md5sum `find * -type f` ) | ( cd ../regressions/ ; md5sum -c )
t:gnu:symmetric-debug:
stage: tests
needs: ["run:gnu"]
tags:
- ncrc4
script:
- ( cd results/gnu_ocean_only_debug/ ; md5sum `find * -type f` ) | ( cd ../regressions/ ; md5sum -c )
t:gnu:restart:
stage: tests
needs: ["run:gnu-restarts"]
tags:
- ncrc4
script:
- cd tmp-gnu-restarts-MOM6-examples
- ( cd ../results/gnu_restarts ; tar cf - * ) | tar xf - # NOTE this unpacks in tmp-gnu-restarts-MOM6-examples (not a new directory)
- make -f tools/MRS/Makefile.restart restart_gnu_ocean_only restart_gnu_ice_ocean_SIS2 -s -k
t:gnu:params:
stage: tests
needs: ["run:gnu"]
tags:
- ncrc4
script:
- ( cd results/gnu_params/ ; md5sum `find * -type f` ) | md5sum -c
allow_failure: true
# We cleanup ONLY if the preceding stages were completed successfully
cleanup:
stage: cleanup
tags:
- ncrc4
before_script:
- echo Skipping usual preamble
script:
- rm -rf $JOB_DIR