-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.gitlab-ci.yml
360 lines (327 loc) · 13 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
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
# running module reset and loading cpu is important, since spack builds are highly sensitive to modules loaded. For more detail see https://github.com/spack/spack/issues/27124
- 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
# this line is important, since e4s user has signed GPG in $HOME directory used for signing all packages, if this is not set, spack will write a new GPG key in $SPACK_ROOT
- 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
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.23-generate:
stage: generate
needs: ["perlmutter:check_spack_dependencies"]
tags: [perlmutter-e4s]
variables:
version: "v0.23"
branch: "releases/v0.23"
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.23")
- 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-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 v0.23 ------------ #
perlmutter-v0.23-gcc-generate:
extends: .perlmutter-v0.23-generate
variables:
STACK_NAME: gcc
perlmutter-v0.23-gcc-build:
stage: build
needs: ["perlmutter:check_spack_dependencies", "perlmutter-v0.23-gcc-generate"]
allow_failure: true
variables:
version: "v0.23"
STACK_NAME: "gcc"
rules:
- if: ($CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web") && ($PIPELINE_NAME == "PERLMUTTER_V0.23")
- 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.23-gcc-generate
strategy: depend
# ----------- Perlmutter 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
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
## PRODUCTION PIPELINES BELOW
approve:
stage: approve
tags: [shell]
needs: ["perlmutter:check_spack_dependencies"]
rules:
- if: $CI_PIPELINE_SOURCE == "web" && ($PIPELINE_NAME == "PERLMUTTER_v0.22_DEPLOY" || $PIPELINE_NAME == "PERLMUTTER_v0.23_DEPLOY")
when: manual
allow_failure: false
environment:
name: production
script:
- echo Approval Granted, we will commence execution of production pipeline
perlmutter-v0.23-prod:
stage: deploy
needs: ["perlmutter:check_spack_dependencies", "approve"]
tags: [perlmutter-e4s]
interruptible: true
rules:
- if: $CI_PIPELINE_SOURCE == "web" && $PIPELINE_NAME == "PERLMUTTER_v0.23_DEPLOY"
variables:
version: "v0.23"
branch: "releases/v0.23"
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
# 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
- 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