|
| 1 | +# Run performance benchmarks comparing two different CBMC versions. |
| 2 | +name: Performance Benchmarking |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ develop ] |
| 6 | + pull_request: |
| 7 | + branches: [ develop ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + perf-benchcomp: |
| 11 | + runs-on: ubuntu-20.04 |
| 12 | + steps: |
| 13 | + - name: Save push event HEAD and HEAD~ to environment variables |
| 14 | + if: ${{ github.event_name == 'push' }} |
| 15 | + run: | |
| 16 | + echo "NEW_REF=${{ github.event.after}}" | tee -a "$GITHUB_ENV" |
| 17 | + echo "OLD_REF=${{ github.event.before }}" | tee -a "$GITHUB_ENV" |
| 18 | +
|
| 19 | + - name: Save pull request HEAD and base to environment variables |
| 20 | + if: ${{ contains(fromJSON('["pull_request", "pull_request_target"]'), github.event_name) }} |
| 21 | + run: | |
| 22 | + echo "OLD_REF=${{ github.event.pull_request.base.sha }}" | tee -a "$GITHUB_ENV" |
| 23 | + echo "NEW_REF=${{ github.event.pull_request.head.sha }}" | tee -a "$GITHUB_ENV" |
| 24 | +
|
| 25 | + - name: Check out CBMC (old variant) |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + submodules: recursive |
| 29 | + path: ./old |
| 30 | + ref: ${{ env.OLD_REF }} |
| 31 | + fetch-depth: 2 |
| 32 | + |
| 33 | + - name: Check out CBMC (new variant) |
| 34 | + uses: actions/checkout@v4 |
| 35 | + with: |
| 36 | + submodules: recursive |
| 37 | + path: ./new |
| 38 | + ref: ${{ env.NEW_REF }} |
| 39 | + fetch-depth: 1 |
| 40 | + |
| 41 | + - name: Fetch dependencies |
| 42 | + env: |
| 43 | + # This is needed in addition to -yq to prevent apt-get from asking for |
| 44 | + # user input |
| 45 | + DEBIAN_FRONTEND: noninteractive |
| 46 | + run: | |
| 47 | + sudo apt-get update |
| 48 | + sudo apt-get install --no-install-recommends -yq cmake ninja-build gcc g++ maven flex bison ccache |
| 49 | +
|
| 50 | + - name: Prepare ccache |
| 51 | + uses: actions/cache/restore@v4 |
| 52 | + with: |
| 53 | + path: .ccache |
| 54 | + key: ${{ runner.os }}-20.04-Release-${{ github.ref }}-${{ github.sha }}-PR |
| 55 | + restore-keys: | |
| 56 | + ${{ runner.os }}-20.04-Release-${{ github.ref }} |
| 57 | + ${{ runner.os }}-20.04-Release |
| 58 | + - name: ccache environment |
| 59 | + run: echo "CCACHE_DIR=$PWD/.ccache" >> $GITHUB_ENV |
| 60 | + - name: Zero ccache stats and limit in size |
| 61 | + run: ccache -z --max-size=500M |
| 62 | + |
| 63 | + - name: Configure using CMake (new variant) |
| 64 | + run: cmake -S new/ -B new/build -G Ninja -DWITH_JBMC=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -Dsat_impl="minisat2;cadical" |
| 65 | + - name: ccache environment (new variant) |
| 66 | + run: echo "CCACHE_BASEDIR=$PWD/new" >> $GITHUB_ENV |
| 67 | + - name: Build with Ninja (new variant) |
| 68 | + run: ninja -C new/build -j2 |
| 69 | + - name: Print ccache stats (new variant) |
| 70 | + run: ccache -s |
| 71 | + |
| 72 | + - name: Configure using CMake (old variant) |
| 73 | + run: cmake -S old/ -B old/build -G Ninja -DWITH_JBMC=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -Dsat_impl="minisat2;cadical" |
| 74 | + - name: ccache environment (old variant) |
| 75 | + run: echo "CCACHE_BASEDIR=$PWD/old" >> $GITHUB_ENV |
| 76 | + - name: Build with Ninja (old variant) |
| 77 | + run: ninja -C old/build -j2 |
| 78 | + - name: Print ccache stats (old variant) |
| 79 | + run: ccache -s |
| 80 | + |
| 81 | + - name: Obtain benchcomp |
| 82 | + run: git clone --depth 1 https://github.com/model-checking/kani kani.git |
| 83 | + |
| 84 | + - name: Fetch benchmarks |
| 85 | + run: | |
| 86 | + git clone --depth 1 https://github.com/awslabs/aws-c-common aws-c-common.git |
| 87 | + pushd aws-c-common.git/verification/cbmc/proofs/ |
| 88 | + # keep 6 proofs of each kind of data structure |
| 89 | + for c in $(ls -d aws_* | cut -f2 -d_ | uniq) ; do rm -rf $(ls -d aws_${c}_* | tail -n+7) ; done |
| 90 | + popd |
| 91 | + sudo apt-get install --no-install-recommends -yq gnuplot graphviz universal-ctags python3-pip |
| 92 | + curl -L --remote-name \ |
| 93 | + https://github.com/awslabs/aws-build-accumulator/releases/download/1.29.0/litani-1.29.0.deb |
| 94 | + sudo dpkg -i litani-1.29.0.deb |
| 95 | + sudo python3 -m pip install cbmc-viewer |
| 96 | +
|
| 97 | + - name: Run benchcomp |
| 98 | + run: | |
| 99 | + kani.git/tools/benchcomp/bin/benchcomp \ |
| 100 | + --config new/.github/workflows/benchcomp-config.yaml \ |
| 101 | + run |
| 102 | + kani.git/tools/benchcomp/bin/benchcomp \ |
| 103 | + --config new/.github/workflows/benchcomp-config.yaml \ |
| 104 | + collate |
| 105 | +
|
| 106 | + - name: Perf Regression Results Table |
| 107 | + run: | |
| 108 | + kani.git/tools/benchcomp/bin/benchcomp \ |
| 109 | + --config new/.github/workflows/benchcomp-config.yaml \ |
| 110 | + visualize --only dump_markdown_results_table >> "$GITHUB_STEP_SUMMARY" |
| 111 | +
|
| 112 | + - name: Run other visualizations |
| 113 | + run: | |
| 114 | + kani.git/tools/benchcomp/bin/benchcomp \ |
| 115 | + --config new/.github/workflows/benchcomp-config.yaml \ |
| 116 | + visualize --except dump_markdown_results_table |
0 commit comments