Repository navigation
355 lines (318 loc) · 12.4 KB
/
Copy pathcompile.yml
File metadata and controls
355 lines (318 loc) · 12.4 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
# Tests for successful compilation of the source
# code with (attemptedly) all possible configurations
# of operating system, precision, multithreading,
# distribution, GPU-acceleration (via CUDA or HIP),
# and cuQuantum (else custom kernels). Compilation
# includes the v4 unit and integration tests, the
# deprecated v3 tests (when possible), and all the
# example programs. All 'isolated' example executables
# are then run (both C and C++ versions) to ensure the
# build was successful and does not cause link-time
# errors. Then, all 'automated' examples are run which
# permits contributors to demo or test their changes
# across all operation systems and compilers.
#
# Note:
# - This workflow currently wastefully re-downloads and
# installs all needed compilers (like libomp, CUDA, ROCm)
# - ARM compilation is not tested here, though it is used
# by the paid multithreaded CI tests.
#
# @author Tyson Jones
name: compile
on:
push:
branches:
- main
- devel
pull_request:
branches:
- main
- devel
jobs:
# test only compilation succeeds (no execution)
build-test:
name: >
${{ startsWith(matrix.os, 'ubuntu' ) && 'Linux' ||
startsWith(matrix.os, 'macos' ) && 'MacOS' ||
startsWith(matrix.os, 'windows') && 'Windows' ||
'Unknown' }}
${{ endsWith(matrix.os, '15-intel') && '(Intel 2015)' || '' }}
${{ endsWith(matrix.os, '26-intel') && '(Intel 2026)' || '' }}
[${{ matrix.precision }}]
${{ matrix.omp == 'ON' && 'OMP' || '' }}
${{ matrix.mpi == 'ON' && 'MPI' || '' }}
${{ matrix.mpi == 'ON' && format('({0})',matrix.mpilib) || '' }}
${{ matrix.cuda == 'ON' && 'CUDA' || '' }}
${{ matrix.hip == 'ON' && 'HIP' || '' }}
${{ matrix.cuquantum == 'ON' && 'CUQ' || '' }}
${{ matrix.adios2 == 'ON' && 'CKPT' || '' }}
${{ matrix.bmi2 == 'ON' && 'BMI' || '' }}
runs-on: ${{ matrix.os }}
strategy:
# continue other jobs if any fail
fail-fast: false
# limit concurrent jobs to avoid running out of disk
# (causes CUDA and MPI installation to fail on Windows)
max-parallel: 8
# compile QuEST with all combinations of below flags (Intel runners for BMI2 instrinsics);
# incredibly, this (with exclusions below) achieves 256 combos, which is the Github limit!
matrix:
os: [windows-2022, ubuntu-latest, macos-latest, macos-15-intel, macos-26-intel]
precision: [1, 2, 4]
omp: [ON, OFF]
mpi: [ON, OFF]
cuda: [ON, OFF]
hip: [ON, OFF]
cuquantum: [ON, OFF]
adios2: [ON, OFF]
bmi2: [ON, OFF]
mpilib: ['', 'mpich', 'ompi', 'impi', 'msmpi']
# disable deprecated API on MSVC, and assign unique compilers,
# so that we can concisely consult e.g. matrix.compiler=='cl'
# instead of hardcoding the operating system label. Note that
# ultimately env.compiler, not matrix.compiler, will be set/used
include:
- os: ubuntu-latest
compiler: g++
deprecated: ON
- os: macos-latest
compiler: clang++
deprecated: ON
- os: macos-15-intel
compiler: clang++
deprecated: ON
- os: macos-26-intel
compiler: clang++
deprecated: ON
- os: windows-2022
compiler: cl
deprecated: OFF
exclude:
# cannot simultaneously use CUDA and HIP
- cuda: ON
hip: ON
# cannot use GPU with quad-precision
- cuda: ON
precision: 4
- hip: ON
precision: 4
# cannot use cuquantum without CUDA
- cuda: OFF
cuquantum: ON
# cannot use GPU on MacOS
- cuda: ON
os: macos-latest
- cuda: ON
os: macos-15-intel
- cuda: ON
os: macos-26-intel
- hip: ON
os: macos-latest
- hip: ON
os: macos-15-intel
- hip: ON
os: macos-26-intel
# cannot use cuquantum on Windows or MacOS
- cuquantum: ON
os: windows-2022
- cuquantum: ON
os: macos-latest
- cuquantum: ON
os: macos-15-intel
- cuquantum: ON
os: macos-26-intel
# cannot use BMI2 on non-Intel MacOS
- bmi2: ON
os: macos-latest
# use ONLY BMI2 on Intel MacOS, just to shrink matrix (Github imposes 256 max)
- bmi2: OFF
os: macos-15-intel
- bmi2: OFF
os: macos-26-intel
# do not combine BMI2 with MPI or ADIOS2 (they don't interact), just to shrink matrix
- bmi2: ON
mpi: ON
- bmi2: ON
adios2: ON
# don't enumerate MPI libraries when not using MPI
- mpi: OFF
mpilib: 'mpich' # MPICH
- mpi: OFF
mpilib: 'ompi' # OpenMPI
- mpi: OFF
mpilib: 'impi' # Intel MPI
- mpi: OFF
mpilib: 'msmpi' # Microsoft MPI
- mpi: ON
mpilib: '' # must pick lib when using MPI
# exclude OS-incompatible MPI libraries
- os: ubuntu-latest
mpilib: 'msmpi' # Linux: [MPICH, OpenMPI, Intel MPI]
- os: macos-latest
mpilib: 'msmpi' # MacOS: [MPICH, OpenMPI]
- os: macos-latest
mpilib: 'impi'
- os: macos-15-intel
mpilib: 'msmpi'
- os: macos-15-intel
mpilib: 'impi'
- os: macos-26-intel
mpilib: 'msmpi'
- os: macos-26-intel
mpilib: 'impi'
- os: windows-2022
mpilib: 'mpich' # Windows: [Intel MPI, MS MPI]
- os: windows-2022
mpilib: 'ompi'
# cannot presently install HIP on Windows CI (times out)
- hip: ON
os: windows-2022
# cannot presently compile HIP + MPI; the linker fails with
# "undefined reference to 'vtable for thrust::system::system_error'
# (see failed attempted solutions in PR #554)
- hip: ON
mpi: ON
# constants
env:
cuda_arch: 70
hip_arch: gfx801
rocm_path: /opt/rocm/bin
build_dir: build
isolated_dir: build/examples/isolated
automated_dir: build/examples/automated
# perform the job
steps:
# free space for big-chungus ROCm compiler
- name: Free disk space
if: ${{ matrix.hip == 'ON' }}
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
# download QuEST
- name: Get QuEST
uses: actions/checkout@main
# obtain OMP for Clang multithreading
- name: Setup libomp
if: ${{ matrix.compiler == 'clang++' && matrix.omp == 'ON' }}
run: >
brew install libomp;
echo "OpenMP_ROOT=$(brew --prefix)/opt/libomp" >> $GITHUB_ENV
# obtain MPI for distribution
- name: Setup MPI
if: ${{ matrix.mpi == 'ON' }}
uses: mpi4py/setup-mpi@v1
with:
mpi: ${{ matrix.mpilib }}
# obtain CUDA for GPU acceleration (cuQuantum needs cuBLAS)
- name: Setup CUDA (non-MSVC)
if: ${{ matrix.cuda == 'ON' && matrix.compiler != 'cl' }}
uses: Jimver/cuda-toolkit@v0.2.21
with:
method: network
sub-packages: '["nvcc", "cudart", "thrust"]'
non-cuda-sub-packages: ${{ matrix.cuquantum == 'ON' && '["libcublas"]' || '[]' }}
# bug in Nsight for MSVC breaks above action for windows-2022, so we revert to script
- name: Setup CUDA (MSVC)
if: ${{ matrix.cuda == 'ON' && matrix.compiler == 'cl' }}
shell: pwsh
run: .github/scripts/setup_cuda.ps1
env:
INPUT_CUDA_VERSION: 12.5.0
# obtain cuQuantum on linux
- name: Setup cuQuantum
if: ${{ matrix.cuquantum == 'ON' }}
run: >
wget https://developer.download.nvidia.com/compute/cuquantum/redist/cuquantum/linux-x86_64/cuquantum-linux-x86_64-24.08.0.5_cuda12-archive.tar.xz;
tar -xvf cuquantum-linux-x86_64-24.08.0.5_cuda12-archive.tar.xz;
echo "CUQUANTUM_ROOT=cuquantum-linux-x86_64-24.08.0.5_cuda12-archive" >> $GITHUB_ENV
# obtain ROCm for HIP acceleration on Linux
- name: Install ROCm
if: ${{ matrix.hip == 'ON' }}
run: |
sudo apt update
sudo apt upgrade
sudo apt install "linux-headers-$(uname -r)" "linux-modules-extra-$(uname -r)"
# Make the directory if it doesn't exist yet.
# This location is recommended by the distribution maintainers.
sudo mkdir --parents --mode=0755 /etc/apt/keyrings
# Download the key, convert the signing-key to a full
# keyring required by apt and store in the keyring directory
wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | \
gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null
sudo tee /etc/apt/sources.list.d/amdgpu.list << EOF
deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/7.2 noble main
deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/graphics/7.2/ubuntu noble main
EOF
sudo tee /etc/apt/preferences.d/rocm-pin-600 << EOF
Package: *
Pin: release o=repo.radeon.com
Pin-Priority: 600
EOF
sudo apt update
sudo apt autoremove
sudo apt install rocm rocm-hip-sdk rocm-hip-runtime-dev
echo "${{ env.rocm_path }}" >> $GITHUB_PATH
# invoke cmake, disabling LTO (it duplicates symbols with CUDA + MPI)
- name: Configure CMake
run: >
cmake -B ${{ env.build_dir }}
-DQUEST_BUILD_EXAMPLES=ON
-DQUEST_BUILD_TESTS=ON
-DQUEST_FLOAT_PRECISION=${{ matrix.precision }}
-DQUEST_ENABLE_DEPRECATED_API=${{ matrix.deprecated }}
-DQUEST_DISABLE_DEPRECATION_WARNINGS=${{ matrix.deprecated }}
-DQUEST_ENABLE_OMP=${{ matrix.omp }}
-DQUEST_ENABLE_MPI=${{ matrix.mpi }}
-DQUEST_ENABLE_CUDA=${{ matrix.cuda }}
-DQUEST_ENABLE_HIP=${{ matrix.hip }}
-DQUEST_ENABLE_CUQUANTUM=${{ matrix.cuquantum }}
-DQUEST_ENABLE_ADIOS2=${{ matrix.adios2 }}
-DQUEST_ENABLE_BMI2=${{ matrix.bmi2 }}
-DCMAKE_CUDA_ARCHITECTURES=${{ env.cuda_arch }}
-DCMAKE_HIP_ARCHITECTURES=${{ env.hip_arch }}
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }}
-DCMAKE_CXX_FLAGS=${{ matrix.mpi == 'ON' && matrix.cuda == 'ON' && '-fno-lto' || '' }}
# force 'Release' build (needed by MSVC to enable optimisations),
# and force serial compilation to avoid ADIOS2 OOM error
- name: Compile
run: cmake --build ${{ env.build_dir }} --config Release --parallel 1
# run all compiled isolated examples to test for link-time errors,
# continuing if any fail (since some deliberately fail)
- name: Run isolated examples (Windows)
if: ${{ matrix.os == 'windows-2022' }}
working-directory: ${{ env.isolated_dir }}/Release/
shell: pwsh
run: |
Get-ChildItem -Filter '*.exe' -File |
ForEach-Object {
Write-Host "`r`n[[[ $($_.Name) ]]]`r`n"
& $_.FullName
}
- name: Run isolated examples (Unix)
if: ${{ matrix.os != 'windows-2022' }}
working-directory: ${{ env.isolated_dir }}
run: |
for fn in *_c *_cpp; do
printf "\n[[[ $fn ]]]\n"
./$fn || true
done
# run all compiled 'automated' examples
- name: Run automated examples (Windows)
if: ${{ matrix.os == 'windows-2022' }}
working-directory: ${{ env.automated_dir }}/Release/
shell: pwsh
run: |
Get-ChildItem -Filter '*.exe' -File |
ForEach-Object {
Write-Host "`r`n[[[ $($_.Name) ]]]`r`n"
& $_.FullName
}
- name: Run automated examples (Unix)
if: ${{ matrix.os != 'windows-2022' }}
working-directory: ${{ env.automated_dir }}
run: |
for fn in *_c *_cpp; do
printf "\n[[[ $fn ]]]\n"
./$fn || true
done