aboutsummaryrefslogtreecommitdiff
path: root/src/contrib/service/scalarproduct/perf_scalarproduct.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/contrib/service/scalarproduct/perf_scalarproduct.sh')
-rwxr-xr-xsrc/contrib/service/scalarproduct/perf_scalarproduct.sh73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/contrib/service/scalarproduct/perf_scalarproduct.sh b/src/contrib/service/scalarproduct/perf_scalarproduct.sh
new file mode 100755
index 000000000..b15465c9a
--- /dev/null
+++ b/src/contrib/service/scalarproduct/perf_scalarproduct.sh
@@ -0,0 +1,73 @@
1#!/bin/bash
2# Computes a simple scalar product, with configurable vector size.
3#
4# Some results (wall-clock for Alice+Bob, single-core, i7, libgcrypt):
5# SIZE 2048-H(s) 2048-O(s) 1024-O(s) ECC-2^20-H(s) ECC-2^28-H(s)
6# 25 10 14 3 2 29
7# 50 17 21 5 2 29
8# 100 32 39 7 2 29
9# 200 77 13 3 30
10# 400 149 23 OOR 31
11# 800 304 32 OOR 33
12
13# Bandwidth (including set intersection):
14# RSA-1024 RSA-2048 ECC
15# 800: 629 kb 1234 kb 65 kb
16#
17# LIBSODIUM, AMD Threadripper 1950:
18#
19# SIZE 2048-O(s) 1024-O(s) ECC-2^20-H(s) ECC-2^28-H(s)
20# 25 4.3 0.7 0.129 4.233
21# 50 7.7 1.2 0.143 4.267
22# 100 10.3 2.4 0.163 4.282
23# 200 19.8 3.0 0.192 4.326
24# 400 35.9 6.0 0.253 4.358
25# 800 73.7 12.6 0.379 4.533
26
27#
28#
29# Configure benchmark size:
30SIZE=800
31#
32# Construct input vectors:
33INPUTALICE="-k CCC -e '"
34INPUTBOB="-k CCC -e '"
35for X in `seq 1 $SIZE`
36do
37 INPUTALICE="${INPUTALICE}A${X},$X;"
38 INPUTBOB="${INPUTBOB}A${X},$X;"
39done
40INPUTALICE="${INPUTALICE}BC,-20000;RO,1000;FL,100;LOL,24;'"
41INPUTBOB="${INPUTBOB}AB,10;RO,3;FL,3;LOL,-1;'"
42
43# necessary to make the testing prefix deterministic, so we can access the config files
44PREFIX=/tmp/test-scalarproduct`date +%H%M%S`
45
46# where can we find the peers config files?
47CFGALICE="-c $PREFIX/0/config"
48CFGBOB="-c $PREFIX/1/config"
49
50# launch two peers in line topology non-interactively
51#
52# interactive mode would terminate the test immediately
53# because the rest of the script is already in stdin,
54# thus redirecting stdin does not suffice)
55#GNUNET_FORCE_LOG=';;;;ERROR'
56#GNUNET_FORCE_LOG='scalarproduct*;;;;DEBUG/cadet-api*;;;;DEBUG'
57GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 &
58PID=$!
59# sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe
60echo "Waiting for peers to start..."
61sleep 5
62# get Bob's peer ID, necessary for Alice
63PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB`
64
65echo "Running problem of size $SIZE"
66gnunet-scalarproduct $CFGBOB $INPUTBOB &
67time RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB`
68gnunet-statistics $CFGALICE -s core | grep "bytes encrypted"
69gnunet-statistics $CFGBOB -s core | grep "bytes encrypted"
70
71echo "Terminating testbed..."
72# terminate the testbed
73kill $PID