@@ -5,27 +5,20 @@ on: [push, pull_request]
5
5
jobs :
6
6
build :
7
7
runs-on : ${{ matrix.os }}
8
+
8
9
strategy :
9
10
fail-fast : false
10
11
matrix :
11
12
os : [ubuntu-latest, macos-latest]
12
13
fortran : [gfortran, flang]
13
14
build : [cmake, make]
15
+ exclude :
16
+ - os : macos-latest
17
+ fortran : flang
18
+
14
19
steps :
15
20
- name : Checkout repository
16
- uses : actions/checkout@v2
17
-
18
- - name : Compilation cache
19
- uses : actions/cache@v2
20
- with :
21
- path : ~/.ccache
22
- # We include the commit sha in the cache key, as new cache entries are
23
- # only created if there is no existing entry for the key yet.
24
- key : ${{ runner.os }}-ccache-${{ github.sha }}
25
- # Restore any ccache cache entry, if none for
26
- # ${{ runner.os }}-ccache-${{ github.sha }} exists
27
- restore-keys : |
28
- ${{ runner.os }}-ccache-
21
+ uses : actions/checkout@v3
29
22
30
23
- name : Print system information
31
24
run : |
34
27
elif [ "$RUNNER_OS" == "macOS" ]; then
35
28
sysctl -a | grep machdep.cpu
36
29
else
37
- echo "$RUNNER_OS not supported"
30
+ echo "::error:: $RUNNER_OS not supported"
38
31
exit 1
39
32
fi
40
33
@@ -43,61 +36,224 @@ jobs:
43
36
if [ "$RUNNER_OS" == "Linux" ]; then
44
37
sudo apt-get install -y gfortran cmake ccache
45
38
elif [ "$RUNNER_OS" == "macOS" ]; then
39
+ # It looks like "gfortran" isn't working correctly unless "gcc" is re-installed.
40
+ brew reinstall gcc
46
41
brew install coreutils cmake ccache
47
42
else
48
- echo "$RUNNER_OS not supported"
43
+ echo "::error:: $RUNNER_OS not supported"
49
44
exit 1
50
45
fi
51
- ccache -M 300M # Limit the ccache size; Github's overall cache limit is 5GB
52
46
53
- - name : gfortran build
54
- if : matrix.build == 'make' && matrix.fortran == 'gfortran'
47
+ - name : Compilation cache
48
+ uses : actions/cache@v3
49
+ with :
50
+ path : ~/.ccache
51
+ # We include the commit sha in the cache key, as new cache entries are
52
+ # only created if there is no existing entry for the key yet.
53
+ # GNU make and cmake call the compilers differently. It looks like
54
+ # that causes the cache to mismatch. Keep the ccache for both build
55
+ # tools separate to avoid polluting each other.
56
+ key : ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }}-${{ github.ref }}-${{ github.sha }}
57
+ # Restore a matching ccache cache entry. Prefer same branch and same Fortran compiler.
58
+ restore-keys : |
59
+ ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }}-${{ github.ref }}
60
+ ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }}
61
+ ccache-${{ runner.os }}-${{ matrix.build }}
62
+
63
+ - name : Configure ccache
55
64
run : |
56
- if [ "$RUNNER_OS" == "Linux" ]; then
57
- export PATH="/usr/lib/ccache:${PATH}"
58
- elif [ "$RUNNER_OS" == "macOS" ]; then
59
- export PATH="$(brew --prefix)/opt/ccache/libexec:${PATH}"
60
- else
61
- echo "$RUNNER_OS not supported"
62
- exit 1
65
+ if [ "${{ matrix.build }}" = "make" ]; then
66
+ # Add ccache to path
67
+ if [ "$RUNNER_OS" = "Linux" ]; then
68
+ echo "/usr/lib/ccache" >> $GITHUB_PATH
69
+ elif [ "$RUNNER_OS" = "macOS" ]; then
70
+ echo "$(brew --prefix)/opt/ccache/libexec" >> $GITHUB_PATH
71
+ else
72
+ echo "::error::$RUNNER_OS not supported"
73
+ exit 1
74
+ fi
63
75
fi
76
+ # Limit the maximum size and switch on compression to avoid exceeding the total disk or cache quota (5 GB).
77
+ test -d ~/.ccache || mkdir -p ~/.ccache
78
+ echo "max_size = 300M" > ~/.ccache/ccache.conf
79
+ echo "compression = true" >> ~/.ccache/ccache.conf
80
+ ccache -s
64
81
65
- make -j$(nproc) DYNAMIC_ARCH=1 USE_OPENMP=0
66
-
67
- - name : flang build
68
- if : matrix.build == 'make' && matrix.fortran == 'flang'
82
+ - name : Build OpenBLAS
69
83
run : |
70
- if [ "$RUNNER_OS " == "Linux " ]; then
71
- export PATH="/usr/lib/ccache:${PATH}"
72
- elif [ "$RUNNER_OS" == "macOS" ]; then
73
- exit 0
74
- else
75
- echo "$RUNNER_OS not supported"
76
- exit 1
84
+ if [ "${{ matrix.fortran }} " = "flang " ]; then
85
+ # download and install classic flang
86
+ cd /usr/
87
+ sudo wget -nv https://github.com/flang-compiler/flang/releases/download/flang_20190329/flang-20190329-x86-70.tgz
88
+ sudo tar xf flang-20190329-x86-70.tgz
89
+ sudo rm flang-20190329-x86-70.tgz
90
+ cd -
77
91
fi
92
+ case "${{ matrix.build }}" in
93
+ "make")
94
+ make -j$(nproc) DYNAMIC_ARCH=1 USE_OPENMP=0 FC="ccache ${{ matrix.fortran }}"
95
+ ;;
96
+ "cmake")
97
+ mkdir build && cd build
98
+ cmake -DDYNAMIC_ARCH=1 \
99
+ -DNOFORTRAN=0 \
100
+ -DBUILD_WITHOUT_LAPACK=0 \
101
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
102
+ -DCMAKE_BUILD_TYPE=Release \
103
+ -DCMAKE_Fortran_COMPILER=${{ matrix.fortran }} \
104
+ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
105
+ -DCMAKE_Fortran_COMPILER_LAUNCHER=ccache \
106
+ ..
107
+ cmake --build .
108
+ ;;
109
+ *)
110
+ echo "::error::Configuration not supported"
111
+ exit 1
112
+ ;;
113
+ esac
114
+
115
+ - name : Show ccache status
116
+ continue-on-error : true
117
+ run : ccache -s
118
+
119
+ - name : Run tests
120
+ timeout-minutes : 60
121
+ run : |
122
+ case "${{ matrix.build }}" in
123
+ "make")
124
+ MAKE_FLAGS='DYNAMIC_ARCH=1 USE_OPENMP=0'
125
+ echo "::group::Tests in 'test' directory"
126
+ make -C test $MAKE_FLAGS FC="ccache ${{ matrix.fortran }}"
127
+ echo "::endgroup::"
128
+ echo "::group::Tests in 'ctest' directory"
129
+ make -C ctest $MAKE_FLAGS FC="ccache ${{ matrix.fortran }}"
130
+ echo "::endgroup::"
131
+ echo "::group::Tests in 'utest' directory"
132
+ make -C utest $MAKE_FLAGS FC="ccache ${{ matrix.fortran }}"
133
+ echo "::endgroup::"
134
+ ;;
135
+ "cmake")
136
+ cd build && ctest
137
+ ;;
138
+ *)
139
+ echo "::error::Configuration not supported"
140
+ exit 1
141
+ ;;
142
+ esac
143
+
144
+
145
+ msys2 :
146
+ runs-on : windows-latest
147
+
148
+ strategy :
149
+ fail-fast : false
150
+ matrix :
151
+ msystem : [MINGW64, MINGW32, CLANG64]
152
+ idx : [int32, int64]
153
+ include :
154
+ - msystem : MINGW64
155
+ idx : int32
156
+ target-prefix : mingw-w64-x86_64
157
+ fc-pkg : mingw-w64-x86_64-gcc-fortran
158
+ - msystem : MINGW32
159
+ idx : int32
160
+ target-prefix : mingw-w64-i686
161
+ fc-pkg : mingw-w64-i686-gcc-fortran
162
+ - msystem : CLANG64
163
+ idx : int32
164
+ target-prefix : mingw-w64-clang-x86_64
165
+ c-lapack-flags : -DC_LAPACK=ON
166
+ - msystem : MINGW64
167
+ idx : int64
168
+ idx64-flags : -DBINARY=64 -DINTERFACE64=1
169
+ target-prefix : mingw-w64-x86_64
170
+ fc-pkg : mingw-w64-x86_64-gcc-fortran
171
+ - msystem : CLANG64
172
+ idx : int64
173
+ idx64-flags : -DBINARY=64 -DINTERFACE64=1
174
+ target-prefix : mingw-w64-clang-x86_64
175
+ c-lapack-flags : -DC_LAPACK=ON
176
+ exclude :
177
+ - msystem : MINGW32
178
+ idx : int64
78
179
79
- cd /usr/
80
- sudo wget -nv https://github.com/flang-compiler/flang/releases/download/flang_20190329/flang-20190329-x86-70.tgz
81
- sudo tar xf flang-20190329-x86-70.tgz
82
- sudo rm flang-20190329-x86-70.tgz
83
- cd -
180
+ defaults :
181
+ run :
182
+ # Use MSYS2 bash as default shell
183
+ shell : msys2 {0}
84
184
85
- make -j$(nproc) DYNAMIC_ARCH=1 USE_OPENMP=0 FC=flang
185
+ env :
186
+ CHERE_INVOKING : 1
86
187
188
+ steps :
189
+ - name : Get CPU name
190
+ shell : pwsh
191
+ run : |
192
+ Get-CIMInstance -Class Win32_Processor | Select-Object -Property Name
193
+
194
+ - name : Install build dependencies
195
+ uses : msys2/setup-msys2@v2
196
+ with :
197
+ msystem : ${{ matrix.msystem }}
198
+ update : true
199
+ release : false # Use pre-installed version
200
+ install : >-
201
+ base-devel
202
+ ${{ matrix.target-prefix }}-cc
203
+ ${{ matrix.fc-pkg }}
204
+ ${{ matrix.target-prefix }}-cmake
205
+ ${{ matrix.target-prefix }}-ninja
206
+ ${{ matrix.target-prefix }}-ccache
87
207
88
- - name : CMake gfortran build
89
- if : matrix.build == 'cmake' && matrix.fortran == 'gfortran'
208
+ - name : Checkout repository
209
+ uses : actions/checkout@v3
210
+
211
+ - name : Compilation cache
212
+ uses : actions/cache@v3
213
+ with :
214
+ # It looks like this path needs to be hard-coded.
215
+ path : C:/msys64/home/runneradmin/.ccache
216
+ # We include the commit sha in the cache key, as new cache entries are
217
+ # only created if there is no existing entry for the key yet.
218
+ key : ccache-msys2-${{ matrix.msystem }}-${{ matrix.idx }}-${{ github.ref }}-${{ github.sha }}
219
+ # Restore a matching ccache cache entry. Prefer same branch.
220
+ restore-keys : |
221
+ ccache-msys2-${{ matrix.msystem }}-${{ matrix.idx }}-${{ github.ref }}
222
+ ccache-msys2-${{ matrix.msystem }}-${{ matrix.idx }}
223
+
224
+ - name : Configure ccache
225
+ # Limit the maximum size and switch on compression to avoid exceeding the total disk or cache quota.
90
226
run : |
91
- if [ "$RUNNER_OS" == "Linux" ]; then
92
- export PATH="/usr/lib/ccache:${PATH}"
93
- elif [ "$RUNNER_OS" == "macOS" ]; then
94
- export PATH="$(brew --prefix)/opt/ccache/libexec:${PATH}"
95
- else
96
- echo "$RUNNER_OS not supported"
97
- exit 1
98
- fi
227
+ which ccache
228
+ test -d ~/.ccache || mkdir -p ~/.ccache
229
+ echo "max_size = 250M" > ~/.ccache/ccache.conf
230
+ echo "compression = true" >> ~/.ccache/ccache.conf
231
+ ccache -s
232
+ echo $HOME
233
+ cygpath -w $HOME
234
+
235
+ - name : Configure OpenBLAS
236
+ run : |
237
+ mkdir build && cd build
238
+ cmake -DBUILD_SHARED_LIBS=ON \
239
+ -DBUILD_STATIC_LIBS=ON \
240
+ -DDYNAMIC_ARCH=ON \
241
+ -DUSE_THREAD=ON \
242
+ -DNUM_THREADS=64 \
243
+ -DTARGET=CORE2 \
244
+ ${{ matrix.idx64-flags }} \
245
+ ${{ matrix.c-lapack-flags }} \
246
+ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
247
+ -DCMAKE_Fortran_COMPILER_LAUNCHER=ccache \
248
+ ..
249
+
250
+ - name : Build OpenBLAS
251
+ run : cd build && cmake --build .
252
+
253
+ - name : Show ccache status
254
+ continue-on-error : true
255
+ run : ccache -s
99
256
100
- mkdir build
101
- cd build
102
- cmake -DDYNAMIC_ARCH=1 -DNOFORTRAN=0 -DBUILD_WITHOUT_LAPACK=0 -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Release ..
103
- make -j$(nproc)
257
+ - name : Run tests
258
+ timeout-minutes : 60
259
+ run : cd build && ctest
0 commit comments