-
Notifications
You must be signed in to change notification settings - Fork 145
414 lines (347 loc) · 12.9 KB
/
spack.yml
File metadata and controls
414 lines (347 loc) · 12.9 KB
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
name: 'Spack Package'
on:
push:
paths:
- 'packaging/spack/**'
- '.github/workflows/spack.yml'
pull_request:
paths:
- 'packaging/spack/**'
- '.github/workflows/spack.yml'
workflow_dispatch:
jobs:
lint:
name: Spack Lint & Style Check
runs-on: ubuntu-latest
steps:
- name: Checkout MFC
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Spack
run: |
git clone --depth=1 https://github.com/spack/spack.git
echo "${GITHUB_WORKSPACE}/spack/bin" >> $GITHUB_PATH
- name: Setup Spack
run: |
. spack/share/spack/setup-env.sh
spack compiler find
- name: Install Package into Spack
run: |
. spack/share/spack/setup-env.sh
# Find the actual builtin repo location
BUILTIN_REPO=$(spack repo list | grep builtin | awk '{print $NF}')
echo "Builtin repo location: $BUILTIN_REPO"
# Copy package file to the builtin repo
mkdir -p "$BUILTIN_REPO/packages/mfc"
cp packaging/spack/package.py "$BUILTIN_REPO/packages/mfc/"
# Verify package is visible
spack list mfc
# Show package info to confirm it loads
spack info mfc
- name: Run Spack Style Check
run: |
. spack/share/spack/setup-env.sh
# Skip flake8 F405 warnings which are expected for star imports in Spack packages
spack style -s flake8 packaging/spack/package.py
- name: Run Spack Audit
run: |
. spack/share/spack/setup-env.sh
spack audit packages mfc
- name: Verify Package Info
run: |
. spack/share/spack/setup-env.sh
spack info mfc
- name: Run Package Logic Tests
run: |
cd packaging/spack
python3 test-package-logic.py
test-spec:
name: Test Package Spec
runs-on: ubuntu-latest
steps:
- name: Checkout MFC
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Spack
run: |
git clone --depth=1 https://github.com/spack/spack.git
echo "${GITHUB_WORKSPACE}/spack/bin" >> $GITHUB_PATH
- name: Setup Spack
run: |
. spack/share/spack/setup-env.sh
spack compiler find
- name: Install Package into Spack
run: |
. spack/share/spack/setup-env.sh
# Find the actual builtin repo location
BUILTIN_REPO=$(spack repo list | grep builtin | awk '{print $NF}')
echo "Builtin repo location: $BUILTIN_REPO"
# Copy package file to the builtin repo
mkdir -p "$BUILTIN_REPO/packages/mfc"
cp packaging/spack/package.py "$BUILTIN_REPO/packages/mfc/"
# Verify package is visible
spack list mfc
# Show package info to confirm it loads
spack info mfc
- name: Test Default Spec
run: |
. spack/share/spack/setup-env.sh
spack spec mfc
- name: Test Minimal Spec
run: |
. spack/share/spack/setup-env.sh
spack spec mfc~mpi~post_process
test-hpc-variants:
name: Test HPC-Specific Configurations
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# NVIDIA GPU configurations
- name: "NVIDIA V100 (Summit)"
spec: "mfc+openacc cuda_arch=70 %nvhpc"
description: "OLCF Summit configuration"
- name: "NVIDIA A100 (Perlmutter)"
spec: "mfc+openmp cuda_arch=80 %nvhpc"
description: "NERSC Perlmutter configuration"
- name: "NVIDIA H100"
spec: "mfc+openacc cuda_arch=90 %nvhpc"
description: "Latest NVIDIA GPU"
# AMD GPU configurations
- name: "AMD MI250X (Frontier)"
spec: "mfc+openacc amdgpu_target=gfx90a %cce"
description: "OLCF Frontier configuration"
- name: "AMD MI300A (El Capitan)"
spec: "mfc+openmp amdgpu_target=gfx942 %cce"
description: "LLNL El Capitan configuration"
# Precision variants
- name: "Single Precision"
spec: "mfc precision=single"
description: "Single precision build"
# Chemistry variant
- name: "Chemistry Enabled"
spec: "mfc+chemistry"
description: "With thermochemistry support"
# Minimal build
- name: "Minimal (no MPI, no post)"
spec: "mfc~mpi~post_process"
description: "Minimal configuration"
steps:
- name: Checkout MFC
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Spack
run: |
git clone --depth=1 https://github.com/spack/spack.git
echo "${GITHUB_WORKSPACE}/spack/bin" >> $GITHUB_PATH
- name: Setup Spack
run: |
. spack/share/spack/setup-env.sh
spack compiler find
- name: Install Package into Spack
run: |
. spack/share/spack/setup-env.sh
BUILTIN_REPO=$(spack repo list | grep builtin | awk '{print $NF}')
mkdir -p "$BUILTIN_REPO/packages/mfc"
cp packaging/spack/package.py "$BUILTIN_REPO/packages/mfc/"
spack list mfc
- name: Test ${{ matrix.name }}
run: |
. spack/share/spack/setup-env.sh
echo "Testing: ${{ matrix.description }}"
echo "Spec: ${{ matrix.spec }}"
# Test that spec can be concretized
if spack spec ${{ matrix.spec }}; then
echo "✓ Spec concretization successful"
else
echo "✗ Spec concretization failed"
exit 1
fi
continue-on-error: true
- name: Verify Spec Output
run: |
. spack/share/spack/setup-env.sh
echo "=== Full spec details for ${{ matrix.name }} ==="
spack spec --reuse ${{ matrix.spec }} || true
test-install-matrix:
name: Test Installation on ${{ matrix.os }} - ${{ matrix.config }}
runs-on: ${{ matrix.os }}
# Run on PR and manual dispatch for thorough testing
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
include:
# Ubuntu - GCC builds
- os: ubuntu-22.04
config: "Default (GCC + MPI)"
spec: "mfc@master"
compiler: "gcc"
test_mpi: true
- os: ubuntu-22.04
config: "Minimal (no MPI)"
spec: "mfc@master~mpi~post_process"
compiler: "gcc"
test_mpi: false
- os: ubuntu-22.04
config: "Single Precision"
spec: "mfc@master precision=single~post_process"
compiler: "gcc"
test_mpi: false
- os: ubuntu-22.04
config: "With Chemistry"
spec: "mfc@master+chemistry~mpi~post_process"
compiler: "gcc"
test_mpi: false
# Ubuntu 20.04 for older environment
- os: ubuntu-20.04
config: "Ubuntu 20.04 baseline"
spec: "mfc@master~mpi~post_process"
compiler: "gcc"
test_mpi: false
# macOS builds
- os: macos-13
config: "macOS Intel"
spec: "mfc@master~mpi~post_process"
compiler: "gcc"
test_mpi: false
- os: macos-14
config: "macOS ARM (M1)"
spec: "mfc@master~mpi~post_process"
compiler: "gcc"
test_mpi: false
steps:
- name: Checkout MFC
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install System Dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y gfortran cmake libopenblas-dev libfftw3-dev libhdf5-dev
if [ "${{ matrix.test_mpi }}" == "true" ]; then
sudo apt-get install -y libopenmpi-dev openmpi-bin
fi
- name: Install System Dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install gcc cmake fftw hdf5 openblas
- name: Install Spack
run: |
git clone --depth=1 https://github.com/spack/spack.git
echo "${GITHUB_WORKSPACE}/spack/bin" >> $GITHUB_PATH
- name: Setup Spack with Binary Cache
run: |
. spack/share/spack/setup-env.sh
spack compiler find
echo "Found compilers:"
spack compiler list
# Add binary cache for faster builds
spack mirror add binary_mirror https://binaries.spack.io/v0.23.1
spack buildcache keys --install --trust || true
# Mark system packages as external
spack external find --not-buildable cmake python perl || true
if [ "${{ runner.os }}" == "Linux" ]; then
spack external find --not-buildable gfortran gcc || true
fi
- name: Cache Spack Dependencies
id: spack-cache
uses: actions/cache@v4
with:
path: |
spack/opt/spack
spack/var/spack/cache
key: spack-deps-${{ matrix.os }}-${{ matrix.config }}-${{ hashFiles('packaging/spack/package.py') }}
restore-keys: |
spack-deps-${{ matrix.os }}-${{ matrix.config }}-
spack-deps-${{ matrix.os }}-
- name: Install Package into Spack
run: |
. spack/share/spack/setup-env.sh
BUILTIN_REPO=$(spack repo list | grep builtin | awk '{print $NF}')
echo "Builtin repo location: $BUILTIN_REPO"
mkdir -p "$BUILTIN_REPO/packages/mfc"
cp packaging/spack/package.py "$BUILTIN_REPO/packages/mfc/"
spack list mfc
echo "Testing spec: ${{ matrix.spec }}"
spack spec ${{ matrix.spec }}
- name: Install MFC via Spack
timeout-minutes: 90
run: |
. spack/share/spack/setup-env.sh
echo "Installing: ${{ matrix.spec }}"
spack install --show-log-on-error --verbose ${{ matrix.spec }}
- name: Verify Installation
run: |
. spack/share/spack/setup-env.sh
spack load mfc
echo "=== Installed files ==="
spack find -p mfc
echo "=== Checking binaries ==="
which pre_process || (echo "pre_process not found" && exit 1)
which simulation || (echo "simulation not found" && exit 1)
echo "=== Binary info ==="
file $(which pre_process)
file $(which simulation)
if [ "${{ matrix.test_mpi }}" == "false" ]; then
# For non-MPI builds, check that binaries are not linked to MPI
if ldd $(which simulation) 2>/dev/null | grep -i mpi; then
echo "ERROR: Non-MPI build is linked to MPI!"
exit 1
fi
echo "✓ Confirmed non-MPI build"
fi
- name: Test MFC Execution
run: |
. spack/share/spack/setup-env.sh
spack load mfc
mkdir -p test_run
cd test_run
# Copy example case
cp ../examples/1D_sodshocktube/case.py .
# Generate case configuration
python3 case.py > case.json
echo "✓ Generated case configuration"
# Run pre_process
pre_process < case.json
echo "✓ Pre-processing completed"
# Verify pre_process output
if [ ! -f "D/D.dat" ]; then
echo "ERROR: Pre-processing didn't create expected output"
ls -la
exit 1
fi
# Run simulation (verify it executes)
timeout 60 simulation || true
echo "✓ Simulation executed"
- name: Test MPI Execution (if applicable)
if: matrix.test_mpi == true
run: |
. spack/share/spack/setup-env.sh
spack load mfc
cd test_run
echo "=== Testing MPI execution with 2 processes ==="
mpirun -n 2 simulation || true
echo "✓ MPI execution completed"
- name: Upload Build Logs on Failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-logs-${{ matrix.os }}-${{ matrix.config }}
path: |
spack/var/spack/stage/*/spack-build-out.txt
spack/var/spack/stage/*/spack-build-env.txt
retention-days: 7