|
| 1 | +name: Benchmark - store results |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + |
| 7 | +# contents: write – push benchmark history to gh-pages |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: benchmark-push-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + bench-linux: |
| 17 | + name: 'linux ${{ matrix.sys.compiler }}-${{ matrix.sys.version }} ${{ matrix.sys.flags }}' |
| 18 | + runs-on: ubuntu-latest |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + sys: |
| 23 | + - { compiler: 'gcc', version: '12', flags: 'force_no_instr_set' } |
| 24 | + - { compiler: 'gcc', version: '14', flags: 'avx' } |
| 25 | + - { compiler: 'gcc', version: '13', flags: 'avx512' } |
| 26 | + - { compiler: 'gcc', version: '13', flags: 'avx512pf' } |
| 27 | + - { compiler: 'gcc', version: '13', flags: 'avx512vbmi' } |
| 28 | + - { compiler: 'gcc', version: '14', flags: 'avx512vbmi2' } |
| 29 | + - { compiler: 'gcc', version: '13', flags: 'avx512vnni' } |
| 30 | + - { compiler: 'clang', version: '17', flags: 'sse3' } |
| 31 | + - { compiler: 'clang', version: '17', flags: 'avx' } |
| 32 | + |
| 33 | + defaults: |
| 34 | + run: |
| 35 | + shell: bash -l {0} |
| 36 | + |
| 37 | + steps: |
| 38 | + - name: Setup GCC compiler |
| 39 | + if: ${{ matrix.sys.compiler == 'gcc' }} |
| 40 | + run: | |
| 41 | + GCC_VERSION=${{ matrix.sys.version }} |
| 42 | + sudo apt-get update |
| 43 | + sudo apt-get --no-install-suggests --no-install-recommends install g++-$GCC_VERSION gcc-$GCC_VERSION |
| 44 | + echo "CC=gcc-$GCC_VERSION" >> $GITHUB_ENV |
| 45 | + echo "CXX=g++-$GCC_VERSION" >> $GITHUB_ENV |
| 46 | +
|
| 47 | + - name: Setup Clang compiler |
| 48 | + if: ${{ matrix.sys.compiler == 'clang' }} |
| 49 | + run: | |
| 50 | + LLVM_VERSION=${{ matrix.sys.version }} |
| 51 | + sudo apt-get update |
| 52 | + sudo apt-get --no-install-suggests --no-install-recommends install clang-$LLVM_VERSION g++ |
| 53 | + sudo ln -sf /usr/include/asm-generic /usr/include/asm |
| 54 | + echo "CC=clang-$LLVM_VERSION" >> $GITHUB_ENV |
| 55 | + echo "CXX=clang++-$LLVM_VERSION" >> $GITHUB_ENV |
| 56 | +
|
| 57 | + - uses: actions/checkout@v4 |
| 58 | + |
| 59 | + - name: Set conda environment |
| 60 | + uses: mamba-org/setup-micromamba@main |
| 61 | + with: |
| 62 | + environment-name: myenv |
| 63 | + environment-file: environment-dev.yml |
| 64 | + init-shell: bash |
| 65 | + cache-downloads: true |
| 66 | + |
| 67 | + - name: Setup SDE |
| 68 | + if: startsWith(matrix.sys.flags, 'avx512') |
| 69 | + run: sh install_sde.sh |
| 70 | + |
| 71 | + - name: Configure CMake |
| 72 | + env: |
| 73 | + CC: ${{ env.CC }} |
| 74 | + CXX: ${{ env.CXX }} |
| 75 | + run: | |
| 76 | + CMAKE_EXTRA_ARGS="" |
| 77 | + if [[ '${{ matrix.sys.flags }}' == 'avx' ]]; then CMAKE_EXTRA_ARGS="-DTARGET_ARCH=sandybridge"; fi |
| 78 | + if [[ '${{ matrix.sys.flags }}' == 'sse3' ]]; then CMAKE_EXTRA_ARGS="-DTARGET_ARCH=nocona"; fi |
| 79 | + if [[ '${{ matrix.sys.flags }}' == 'avx512' ]]; then CMAKE_EXTRA_ARGS="-DTARGET_ARCH=skylake-avx512"; fi |
| 80 | + if [[ '${{ matrix.sys.flags }}' == 'avx512pf' ]]; then CMAKE_EXTRA_ARGS="-DTARGET_ARCH=knl"; fi |
| 81 | + if [[ '${{ matrix.sys.flags }}' == 'avx512vbmi' ]]; then CMAKE_EXTRA_ARGS="-DTARGET_ARCH=cannonlake"; fi |
| 82 | + if [[ '${{ matrix.sys.flags }}' == 'avx512vbmi2' ]]; then CMAKE_EXTRA_ARGS="-DTARGET_ARCH=icelake-server"; fi |
| 83 | + if [[ '${{ matrix.sys.flags }}' == 'avx512vnni' ]]; then CMAKE_EXTRA_ARGS="-DTARGET_ARCH=knm"; fi |
| 84 | + cmake -S . -B _bench_build \ |
| 85 | + -G Ninja \ |
| 86 | + -DCMAKE_BUILD_TYPE=Release \ |
| 87 | + -DCMAKE_C_COMPILER=$CC \ |
| 88 | + -DCMAKE_CXX_COMPILER=$CXX \ |
| 89 | + $CMAKE_EXTRA_ARGS \ |
| 90 | + -DBUILD_BENCHMARKS=ON |
| 91 | +
|
| 92 | + - name: Build |
| 93 | + run: ninja -C _bench_build bench_algorithms |
| 94 | + |
| 95 | + - name: Run benchmarks |
| 96 | + run: | |
| 97 | + if echo '${{ matrix.sys.flags }}' | grep -q 'avx512'; then |
| 98 | + ./sde-external-9.48.0-2024-11-25-lin/sde64 -tgl -- \ |
| 99 | + ./_bench_build/benchmark/bench_algorithms \ |
| 100 | + --benchmark_format=json --benchmark_out=benchmark-result.json |
| 101 | + else |
| 102 | + ./_bench_build/benchmark/bench_algorithms \ |
| 103 | + --benchmark_format=json --benchmark_out=benchmark-result.json |
| 104 | + fi |
| 105 | +
|
| 106 | + - name: Upload benchmark artifact |
| 107 | + uses: actions/upload-artifact@v4 |
| 108 | + with: |
| 109 | + name: bench-linux-${{ matrix.sys.compiler }}-${{ matrix.sys.version }}-${{ matrix.sys.flags }}-${{ github.sha }} |
| 110 | + path: benchmark-result.json |
| 111 | + if-no-files-found: error |
| 112 | + |
| 113 | + - name: Store benchmark results |
| 114 | + uses: benchmark-action/github-action-benchmark@v1 |
| 115 | + with: |
| 116 | + tool: googlecpp |
| 117 | + output-file-path: benchmark-result.json |
| 118 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 119 | + auto-push: true |
| 120 | + gh-pages-branch: gh-pages |
| 121 | + benchmark-data-dir-path: dev/bench/linux-${{ matrix.sys.compiler }}-${{ matrix.sys.version }}-${{ matrix.sys.flags }} |
| 122 | + fail-on-alert: false |
| 123 | + |
| 124 | + bench-macos: |
| 125 | + name: 'macos-${{ matrix.os }}' |
| 126 | + runs-on: macos-${{ matrix.os }} |
| 127 | + strategy: |
| 128 | + fail-fast: false |
| 129 | + matrix: |
| 130 | + os: [14, 15] |
| 131 | + |
| 132 | + defaults: |
| 133 | + run: |
| 134 | + shell: bash -e -l {0} |
| 135 | + |
| 136 | + steps: |
| 137 | + - uses: actions/checkout@v4 |
| 138 | + |
| 139 | + - name: Set conda environment |
| 140 | + uses: mamba-org/setup-micromamba@main |
| 141 | + with: |
| 142 | + environment-name: myenv |
| 143 | + environment-file: environment-dev.yml |
| 144 | + init-shell: bash |
| 145 | + cache-downloads: true |
| 146 | + |
| 147 | + - name: Configure CMake |
| 148 | + run: | |
| 149 | + cmake -S . -B _bench_build \ |
| 150 | + -DCMAKE_BUILD_TYPE=Release \ |
| 151 | + -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \ |
| 152 | + -DBUILD_BENCHMARKS=ON |
| 153 | +
|
| 154 | + - name: Build |
| 155 | + run: cmake --build _bench_build --target bench_algorithms --parallel 8 |
| 156 | + |
| 157 | + - name: Run benchmarks |
| 158 | + run: | |
| 159 | + ./_bench_build/benchmark/bench_algorithms \ |
| 160 | + --benchmark_format=json --benchmark_out=benchmark-result.json |
| 161 | +
|
| 162 | + - name: Upload benchmark artifact |
| 163 | + uses: actions/upload-artifact@v4 |
| 164 | + with: |
| 165 | + name: bench-macos-${{ matrix.os }}-${{ github.sha }} |
| 166 | + path: benchmark-result.json |
| 167 | + if-no-files-found: error |
| 168 | + |
| 169 | + - name: Store benchmark results |
| 170 | + uses: benchmark-action/github-action-benchmark@v1 |
| 171 | + with: |
| 172 | + tool: googlecpp |
| 173 | + output-file-path: benchmark-result.json |
| 174 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 175 | + auto-push: true |
| 176 | + gh-pages-branch: gh-pages |
| 177 | + benchmark-data-dir-path: dev/bench/macos-${{ matrix.os }} |
| 178 | + fail-on-alert: false |
0 commit comments