diff options
Diffstat (limited to 'src/contrib/service/scalarproduct/perf_scalarproduct.sh')
-rwxr-xr-x | src/contrib/service/scalarproduct/perf_scalarproduct.sh | 73 |
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: | ||
30 | SIZE=800 | ||
31 | # | ||
32 | # Construct input vectors: | ||
33 | INPUTALICE="-k CCC -e '" | ||
34 | INPUTBOB="-k CCC -e '" | ||
35 | for X in `seq 1 $SIZE` | ||
36 | do | ||
37 | INPUTALICE="${INPUTALICE}A${X},$X;" | ||
38 | INPUTBOB="${INPUTBOB}A${X},$X;" | ||
39 | done | ||
40 | INPUTALICE="${INPUTALICE}BC,-20000;RO,1000;FL,100;LOL,24;'" | ||
41 | INPUTBOB="${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 | ||
44 | PREFIX=/tmp/test-scalarproduct`date +%H%M%S` | ||
45 | |||
46 | # where can we find the peers config files? | ||
47 | CFGALICE="-c $PREFIX/0/config" | ||
48 | CFGBOB="-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' | ||
57 | GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 & | ||
58 | PID=$! | ||
59 | # sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe | ||
60 | echo "Waiting for peers to start..." | ||
61 | sleep 5 | ||
62 | # get Bob's peer ID, necessary for Alice | ||
63 | PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB` | ||
64 | |||
65 | echo "Running problem of size $SIZE" | ||
66 | gnunet-scalarproduct $CFGBOB $INPUTBOB & | ||
67 | time RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB` | ||
68 | gnunet-statistics $CFGALICE -s core | grep "bytes encrypted" | ||
69 | gnunet-statistics $CFGBOB -s core | grep "bytes encrypted" | ||
70 | |||
71 | echo "Terminating testbed..." | ||
72 | # terminate the testbed | ||
73 | kill $PID | ||