-
Notifications
You must be signed in to change notification settings - Fork 145
215 lines (188 loc) · 6.95 KB
/
spack.yml
File metadata and controls
215 lines (188 loc) · 6.95 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
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 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
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 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-install:
name: Test Installation & Execution
# Only run on pull requests or manual workflow dispatch to save CI time
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
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 System Dependencies
run: |
sudo apt-get update
sudo apt-get install -y gfortran cmake libopenblas-dev libfftw3-dev libhdf5-dev
- 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
# Add binary cache mirror for pre-built packages
spack mirror add binary_mirror https://binaries.spack.io/v0.23.1
spack buildcache keys --install --trust
# Mark system packages as external to avoid building
spack external find --not-buildable cmake python perl gfortran gcc
spack config add "packages:all:target:[x86_64]"
- name: Cache Spack Dependencies
id: spack-cache
uses: actions/cache@v4
with:
path: |
spack/opt/spack
spack/var/spack/cache
key: spack-deps-${{ runner.os }}-${{ hashFiles('packaging/spack/package.py') }}
restore-keys: |
spack-deps-${{ runner.os }}-
- name: Check Cache Status
run: |
if [ "${{ steps.spack-cache.outputs.cache-hit }}" == "true" ]; then
echo "✓ Cache hit! Dependencies already built."
. spack/share/spack/setup-env.sh
spack find
else
echo "⚠ Cache miss. Will build dependencies from source (~30-40 min)."
fi
- 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 and patch files to the builtin repo
mkdir -p "$BUILTIN_REPO/packages/mfc"
cp packaging/spack/package.py "$BUILTIN_REPO/packages/mfc/"
cp packaging/spack/*.patch "$BUILTIN_REPO/packages/mfc/" 2>/dev/null || true
# Verify package is visible
spack list mfc
- name: Install MFC Dependencies
run: |
. spack/share/spack/setup-env.sh
# Install just the dependencies first (these are cached)
spack install --show-log-on-error --only dependencies mfc@master~mpi~post_process
- name: Install MFC via Spack
run: |
. spack/share/spack/setup-env.sh
# Install MFC itself (dependencies are already installed/cached)
spack install --show-log-on-error mfc@master~mpi~post_process
- name: Test MFC Execution
run: |
. spack/share/spack/setup-env.sh
spack load mfc
# Verify binaries are available
which pre_process
which simulation
echo "✓ Binaries found"
# Create test directory
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"
# Run simulation (just 1 step to verify it works)
simulation
echo "✓ Simulation completed"