Skip to content

real-time-cpp-benchmarks #752

real-time-cpp-benchmarks

real-time-cpp-benchmarks #752

##############################################################################
# Copyright Christopher Kormanyos 2021 - 2024.
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
name: real-time-cpp-benchmarks
on:
push:
branches:
- '**'
pull_request:
schedule:
- cron: '51 23 * * *' # run at 11:51 PM UTC
jobs:
benchmark_gcc-clang:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
compiler: [ g++, clang++ ]
standard: [ c++14, c++20 ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/math
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
working-directory: ./
- name: clone-cppalliance-decimal
run: |
git clone -b develop --depth 1 https://github.com/cppalliance/decimal.git ../cppalliance-decimal-root
- name: clone-cppalliance-crypt
run: |
git clone -b develop --depth 1 https://github.com/cppalliance/crypt.git ../cppalliance-crypt-root
working-directory: ./
- name: benchmark_gcc-clang
run: ./target/build/test_app_benchmarks.sh ${{ matrix.compiler }} ${{ matrix.standard }}
working-directory: ./ref_app/
benchmark_apple-clang:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
compiler: [ g++, clang++ ]
standard: [ c++14, c++20 ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/math
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
working-directory: ./
- name: clone-cppalliance-decimal
run: |
git clone -b develop --depth 1 https://github.com/cppalliance/decimal.git ../cppalliance-decimal-root
working-directory: ./
- name: benchmark_apple-clang
run: ./target/build/test_app_benchmarks.sh ${{ matrix.compiler }} ${{ matrix.standard }}
working-directory: ./ref_app/
benchmark_builds-avr:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ c++20, c++23 ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: update-tools
run: |
wget --no-check-certificate https://github.com/ckormanyos/avr-gcc-build/releases/download/v14.2.0/gcc-14.2.0-avr.tar.gz
tar -xzf gcc-14.2.0-avr.tar.gz -C ${{ runner.workspace }}
- name: benchmark_builds-avr
run: |
PATH="${{ runner.workspace }}/gcc-14.2.0-avr/bin:$PATH"
./target/build/test_app_benchmarks_avr.sh ${{ matrix.standard }}
working-directory: ./ref_app/
benchmark_builds-stm32f446:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ c++14, c++20 ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: update-tools
run: sudo apt install gcc-arm-none-eabi
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/math
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
working-directory: ./
- name: clone-cppalliance-decimal
run: |
git clone -b develop --depth 1 https://github.com/cppalliance/decimal.git ../cppalliance-decimal-root
- name: clone-cppalliance-crypt
run: |
git clone -b develop --depth 1 https://github.com/cppalliance/crypt.git ../cppalliance-crypt-root
working-directory: ./
- name: benchmark_builds-stm32f446
run: ./target/build/test_app_benchmarks_stm32f446.sh ${{ matrix.standard }}
working-directory: ./ref_app/
benchmark_builds-riscv:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ c++20 ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: update-tools
run: |
wget --no-check-certificate https://buildbot.embecosm.com/job/riscv32-gcc-ubuntu2204-release/10/artifact/riscv32-embecosm-ubuntu2204-gcc13.2.0.tar.gz
tar -xzf riscv32-embecosm-ubuntu2204-gcc13.2.0.tar.gz -C ${{ runner.workspace }}
working-directory: ./
- name: benchmark_builds-riscv
run: |
PATH="${{ runner.workspace }}/riscv32-embecosm-ubuntu2204-gcc13.2.0/bin:$PATH"
./target/build/test_app_benchmarks_riscv.sh ${{ matrix.standard }}
working-directory: ./ref_app/
benchmark_single-stm32f446:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: update-tools
run: sudo apt install gcc-arm-none-eabi
- name: benchmark_single-stm32f446
run: |
mkdir -p bin
arm-none-eabi-g++ -std=c++14 -Wall -Wextra -pedantic -O2 -g -gdwarf-2 -ffunction-sections -fdata-sections -x c++ -fno-rtti -fno-use-cxa-atexit -fno-exceptions -fno-nonansi-builtins -fno-threadsafe-statics -fno-enforce-eh-specs -ftemplate-depth=32 -mcpu=cortex-m4 -mtune=cortex-m4 -mthumb -mfloat-abi=soft -mno-unaligned-access -mno-long-calls -I./src/mcal/stm32f446 -I./src -DAPP_BENCHMARK_TYPE=APP_BENCHMARK_TYPE_CRC -DAPP_BENCHMARK_STANDALONE_MAIN ./src/app/benchmark/app_benchmark_crc.cpp ./target/micros/stm32f446/make/single/crt.cpp -nostartfiles -Wl,--gc-sections -Wl,-Map,./bin/app_benchmark_crc.map -T ./target/micros/stm32f446/make/stm32f446.ld -o ./bin/app_benchmark_crc.elf
arm-none-eabi-objcopy ./bin/app_benchmark_crc.elf -O ihex ./bin/app_benchmark_crc.hex
ls -la ./bin/app_benchmark_crc.elf ./bin/app_benchmark_crc.hex ./bin/app_benchmark_crc.map
working-directory: ./ref_app/
benchmark_single-cnl:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
compiler: [ g++, clang++ ]
standard: [ c++20 ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: benchmark_single-cnl
run: |
git clone -b main --depth 1 https://github.com/johnmcfarlane/cnl.git ../cnl-root
mkdir -p bin
${{ matrix.compiler }} -std=${{ matrix.standard }} -Wall -Werror -O2 -m64 -I./src -I../cnl-root/include -DAPP_BENCHMARK_TYPE=APP_BENCHMARK_TYPE_CNL_SCALED_INTEGER -DAPP_BENCHMARK_STANDALONE_MAIN ./src/app/benchmark/app_benchmark_cnl_scaled_integer.cpp -o ./bin/app_benchmark_cnl_scaled_integer.exe
ls -la ./bin/app_benchmark_cnl_scaled_integer.exe
./bin/app_benchmark_cnl_scaled_integer.exe
working-directory: ./ref_app/
benchmark_single-stm32f429-qemu:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: update-tools
run: |
sudo apt install libncursesw5
mkdir -p emu_env && cd emu_env
wget --no-check-certificate https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz
tar -xf arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz
wget --no-check-certificate https://github.com/xpack-dev-tools/qemu-arm-xpack/releases/download/v8.2.6-1/xpack-qemu-arm-8.2.6-1-linux-x64.tar.gz
tar -xzf xpack-qemu-arm-8.2.6-1-linux-x64.tar.gz
working-directory: ./ref_app/
- name: build benchmark_single-stm32f429
run: |
PATH="${{ runner.workspace }}/real-time-cpp/ref_app/emu_env/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi/bin:$PATH"
echo 'Query arm-none-eabi-g++ version'
echo
arm-none-eabi-g++ -v
echo
mkdir -p bin
arm-none-eabi-g++ -std=c++20 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -O2 -g -gdwarf-2 -ffunction-sections -fdata-sections -x c++ -fno-rtti -fno-use-cxa-atexit -fno-exceptions -fno-nonansi-builtins -fno-threadsafe-statics -fno-enforce-eh-specs -ftemplate-depth=32 -mcpu=cortex-m4 -mtune=cortex-m4 -mthumb -mfloat-abi=soft -mno-unaligned-access -mno-long-calls -I./src/mcal/stm32f429 -I./src -DAPP_BENCHMARK_TYPE=APP_BENCHMARK_TYPE_CRC -DAPP_BENCHMARK_STANDALONE_MAIN ./src/app/benchmark/app_benchmark_crc.cpp ./target/micros/stm32f429/make/single/crt.cpp -nostartfiles -nostdlib -Wl,--gc-sections -Wl,-Map,./bin/app_benchmark_crc.map -T ./target/micros/stm32f429/make/stm32f429.ld --specs=nano.specs --specs=nosys.specs -o ./bin/app_benchmark_crc.elf
arm-none-eabi-objcopy ./bin/app_benchmark_crc.elf -O ihex ./bin/app_benchmark_crc.hex
ls -la ./bin/app_benchmark_crc.elf ./bin/app_benchmark_crc.hex ./bin/app_benchmark_crc.map
working-directory: ./ref_app/
- name: emulate-target stm32f429
run: |
PATH="${{ runner.workspace }}/real-time-cpp/ref_app/emu_env/xpack-qemu-arm-8.2.6-1/bin:$PATH"
qemu-system-gnuarmeclipse --verbose --mcu STM32F429ZI --nographic --gdb tcp::9999 -d unimp,guest_errors &
sleep 2
working-directory: ./ref_app/
- name: run-test-on-target
run: |
sleep 2
PATH="${{ runner.workspace }}/real-time-cpp/ref_app/emu_env/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi/bin:$PATH"
echo 'Run test on target'
echo
arm-none-eabi-gdb ./bin/app_benchmark_crc.elf -x ./target/build/test_app_benchmarks_emulator.gdb > ./app_benchmark_crc.txt
cat ./app_benchmark_crc.txt
echo
echo 'We will now grep for the right answer...'
grep 'value 0xF00DCAFE' ./app_benchmark_crc.txt
working-directory: ./ref_app/