Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release performance regression test #1152

Merged
merged 2 commits into from
Dec 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions scripts/noregress.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import json
import sys
import os

cutoffpercent = 15

with open(sys.argv[1], 'r') as json_file:
d1 = json.load(json_file)
with open(sys.argv[2], 'r') as json_file:
d2 = json.load(json_file)

for k in d1.keys(): # algs
if k != "config" and k != "cpuinfo":
if k in d2.keys():
for op in d1[k]:
diff = 100.0*(float(d1[k][op]) - float(d2[k][op]))/float(d1[k][op])
if (abs(diff) > cutoffpercent):
print("Alg: %s, Op: %s, Val1: %s; Val2: %s; diff: %2.2f%%" % (k, op, d1[k][op], d2[k][op], diff))
41 changes: 41 additions & 0 deletions scripts/noregress.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

if [ $# -lt 1 ]; then
echo "Usage: $0 <liboqs-release to test regression against> [<cmake opts> [<make cmd>]]. Exiting."
exit -1
fi

if [ $# -lt 3 ]; then
MAKECMD="make -j 2"
else
MAKECMD=$3
fi

# Approach: Check out $1 into tmp folder, build, run speed_kem|sig and compare results

mkdir tmp && cd tmp && git clone --depth 1 --branch $1 https://github.com/open-quantum-safe/liboqs && cd liboqs && mkdir build && cd build && cmake $2 .. && $MAKECMD && ./tests/speed_kem > ../../speed_kem.log && ./tests/speed_sig > ../../speed_sig.log && cd ../../..

if [ $? -ne 0 ]; then
echo "Build and test of baseline $1 failed. Exiting."
exit -1
fi

# transform results into JSON files for simple comparison

cd tmp && git clone --depth 1 https://github.com/open-quantum-safe/profiling.git && python3 profiling/perf/scripts/parse_liboqs_speed.py speed_kem.log && python3 profiling/perf/scripts/parse_liboqs_speed.py speed_sig.log && cd ..

if [ $? -ne 0 ]; then
echo "Failure converting results. Exiting."
exit -1
fi

# obtain current base speed results
rm -rf build && mkdir build && cd build && cmake $2 .. && $MAKECMD && ./tests/speed_kem > speed_kem.log && ./tests/speed_sig > speed_sig.log && python3 ../tmp/profiling/perf/scripts/parse_liboqs_speed.py speed_kem.log && python3 ../tmp/profiling/perf/scripts/parse_liboqs_speed.py speed_sig.log && cd ..

if [ $? -ne 0 ]; then
echo "Failure creating current results. Exiting."
exit -1
fi

# now compare results using old/tmp runs as baseline (for list of algorithms)
python3 scripts/noregress.py tmp/speed_kem.json build/speed_kem.json && python3 scripts/noregress.py tmp/speed_sig.json build/speed_sig.json