|
23 | 23 | # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
|
24 | 24 | runs-on: ubuntu-latest
|
25 | 25 |
|
26 |
| - name: ubuntu (${{ matrix.compiler }} ${{ matrix.cuda }} CUDA ${{ matrix.openmp }} OpenMP) |
| 26 | + name: ubuntu (${{ matrix.compiler }} ${{ matrix.cuda }} CUDA ${{ matrix.openmp }} OpenMP, ${{ matrix.link }}) |
27 | 27 |
|
28 | 28 | strategy:
|
29 | 29 | # Allow other runners in the matrix to continue if some fail
|
|
33 | 33 | compiler: [gcc, clang]
|
34 | 34 | cuda: [with, without]
|
35 | 35 | openmp: [with]
|
| 36 | + link: [both] |
36 | 37 | include:
|
37 | 38 | - compiler: gcc
|
38 | 39 | compiler-pkgs: "g++ gcc"
|
|
61 | 62 | cuda: without
|
62 | 63 | openmp: without
|
63 | 64 | openmp-cmake-flags: "-DNOPENMP=ON"
|
| 65 | + - compiler: gcc |
| 66 | + compiler-pkgs: "g++ gcc" |
| 67 | + cc: "gcc" |
| 68 | + cxx: "g++" |
| 69 | + ccache-max: 600M |
| 70 | + cuda: with |
| 71 | + cuda-pkgs: "nvidia-cuda-dev nvidia-cuda-toolkit" |
| 72 | + cuda-cmake-flags: |
| 73 | + -DENABLE_CUDA=On |
| 74 | + -DCUDAToolkit_INCLUDE_DIR="/usr/include" |
| 75 | + -DCMAKE_CUDA_COMPILER_LAUNCHER="ccache" |
| 76 | + openmp: with |
| 77 | + link: static |
| 78 | + link-cmake-flags: |
| 79 | + -DBUILD_SHARED_LIBS=OFF |
| 80 | + -DBUILD_STATIC_LIBS=ON |
64 | 81 |
|
65 | 82 | env:
|
66 | 83 | CC: ${{ matrix.cc }}
|
|
85 | 102 | # used in action/cache/restore and action/cache/save steps
|
86 | 103 | id: ccache-prepare
|
87 | 104 | run: |
|
88 |
| - echo "key=ccache:ubuntu:${{ matrix.compiler }}:${{ matrix.cuda }}:${{ matrix.openmp }}:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT |
| 105 | + echo "key=ccache:ubuntu:${{ matrix.compiler }}:${{ matrix.cuda }}:${{ matrix.openmp }}:${{ matrix.link }}:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT |
89 | 106 |
|
90 | 107 | - name: restore ccache
|
91 | 108 | # setup the GitHub cache used to maintain the ccache from one job to the next
|
|
95 | 112 | key: ${{ steps.ccache-prepare.outputs.key }}
|
96 | 113 | # Prefer caches from the same branch. Fall back to caches from the dev branch.
|
97 | 114 | restore-keys: |
|
98 |
| - ccache:ubuntu:${{ matrix.compiler }}:${{ matrix.cuda }}:${{ matrix.openmp }}:${{ github.ref }} |
99 |
| - ccache:ubuntu:${{ matrix.compiler }}:${{ matrix.cuda }}:${{ matrix.openmp }}: |
| 115 | + ccache:ubuntu:${{ matrix.compiler }}:${{ matrix.cuda }}:${{ matrix.openmp }}:${{ matrix.link }}:${{ github.ref }} |
| 116 | + ccache:ubuntu:${{ matrix.compiler }}:${{ matrix.cuda }}:${{ matrix.openmp }}:${{ matrix.link }}: |
100 | 117 |
|
101 | 118 | - name: create empty libraries
|
102 | 119 | # This is to work around a bug in nvlink.
|
@@ -138,6 +155,7 @@ jobs:
|
138 | 155 | -DBLA_VENDOR="OpenBLAS" \
|
139 | 156 | ${{ matrix.cuda-cmake-flags }} \
|
140 | 157 | ${{ matrix.openmp-cmake-flags }} \
|
| 158 | + ${{ matrix.link-cmake-flags }} \ |
141 | 159 | ..
|
142 | 160 | echo "::endgroup::"
|
143 | 161 | echo "::group::Build $lib"
|
@@ -186,16 +204,19 @@ jobs:
|
186 | 204 | -DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/lib/cmake" \
|
187 | 205 | -DBLA_VENDOR="OpenBLAS" \
|
188 | 206 | ${{ matrix.cuda-cmake-flags }} \
|
| 207 | + ${{ matrix.link-cmake-flags }} \ |
189 | 208 | ..
|
190 | 209 | echo "::endgroup::"
|
191 | 210 | printf "::group::\033[0;32m==>\033[0m Building example\n"
|
192 | 211 | cmake --build .
|
193 | 212 | echo "::endgroup::"
|
194 | 213 | printf "::group::\033[0;32m==>\033[0m Executing example\n"
|
195 |
| - printf "\033[1;35m C binary with shared libraries\033[0m\n" |
196 |
| - LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/lib ./my_demo |
197 |
| - printf "\033[1;35m C++ binary with shared libraries\033[0m\n" |
198 |
| - LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/lib ./my_cxx_demo |
| 214 | + if [ -f ./my_demo -a -f ./my_cxx_demo ]; then |
| 215 | + printf "\033[1;35m C binary with shared libraries\033[0m\n" |
| 216 | + LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/lib ./my_demo |
| 217 | + printf "\033[1;35m C++ binary with shared libraries\033[0m\n" |
| 218 | + LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/lib ./my_cxx_demo |
| 219 | + fi |
199 | 220 | printf "\033[1;35m C binary with statically linked libraries\033[0m\n"
|
200 | 221 | ./my_demo_static
|
201 | 222 | printf "\033[1;35m C++ binary with statically linked libraries\033[0m\n"
|
|
0 commit comments