2 # Computes a simple scalar product, with configurable vector size.
4 # Some results (wall-clock for Alice+Bob, single-core, i7):
5 # SIZE 2048-H(s) 2048-O(s) 1024-O(s) ECC-2^20-H(s) ECC-2^28-H(s)
13 # Bandwidth (including set intersection):
16 # Configure benchmark size:
19 # Construct input vectors:
20 INPUTALICE="-k CCC -e '"
21 INPUTBOB="-k CCC -e '"
22 for X in `seq 1 $SIZE`
24 INPUTALICE="${INPUTALICE}A${X},$X;"
25 INPUTBOB="${INPUTBOB}A${X},$X;"
27 INPUTALICE="${INPUTALICE}BC,-20000;RO,1000;FL,100;LOL,24;'"
28 INPUTBOB="${INPUTBOB}AB,10;RO,3;FL,3;LOL,-1;'"
30 # necessary to make the testing prefix deterministic, so we can access the config files
31 PREFIX=/tmp/test-scalarproduct`date +%H%M%S`
33 # where can we find the peers config files?
34 CFGALICE="-c $PREFIX/0/config"
35 CFGBOB="-c $PREFIX/1/config"
37 # launch two peers in line topology non-interactively
39 # interactive mode would terminate the test immediately
40 # because the rest of the script is already in stdin,
41 # thus redirecting stdin does not suffice)
42 #GNUNET_FORCE_LOG=';;;;ERROR'
43 #GNUNET_FORCE_LOG='scalarproduct*;;;;DEBUG/cadet-api*;;;;DEBUG'
44 GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 &
46 # sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe
47 echo "Waiting for peers to start..."
49 # get Bob's peer ID, necessary for Alice
50 PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB`
52 echo "Running problem of size $SIZE"
53 gnunet-scalarproduct $CFGBOB $INPUTBOB &
54 time RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB`
55 gnunet-statistics $CFGALICE -s core | grep "bytes encrypted"
56 gnunet-statistics $CFGBOB -s core | grep "bytes encrypted"
58 echo "Terminating testbed..."
59 # terminate the testbed