-
Notifications
You must be signed in to change notification settings - Fork 86
209 lines (180 loc) · 6.8 KB
/
build.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
name: Build
on:
push:
branches: [development, main]
paths-ignore:
- 'README.md'
- 'INSTALL.md'
- 'docs/**'
pull_request:
branches: [development, main]
paths-ignore:
- 'README.md'
- 'INSTALL.md'
- 'docs/**'
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled'
required: false
default: true
jobs:
run:
strategy:
matrix:
include:
- name: "[Ubuntu] gcc"
os: ubuntu-latest
CC: gcc
CXX: g++
CXXFLAGS: -Wno-maybe-uninitialized
FC: gfortran
GCOV: gcov
OCCA_COVERAGE: 1
OCCA_FORTRAN_ENABLED: 1
- name: "[Ubuntu] CMake + gcc"
os: ubuntu-latest
CC: gcc
CXX: g++
CXXFLAGS: -Wno-maybe-uninitialized -Wno-cpp
FC: gfortran
OCCA_FORTRAN_ENABLED: 1
useCMake: true
useTranspiler: true
- name: "[Ubuntu] CMake + clang"
os: ubuntu-latest
CC: clang
CXX: clang++
CXXFLAGS: -Wno-uninitialized
useCMake: true
useTranspiler: true
- name: "[Ubuntu] CMake + Intel/LLVM"
os: ubuntu-latest
CC: gcc
CXX: g++
CXXFLAGS: -Wno-uninitialized
FC: gfortran
OCCA_COVERAGE: 0
OCCA_FORTRAN_ENABLED: 1
useCMake: true
useoneAPI: 0
useTranspiler: true
runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
FC: ${{ matrix.FC }}
CXXFLAGS: -O3 -Wall -pedantic -Wshadow -Wsign-compare -Wuninitialized -Wtype-limits -Wignored-qualifiers -Wempty-body -Wextra -Wno-unused-parameter -Werror -Wno-strict-aliasing ${{ matrix.CXXFLAGS }}
OCCA_CXXFLAGS: -O3
GCOV: ${{ matrix.GCOV }}
OCCA_COVERAGE: ${{ matrix.OCCA_COVERAGE }}
OCCA_FORTRAN_ENABLED: ${{ matrix.OCCA_FORTRAN_ENABLED }}
FORTRAN_EXAMPLES: ${{ matrix.OCCA_FORTRAN_ENABLED }}
TRANSPILER_VERSION: 1.1
TRANSPILER_CACHE_NUMBER: 0 # Increase to reset cache manually.
steps:
- uses: actions/checkout@v4
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3.13
if: ${{ inputs.debug_enabled }}
- name: Setup environment variables for oneAPI
if: ${{ matrix.useoneAPI }}
run: echo "USE_ONEAPI=1" >> ${GITHUB_ENV}
- name: Setup environment variables for transpiler
if: ${{ matrix.useTranspiler }}
run: |
echo "USE_TRANSPILER=1" >> ${GITHUB_ENV}
- name: Add oneAPI to apt
if: ${{ matrix.useoneAPI }}
shell: bash
run: |
cd /tmp
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
- name: Install oneAPI dpcpp compiler
if: ${{ matrix.useoneAPI }}
shell: bash
run: |
sudo apt update
sudo apt install intel-oneapi-compiler-dpcpp-cpp
sudo apt install intel-oneapi-compiler-fortran
- name: Install clang compiler required for transpiler
if: ${{ matrix.useTranspiler }}
shell: bash
run: |
wget https://raw.githubusercontent.com/opencollab/llvm-jenkins.debian.net/master/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17 all
- name: Cache transpiler install directory
if: ${{ matrix.useTranspiler }}
uses: actions/cache@v3
id: cache
with:
path: occa-transpiler-${{ env.TRANSPILER_VERSION }}/install
key: transpiler-${{ runner.os }}-${{ env.CXX }}-${{ env.CC }}-${{ hashFiles('.github/workflows/build.yml') }}-${{ env.TRANSPILER_CACHE_NUMBER }}
- name: Download and build clang transpiler
if: ${{ matrix.useTranspiler && (steps.cache.outputs.cache-hit != 'true' ) }}
shell: bash
run: |
wget https://github.com/libocca/occa-transpiler/releases/download/v${TRANSPILER_VERSION}/occa-transpiler-${TRANSPILER_VERSION}-including-submodules.tar.gz
tar -zxvf occa-transpiler-${TRANSPILER_VERSION}-including-submodules.tar.gz
cd occa-transpiler-${TRANSPILER_VERSION}
mkdir -p build
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install -DCMAKE_CXX_FLAGS="-Wall"
cmake --build build --target install --parallel 8
- name: Compile library with CMake
if: ${{ matrix.useCMake }}
run: |
if [ ! -z ${USE_ONEAPI+x} ] && [ "${USE_ONEAPI}" -eq 1 ]; then
source /opt/intel/oneapi/setvars.sh
fi
cmake -S . -B build \
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_C_COMPILER=${CC} \
-DCMAKE_CXX_COMPILER=${CXX} \
-DCMAKE_Fortran_COMPILER=${FC} \
-DOCCA_ENABLE_TESTS=ON \
-DOCCA_ENABLE_EXAMPLES=ON \
-DOCCA_CLANG_BASED_TRANSPILER=${USE_TRANSPILER} \
-DCMAKE_PREFIX_PATH=occa-transpiler-${TRANSPILER_VERSION}/install/ \
-DOCCA_ENABLE_FORTRAN=${OCCA_FORTRAN_ENABLED}
cmake --build build --parallel 16
- name: Run CTests
if: ${{ matrix.useCMake }}
env:
OCCA_DPCPP_COMPILER: icpx
run: |
if [ ! -z ${USE_ONEAPI+x} ] && [ "${USE_ONEAPI}" -eq 1 ]; then
source /opt/intel/oneapi/setvars.sh
export ONEAPI_DEVICE_SELECTOR=*:cpu
exclude_list="opencl-*|dpcpp-*"
else
exclude_list="examples_cpp_arrays-opencl|examples_cpp_for_loops-opencl|examples_cpp_generic_inline_kernel-opencl|examples_cpp_shared_memory-opencl|examples_cpp_nonblocking_streams-opencl|examples_cpp_for_loops-dpcpp|examples_cpp_arrays-dpcpp|examples_cpp_generic_inline_kernel-dpcpp|examples_cpp_nonblocking_streams-dpcpp"
fi
ctest --test-dir build --progress --output-on-failure --parallel 8 --schedule-random -E ${exclude_list}
- name: Print compiler info for GNU Make
if: ${{ !matrix.useCMake }}
run: make -j 16 info
- name: Compile library with GNU Make
if: ${{ !matrix.useCMake }}
run: make -j 16
- name: Compile tests with GNU Make
if: ${{ !matrix.useCMake }}
run: make -j 16 tests
- name: Run unit tests
if: ${{ !matrix.useCMake }}
run: ./tests/run_tests
- name: Run examples
if: ${{ !matrix.useCMake }}
run: ./tests/run_examples
- name: Upload code coverage
if: ${{ matrix.OCCA_COVERAGE }}
run: bash <(curl --no-buffer -s https://codecov.io/bash) -x "${GCOV}"
- name: Block to allow inspecting failures
run: sleep 1800
if: ${{ failure() && inputs.debug_enabled }}