2 # Computes a simple scalar product, with configurable vector size.
10 # Configure benchmark size:
13 # Construct input vectors:
14 INPUTALICE="-k CCC -e '"
15 INPUTBOB="-k CCC -e '"
16 for X in `seq 1 $SIZE`
18 INPUTALICE="${INPUTALICE}A${X},$X;"
19 INPUTBOB="${INPUTBOB}A${X},$X;"
21 INPUTALICE="${INPUTALICE}BC,-20000;RO,1000;FL,100;LOL,24;'"
22 INPUTBOB="${INPUTBOB}AB,10;RO,3;FL,3;LOL,-1;'"
24 # necessary to make the testing prefix deterministic, so we can access the config files
25 PREFIX=/tmp/test-scalarproduct`date +%H%M%S`
27 # where can we find the peers config files?
28 CFGALICE="-c $PREFIX/0/config"
29 CFGBOB="-c $PREFIX/1/config"
31 # launch two peers in line topology non-interactively
33 # interactive mode would terminate the test immediately
34 # because the rest of the script is already in stdin,
35 # thus redirecting stdin does not suffice)
36 GNUNET_FORCE_LOG=';;;;ERROR'
37 GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 &
39 # sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe
40 echo "Waiting for peers to start..."
42 # get Bob's peer ID, necessary for Alice
43 PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB`
45 echo "Running problem of size $SIZE"
46 gnunet-scalarproduct $CFGBOB $INPUTBOB &
47 time RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB`
49 echo "Terminating testbed..."
50 # terminate the testbed