Skip to content

Add utilities for benchmarking different code versions #4

Add utilities for benchmarking different code versions

Add utilities for benchmarking different code versions #4

name: Run benchmark and profiling
# The workflow gets triggered by pushes and pull requests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
# checks out the code in the repository
- uses: actions/checkout@v3
with:
submodules: true
- name: Install dependencies
run: |
sudo apt-get update && apt upgrade -y
sudo apt-get install -y libboost-all-dev
python -m pip install --upgrade pip
pip install matplotlib
- name: Compile and run benchmark
working-directory: ${{ github.workspace }}/benchmark/dataset_size
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -- -j 2
./build/serial.out 10 18
- name: Compile and run profiling
working-directory: ${{ github.workspace }}/benchmark/profiling
run: |
cmake -S . -B build/Debug -DCMAKE_BUILD_TYPE=Debug
cmake --build build/Debug -- -j 2
cmake -S . -B build/Release -DCMAKE_BUILD_TYPE=Release
cmake --build build/Release -- -j 2
./build/Debug/serial.out ../../data/data_32768.csv
gprof ./build/Debug/serial.out ../../data/data_32768.csv
./build/Release/serial.out ../../data/data_32768.csv
gprof ./build/Release/serial.out ../../data/data_32768.csv
- name: Check cache misses with perf
working-directory: ${{ github.workspace }}/benchmark/profiling
run: |
perf stat -B -e cache-misses,cycles,instructions,branches ./build/Debug/serial.out ../../data/data_32768.csv
perf stat -B -e cache-misses,cycles,instructions,branches ./build/Release/serial.out ../../data/data_32768.csv