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)
12 # Configure benchmark size:
15 # Construct input vectors:
16 INPUTALICE="-k CCC -e '"
17 INPUTBOB="-k CCC -e '"
18 for X in `seq 1 $SIZE`
20 INPUTALICE="${INPUTALICE}A${X},$X;"
21 INPUTBOB="${INPUTBOB}A${X},$X;"
23 INPUTALICE="${INPUTALICE}BC,-20000;RO,1000;FL,100;LOL,24;'"
24 INPUTBOB="${INPUTBOB}AB,10;RO,3;FL,3;LOL,-1;'"
26 # necessary to make the testing prefix deterministic, so we can access the config files
27 PREFIX=/tmp/test-scalarproduct`date +%H%M%S`
29 # where can we find the peers config files?
30 CFGALICE="-c $PREFIX/0/config"
31 CFGBOB="-c $PREFIX/1/config"
33 # launch two peers in line topology non-interactively
35 # interactive mode would terminate the test immediately
36 # because the rest of the script is already in stdin,
37 # thus redirecting stdin does not suffice)
38 #GNUNET_FORCE_LOG=';;;;ERROR'
39 #GNUNET_FORCE_LOG='scalarproduct*;;;;DEBUG/cadet-api*;;;;DEBUG'
40 GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 &
42 # sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe
43 echo "Waiting for peers to start..."
45 # get Bob's peer ID, necessary for Alice
46 PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB`
48 echo "Running problem of size $SIZE"
49 gnunet-scalarproduct $CFGBOB $INPUTBOB &
50 time RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB`
51 gnunet-statistics $CFGALICE -s core | grep "bytes encrypted"
52 gnunet-statistics $CFGBOB -s core | grep "bytes encrypted"
54 echo "Terminating testbed..."
55 # terminate the testbed