-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to google's benchmarking (#18)
Small refactoring. Updated sanitizing functionality. Improved code for sanitizing. Crucial improvements in functionality presentation + its testing. Improvements in execution time measures. Resolved issues in pipeline. Improvements in pipeline. Created workflow for testing as library.
- Loading branch information
Showing
29 changed files
with
837 additions
and
408 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Benchmarking | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
Measure: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install packages | ||
run: sudo apt-get -qq install libbenchmark-dev libgmp3-dev libcrypto++-dev libcrypto++-doc libcrypto++-utils | ||
|
||
- name: Set reusable strings | ||
id: strings | ||
shell: bash | ||
run: | | ||
echo "ci=${{ github.workspace }}/ci/benchmarking" >> "$GITHUB_OUTPUT" | ||
echo "benchmark=${{ github.workspace }}/benchmark" >> "$GITHUB_OUTPUT" | ||
echo "build=${{ github.workspace }}/benchmark/cmake-build-release" >> "$GITHUB_OUTPUT" | ||
- name: Load CMake configuration | ||
run: > | ||
cmake -B ${{ steps.strings.outputs.build }} | ||
-DCMAKE_CXX_COMPILER=g++ | ||
-DCMAKE_C_COMPILER=gcc | ||
-DCMAKE_BUILD_TYPE=Release | ||
-S ${{ steps.strings.outputs.benchmark }} | ||
- name: Build executable | ||
run: cmake --build ${{ steps.strings.outputs.build }} --target Benchmarking -j8 | ||
|
||
- name: Run benchmark analysis | ||
working-directory: ${{ steps.strings.outputs.build }} | ||
run: ./Benchmarking --benchmark_out=benchmarks.json | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install python packages | ||
run: | | ||
python -m pip install -q --upgrade pip | ||
pip install -q matplotlib numpy requests | ||
- name: Download font file | ||
working-directory: ${{ steps.strings.outputs.ci }} | ||
run: wget https://github.com/google/fonts/raw/refs/heads/main/ofl/courierprime/CourierPrime-Bold.ttf -q | ||
|
||
- name: Run Python script | ||
working-directory: ${{ steps.strings.outputs.ci }} | ||
run: python make_plot.py ${{ steps.strings.outputs.build }}/benchmarks.json graph.png CourierPrime-Bold.ttf | ||
|
||
- name: Upload a picture | ||
uses: devicons/[email protected] | ||
id: imgur_step | ||
with: | ||
path: ${{ steps.strings.outputs.ci }}/graph.png | ||
client_id: ${{ secrets.IMGUR_CLIENT_ID }} | ||
|
||
- name: Update image link | ||
working-directory: ${{ steps.strings.outputs.ci }} | ||
run: python update_image_link.py ${{ secrets.DUB_CO_LINK_ID }} ${{ fromJSON(steps.imgur_step.outputs.imgur_urls)[0] }} ${{ secrets.DUB_CO_API_KEY }} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Build as library | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
Test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set reusable strings | ||
id: strings | ||
shell: bash | ||
run: | | ||
echo "build=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | ||
- name: Create directory | ||
run: mkdir ${{ steps.strings.outputs.build }} | ||
|
||
- name: Load CMake configuration | ||
working-directory: ${{ steps.strings.outputs.build }} | ||
run: cmake -B ${{ steps.strings.outputs.build }} | ||
-DCMAKE_CXX_COMPILER=g++ | ||
-DCMAKE_C_COMPILER=gcc | ||
-DCMAKE_BUILD_TYPE=Release | ||
-S ${{ github.workspace }} | ||
|
||
- name: Test | ||
working-directory: ${{ steps.strings.outputs.build }} | ||
run: | | ||
make -j8 | ||
./Build | ||
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
cmake_minimum_required(VERSION 3.26) | ||
set(CMAKE_CXX_STANDARD 20) | ||
project(Benchmarking) | ||
|
||
find_package(PkgConfig) | ||
pkg_check_modules(GMP REQUIRED IMPORTED_TARGET gmp) | ||
|
||
find_path(BENCH_INCLUDE benchmark/benchmark.h /usr/include /usr/local/include /opt/homebrew/include) | ||
find_library(BENCH_LIB benchmark /usr/lib /usr/local/lib /opt/homebrew/lib) | ||
if(NOT BENCH_INCLUDE OR NOT BENCH_LIB) | ||
message(FATAL_ERROR "Google Benchmarking is not found!") | ||
endif() | ||
|
||
find_path(CRYPTOPP_INCLUDE cryptopp/cryptlib.h /usr/include /usr/local/include /opt/homebrew/include) | ||
find_library(CRYPTOPP_LIB cryptopp /usr/lib /usr/local/lib /opt/homebrew/lib) | ||
if(NOT CRYPTOPP_INCLUDE OR NOT CRYPTOPP_LIB) | ||
message(FATAL_ERROR "Crypto++ is not found!") | ||
endif() | ||
|
||
file(GLOB Benches *.cpp) | ||
add_executable(Benchmarking ${Benches}) | ||
|
||
include_directories(${CRYPTOPP_INCLUDE} ${BENCH_INCLUDE}) | ||
target_link_libraries(Benchmarking ${BENCH_LIB} ${CRYPTOPP_LIB} PkgConfig::GMP) | ||
target_include_directories(Benchmarking PUBLIC PkgConfig::GMP) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <benchmark/benchmark.h> | ||
#include <cryptopp/integer.h> | ||
#include <gmpxx.h> | ||
#include "../Aeu.h" | ||
|
||
constexpr char data[] = "0x56612239db6d8ce375c48f335a4ba6f4933c871a672f6e66c7899af62393b55fb0fd38984923f6c7eb2d5f97b66a" | ||
"c90bedaf1978972ec071c899f05d006caa686401d48c670c3c49553c15c3b7053eddc1878132dfce005cb4d8151fee" | ||
"333b98656b4fc831c569bf7909f929ee6b6f693df50e2c049643195e2f648d593fb543"; | ||
|
||
static void addition_CryptoPP(benchmark::State& state) { | ||
CryptoPP::Integer left (data), right (data), result {}; | ||
for (auto _ : state) | ||
benchmark::DoNotOptimize(result = left + right); | ||
} | ||
BENCHMARK(addition_CryptoPP); | ||
|
||
static void addition_GMP(benchmark::State& state) { | ||
mpz_class left (data), right (data), result {}; | ||
for (auto _ : state) | ||
benchmark::DoNotOptimize(result = left + right); | ||
} | ||
BENCHMARK(addition_GMP); | ||
|
||
static void addition_Aesi(benchmark::State& state) { | ||
Aeu<2048> left (data), right (data), result {}; | ||
for (auto _ : state) | ||
benchmark::DoNotOptimize(result = left + right); | ||
} | ||
BENCHMARK(addition_Aesi); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.