-
Notifications
You must be signed in to change notification settings - Fork 6
/
.gitlab-ci.yml
500 lines (456 loc) · 17.8 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
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
variables:
SPACK_REPO: https://github.com/spack/spack.git
stages:
- check
- generate
- build
- approve
- deploy
.copy_muller_settings: ©_muller_settings
- mkdir -p /global/common/software/spackecp/muller/spack_settings
- cp settings/muller/* /global/common/software/spackecp/muller/spack_settings/
.copy_perlmutter_settings: ©_perlmutter_settings
- mkdir -p /global/common/software/spackecp/perlmutter/spack_settings
- cp settings/perlmutter/packages.yaml /global/common/software/spackecp/perlmutter/spack_settings/packages.yaml
- cp settings/perlmutter/compilers.yaml /global/common/software/spackecp/perlmutter/spack_settings/compilers.yaml
.startup_modules: &startup_modules
- module reset
- module load cpu
# need to load cray-pmi since its not loaded by default and required for upcxx. See https://software.nersc.gov/NERSC/spack-infrastructure/-/issues/37
- module load cray-pmi
- module list
.spack_setup: &spack_setup
- source setup-env.sh
# need to pre-create this directory apparently spack ci doesn't create this automatically
#- mkdir -p /global/common/software/spackecp/mirrors/perlmutter-e4s-23.05/build_cache/_pgp
- git clone -c feature.manyFiles=true -b $branch $SPACK_REPO
- . spack/share/spack/setup-env.sh
- spack --version
- spack-python --path
- export SPACK_GNUPGHOME=$HOME/.gnupg
perlmutter:check_spack_dependencies:
stage: check
tags: [perlmutter-e4s]
allow_failure: false
rules:
- if: ($CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "web" || $CI_PIPELINE_SOURCE == "schedule")
when: always
script:
- export
- bash check_spack_dependencies.sh
muller:check_spack_dependencies:
stage: check
tags: [muller-e4s]
allow_failure: false
rules:
- if: ($CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "web" || $CI_PIPELINE_SOURCE == "schedule")
when: always
script:
- bash check_spack_dependencies.sh
spack_training_check:
stage: build
tags: [perlmutter-e4s]
rules:
- if: ($CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web") && ($PIPELINE_NAME == "SPACK_TRAINING")
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- docs/spack_training.rst
script:
- cd $CI_PROJECT_DIR
- source setup-env.sh
- git clone -b e4s-22.05 https://github.com/spack/spack.git
- source spack/share/spack/setup-env.sh
- spack --version
- echo $SPACK_PYTHON
- spack-python --path
- spack env create data_viz $CI_PROJECT_DIR/docs/spack.yaml
- spack env activate data_viz
- spack env st
- spack compiler list
- spack providers
- spack providers mpi
- spack concretize
- set +e
- spack install
- set -e
- spack find
- spack mirror create -d $CI_PROJECT_DIR/spack_mirror -a
- ls -l $CI_PROJECT_DIR/spack_mirror/*
- spack -d module tcl refresh --delete-tree -y
- ls -l $HOME/spack-infrastructure/modules/$(spack arch)/*
- module use $HOME/spack-infrastructure/modules/$(spack arch)
- ml av
perlmutter-base:
stage: build
needs: ["perlmutter:check_spack_dependencies"]
tags: [perlmutter-e4s]
rules:
- if: ($CI_PIPELINE_SOURCE == "web") && ($PIPELINE_NAME == "PERLMUTTER_BASE")
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- spack-configs/base/spack.yaml
script:
- source setup-env.sh
- spack_root=/global/common/software/spackecp/perlmutter/base/$CI_PIPELINE_ID
- mkdir -p $spack_root
- cd $spack_root
- git clone -c feature.manyFiles=true -b releases/v0.22 $SPACK_REPO
- . spack/share/spack/setup-env.sh
- spack-python --path
- spack env create base $CI_PROJECT_DIR/spack-configs/base/spack.yaml
- spack env activate base
- spack env st
- spack load [email protected] [email protected]
- spack compiler add
- spack compiler list
- spack unload -a
- spack concretize -f
- spack env depfile -o Makefile
- make -j128
- spack module lmod refresh --delete-tree -y
# Template Jobs for spack ci generate
.perlmutter-v0.22-generate:
stage: generate
needs: ["perlmutter:check_spack_dependencies"]
tags: [perlmutter-e4s]
variables:
version: "v0.22"
branch: "releases/v0.22"
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
- script_failure
interruptible: true
allow_failure: true
rules:
- if: ($CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web") && ($PIPELINE_NAME == "PERLMUTTER_V0.22")
- if: ($CI_PIPELINE_SOURCE == "merge_request_event")
changes:
- spack-configs/perlmutter-${version}/$STACK_NAME/spack.yaml
- spack-configs/perlmutter-${version}/definitions.yaml
before_script:
- *copy_perlmutter_settings
- *startup_modules
script:
- *spack_setup
- cd $CI_PROJECT_DIR/spack-configs/perlmutter-${version}/$STACK_NAME
- cat $CI_PROJECT_DIR/spack-configs/perlmutter-${version}/definitions.yaml >> spack.yaml
- spack env activate --without-view .
- spack env st
#- spack -d concretize -f | tee $CI_PROJECT_DIR/concretize.log
- spack ci generate --check-index-only --artifacts-root "$CI_PROJECT_DIR/jobs_scratch_dir" --output-file "${CI_PROJECT_DIR}/jobs_scratch_dir/pipeline.yml"
artifacts:
paths:
- ${CI_PROJECT_DIR}/jobs_scratch_dir
.perlmutter-e4s-23.08-generate:
stage: generate
needs: ["perlmutter:check_spack_dependencies"]
tags: [perlmutter-e4s]
variables:
version: "23.08"
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
- script_failure
interruptible: true
allow_failure: true
rules:
- if: ($CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web") && ($PIPELINE_NAME == "PERLMUTTER_E4S_23.08")
- if: ($CI_PIPELINE_SOURCE == "merge_request_event")
changes:
- spack-configs/perlmutter-e4s-${version}/$STACK_NAME/spack.yaml
- spack-configs/perlmutter-e4s-${version}/definitions.yaml
before_script:
- *copy_perlmutter_settings
- *startup_modules
script:
- *spack_setup
- cd $CI_PROJECT_DIR/spack-configs/perlmutter-e4s-${version}/$STACK_NAME
- cat $CI_PROJECT_DIR/spack-configs/perlmutter-e4s-${version}/definitions.yaml >> spack.yaml
- spack env activate --without-view .
- spack env st
#- spack -d concretize -f | tee $CI_PROJECT_DIR/concretize.log
- spack -d ci generate --check-index-only --artifacts-root "$CI_PROJECT_DIR/jobs_scratch_dir" --output-file "${CI_PROJECT_DIR}/jobs_scratch_dir/pipeline.yml"
artifacts:
paths:
- ${CI_PROJECT_DIR}/jobs_scratch_dir
# ----------- Spack v0.22 ------------ #
perlmutter-v0.22-gcc-generate:
extends: .perlmutter-v0.22-generate
variables:
STACK_NAME: gcc
perlmutter-v0.22-cuda-generate:
extends: .perlmutter-v0.22-generate
variables:
STACK_NAME: cuda
# ----------- E4S 23.08 ------------ #
perlmutter-e4s-23.08-gcc-generate:
extends: .perlmutter-e4s-23.08-generate
variables:
STACK_NAME: gcc
perlmutter-e4s-23.08-cce-generate:
extends: .perlmutter-e4s-23.08-generate
variables:
STACK_NAME: cce
perlmutter-e4s-23.08-nvhpc-generate:
extends: .perlmutter-e4s-23.08-generate
variables:
STACK_NAME: nvhpc
perlmutter-e4s-23.08-cuda-generate:
extends: .perlmutter-e4s-23.08-generate
variables:
STACK_NAME: cuda
perlmutter-v0.22-gcc-build:
stage: build
needs: ["perlmutter:check_spack_dependencies", "perlmutter-v0.22-gcc-generate"]
allow_failure: true
variables:
version: "v0.22"
STACK_NAME: "gcc"
rules:
- if: ($CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web") && ($PIPELINE_NAME == "PERLMUTTER_V0.22")
- if: ($CI_PIPELINE_SOURCE == "merge_request_event")
changes:
- spack-configs/perlmutter-${version}/${STACK_NAME}/spack.yaml
- spack-configs/perlmutter-${version}/definitions.yaml
trigger:
include:
- artifact: jobs_scratch_dir/pipeline.yml
job: perlmutter-v0.22-gcc-generate
strategy: depend
perlmutter-v0.22-cuda-build:
stage: build
needs: ["perlmutter:check_spack_dependencies", "perlmutter-v0.22-cuda-generate"]
allow_failure: true
variables:
version: "v0.22"
STACK_NAME: "cuda"
rules:
- if: ($CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web") && ($PIPELINE_NAME == "PERLMUTTER_V0.22")
- if: ($CI_PIPELINE_SOURCE == "merge_request_event")
changes:
- spack-configs/perlmutter-${version}/${STACK_NAME}/spack.yaml
- spack-configs/perlmutter-${version}/definitions.yaml
trigger:
include:
- artifact: jobs_scratch_dir/pipeline.yml
job: perlmutter-v0.22-cuda-generate
strategy: depend
perlmutter-e4s-23.08-gcc-build:
stage: build
needs: ["perlmutter:check_spack_dependencies", "perlmutter-e4s-23.08-gcc-generate"]
allow_failure: true
variables:
version: "23.08"
STACK_NAME: "gcc"
rules:
- if: ($CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web") && ($PIPELINE_NAME == "PERLMUTTER_E4S_23.08")
- if: ($CI_PIPELINE_SOURCE == "merge_request_event")
changes:
- spack-configs/perlmutter-e4s-${version}/${STACK_NAME}/spack.yaml
- spack-configs/perlmutter-e4s-${version}/definitions.yaml
trigger:
include:
- artifact: jobs_scratch_dir/pipeline.yml
job: perlmutter-e4s-23.08-gcc-generate
strategy: depend
perlmutter-e4s-23.08-cce-build:
stage: build
needs: ["perlmutter:check_spack_dependencies", "perlmutter-e4s-23.08-cce-generate"]
allow_failure: true
variables:
version: "23.08"
STACK_NAME: "cce"
rules:
- if: ($CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web") && ($PIPELINE_NAME == "PERLMUTTER_E4S_23.08")
- if: ($CI_PIPELINE_SOURCE == "merge_request_event")
changes:
- spack-configs/perlmutter-e4s-${version}/${STACK_NAME}/spack.yaml
- spack-configs/perlmutter-e4s-${version}/definitions.yaml
trigger:
include:
- artifact: jobs_scratch_dir/pipeline.yml
job: perlmutter-e4s-23.08-cce-generate
strategy: depend
perlmutter-e4s-23.08-nvhpc-build:
stage: build
needs: ["perlmutter:check_spack_dependencies", "perlmutter-e4s-23.08-nvhpc-generate"]
allow_failure: true
variables:
version: "23.08"
STACK_NAME: "nvhpc"
rules:
- if: ($CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web") && ($PIPELINE_NAME == "PERLMUTTER_E4S_23.08")
- if: ($CI_PIPELINE_SOURCE == "merge_request_event")
changes:
- spack-configs/perlmutter-e4s-${version}/${STACK_NAME}/spack.yaml
- spack-configs/perlmutter-e4s-${version}/definitions.yaml
trigger:
include:
- artifact: jobs_scratch_dir/pipeline.yml
job: perlmutter-e4s-23.08-nvhpc-generate
strategy: depend
perlmutter-e4s-23.08-cuda-build:
stage: build
needs: ["perlmutter:check_spack_dependencies", "perlmutter-e4s-23.08-cuda-generate"]
allow_failure: true
variables:
version: "23.08"
STACK_NAME: "cuda"
rules:
- if: ($CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web") && ($PIPELINE_NAME == "PERLMUTTER_E4S_23.08")
- if: ($CI_PIPELINE_SOURCE == "merge_request_event")
changes:
- spack-configs/perlmutter-e4s-${version}/${STACK_NAME}/spack.yaml
- spack-configs/perlmutter-e4s-${version}/definitions.yaml
trigger:
include:
- artifact: jobs_scratch_dir/pipeline.yml
job: perlmutter-e4s-23.08-cuda-generate
strategy: depend
## PRODUCTION PIPELINES BELOW
approve:
stage: approve
tags: [shell]
needs: ["perlmutter:check_spack_dependencies"]
rules:
- if: $CI_PIPELINE_SOURCE == "web" && ($PIPELINE_NAME == "PERLMUTTER_E4S_22.11_DEPLOY" || $PIPELINE_NAME == "PERLMUTTER_E4S_23.05_DEPLOY" || $PIPELINE_NAME == "PERLMUTTER_E4S_23.08_DEPLOY" || $PIPELINE_NAME == "PERLMUTTER_v0.22_DEPLOY")
when: manual
allow_failure: false
environment:
name: production
script:
- echo Approval Granted, we will commence execution of production pipeline
perlmutter-e4s-23.08-prod:
stage: deploy
needs: ["perlmutter:check_spack_dependencies", "approve"]
tags: [perlmutter-e4s]
interruptible: true
rules:
- if: $CI_PIPELINE_SOURCE == "web" && $PIPELINE_NAME == "PERLMUTTER_E4S_23.08_DEPLOY"
variables:
version: "23.08"
before_script:
- *copy_perlmutter_settings
- *startup_modules
script:
- set +e
- source setup-env.sh
- e4s_root=/global/common/software/spackecp/perlmutter/e4s-${version}/$CI_PIPELINE_ID
- mkdir -p $e4s_root
- cd $e4s_root
- git clone -c feature.manyFiles=true -b e4s-${version} $SPACK_REPO
- . spack/share/spack/setup-env.sh
- spack-python --path
- export SPACK_GNUPGHOME=$HOME/.gnupg
# add definitions to production spack.yamls
- definitions_file="$CI_PROJECT_DIR/spack-configs/perlmutter-e4s-${version}/definitions.yaml"
# add definitions to production spack.yamls
- cat $definitions_file >> $CI_PROJECT_DIR/spack-configs/perlmutter-e4s-${version}/prod/gcc/spack.yaml
- cat $definitions_file >> $CI_PROJECT_DIR/spack-configs/perlmutter-e4s-${version}/prod/cuda/spack.yaml
- cat $definitions_file >> $CI_PROJECT_DIR/spack-configs/perlmutter-e4s-${version}/prod/cce/spack.yaml
- cat $definitions_file >> $CI_PROJECT_DIR/spack-configs/perlmutter-e4s-${version}/prod/nvhpc/spack.yaml
# gcc deployment
- stack="gcc"
- spack env create $stack $CI_PROJECT_DIR/spack-configs/perlmutter-e4s-${version}/prod/$stack/spack.yaml
- spack env activate $stack
- spack env st
- spack concretize
- spack env depfile --use-buildcache only -o Makefile.${stack}
- make -j128 -f Makefile.${stack} SPACK_INSTALL_FLAGS=--show-log-on-error
- spack find
- spack env deactivate
# cce deployment
- stack="cce"
- spack env create $stack $CI_PROJECT_DIR/spack-configs/perlmutter-e4s-${version}/prod/$stack/spack.yaml
- spack env activate $stack
- spack env st
- spack concretize
- spack env depfile --use-buildcache only -o Makefile.${stack}
- make -j128 -f Makefile.${stack} SPACK_INSTALL_FLAGS=--show-log-on-error
- spack find
- spack env deactivate
# nvhpc deployment
- stack="nvhpc"
- spack env create $stack $CI_PROJECT_DIR/spack-configs/perlmutter-e4s-${version}/prod/$stack/spack.yaml
- spack env activate $stack
- spack env st
- spack concretize
- spack env depfile --use-buildcache only -o Makefile.${stack}
- make -j128 -f Makefile.${stack} SPACK_INSTALL_FLAGS=--show-log-on-error
- spack find
- spack env deactivate
# cuda deployment
- stack="cuda"
- spack env create $stack $CI_PROJECT_DIR/spack-configs/perlmutter-e4s-${version}/prod/$stack/spack.yaml
- spack env activate $stack
- spack env st
- spack concretize
- spack env depfile --use-buildcache only -o Makefile.${stack}
- make -j128 -f Makefile.${stack} SPACK_INSTALL_FLAGS=--show-log-on-error
- spack find
- spack env deactivate
- cp $CI_PROJECT_DIR/spack_site_scope/perlmutter/22.05/config.yaml $SPACK_ROOT/etc/spack/config.yaml
- cp $CI_PROJECT_DIR/spack_site_scope/perlmutter/22.05/modules.yaml $SPACK_ROOT/etc/spack/modules.yaml
- spack -e gcc config get mirrors > $SPACK_ROOT/etc/spack/mirrors.yaml
- cp $CI_PROJECT_DIR/spack_site_scope/spack-setup.sh $SPACK_ROOT/bin/spack-setup.sh
- cp $CI_PROJECT_DIR/spack_site_scope/spack-setup.csh $SPACK_ROOT/bin/spack-setup.csh
- chmod +x $SPACK_ROOT/bin/spack-setup.sh $SPACK_ROOT/bin/spack-setup.csh
perlmutter-v0.22-prod:
stage: deploy
needs: ["perlmutter:check_spack_dependencies", "approve"]
tags: [perlmutter-e4s]
interruptible: true
rules:
- if: $CI_PIPELINE_SOURCE == "web" && $PIPELINE_NAME == "PERLMUTTER_v0.22_DEPLOY"
variables:
version: "v0.22"
branch: "releases/v0.22"
before_script:
- *copy_perlmutter_settings
- *startup_modules
script:
- set +e
- source setup-env.sh
- root_dir=/global/common/software/spackecp/perlmutter/${version}/$CI_PIPELINE_ID
- mkdir -p $root_dir
- cd $root_dir
- git clone -c feature.manyFiles=true -b $branch $SPACK_REPO
- . spack/share/spack/setup-env.sh
- spack-python --path
- export SPACK_GNUPGHOME=$HOME/.gnupg
- definitions_file="$CI_PROJECT_DIR/spack-configs/perlmutter-${version}/definitions.yaml"
# add definitions to production spack.yamls
- cat $definitions_file >> $CI_PROJECT_DIR/spack-configs/perlmutter-${version}/prod/gcc/spack.yaml
- cat $definitions_file >> $CI_PROJECT_DIR/spack-configs/perlmutter-${version}/prod/cuda/spack.yaml
# gcc deployment
- stack="gcc"
- spack env create $stack $CI_PROJECT_DIR/spack-configs/perlmutter-${version}/prod/$stack/spack.yaml
- spack env activate $stack
- spack env st
- spack concretize
- spack env depfile --use-buildcache only -o Makefile.${stack}
- make -j128 -f Makefile.${stack} SPACK_INSTALL_FLAGS=--show-log-on-error
- spack find
- spack env deactivate
# cuda deployment
- stack="cuda"
- spack env create $stack $CI_PROJECT_DIR/spack-configs/perlmutter-${version}/prod/$stack/spack.yaml
- spack env activate $stack
- spack env st
- spack concretize
- spack env depfile --use-buildcache only -o Makefile.${stack}
- make -j128 -f Makefile.${stack} SPACK_INSTALL_FLAGS=--show-log-on-error
- spack find
- spack env deactivate
- cp $CI_PROJECT_DIR/spack_site_scope/perlmutter/22.05/config.yaml $SPACK_ROOT/etc/spack/config.yaml
- cp $CI_PROJECT_DIR/spack_site_scope/perlmutter/22.05/modules.yaml $SPACK_ROOT/etc/spack/modules.yaml
- spack -e gcc config get mirrors > $SPACK_ROOT/etc/spack/mirrors.yaml
- cp $CI_PROJECT_DIR/spack_site_scope/spack-setup.sh $SPACK_ROOT/bin/spack-setup.sh
- cp $CI_PROJECT_DIR/spack_site_scope/spack-setup.csh $SPACK_ROOT/bin/spack-setup.csh
- chmod +x $SPACK_ROOT/bin/spack-setup.sh $SPACK_ROOT/bin/spack-setup.csh