run-experiment-ssh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. # Run an experiment using ssh to real hosts, not in dockers
  3. # We need these environment variables set:
  4. # RAMEN_SSH_P0_USERHOST: the user@host to ssh to for P0
  5. # RAMEN_SSH_P0_SSHOPTS: any options to ssh you need to ssh to P0
  6. # RAMEN_SSH_P0_IP: the IP address P0 can listen for connections on
  7. # RAMEN_SSH_P0_DIR: the directory relative to the homedir where the prac
  8. # repo is checked out and built
  9. # RAMEN_SSH_P1_USERHOST: the user@host to ssh to for P1
  10. # RAMEN_SSH_P1_SSHOPTS: any options to ssh you need to ssh to P1
  11. # RAMEN_SSH_P1_IP: the IP address P1 can listen for connections on
  12. # RAMEN_SSH_P1_DIR: the directory relative to the homedir where the prac
  13. # repo is checked out and built
  14. # RAMEN_SSH_P2_USERHOST: the user@host to ssh to for P2
  15. # RAMEN_SSH_P2_SSHOPTS: any options to ssh you need to ssh to P2
  16. # RAMEN_SSH_P2_IP: the IP address P2 can listen for connections on
  17. # RAMEN_SSH_P2_DIR: the directory relative to the homedir where the prac
  18. # repo is checked out and built
  19. # Get the IP addresses
  20. p0addr=$RAMEN_SSH_P0_IP
  21. p1addr=$RAMEN_SSH_P1_IP
  22. p2addr=$RAMEN_SSH_P2_IP
  23. lognitems=20
  24. naccess=10
  25. if [ "$1" != "" ]; then
  26. lognitems="$1"
  27. fi
  28. if [ "$2" != "" ]; then
  29. naccess="$2"
  30. fi
  31. echo ===== Running ramen $lognitems $naccess
  32. date "+===== Start %s %F %T"
  33. savefile0=$$.p0.out
  34. savefile1=$$.p1.out
  35. savefile2=$$.p2.out
  36. ssh -n $RAMEN_SSH_P2_SSHOPTS $RAMEN_SSH_P2_USERHOST "cd $RAMEN_SSH_P2_DIR && $RAMEN_NUMA_P2 stdbuf -o 0 ./target/release/examples/bench_doram -a $naccess -i 2 -s $lognitems -l 0.0.0.0 -p 6000 -c 0:$p0addr:8000 --connect-timeout-seconds 30 > $savefile2 2>&1" &
  37. ssh -n $RAMEN_SSH_P1_SSHOPTS $RAMEN_SSH_P1_USERHOST "cd $RAMEN_SSH_P1_DIR && $RAMEN_NUMA_P1 stdbuf -o 0 ./target/release/examples/bench_doram -a $naccess -i 1 -s $lognitems -l 0.0.0.0 -p 7000 -c 2:$p2addr:6000 --connect-timeout-seconds 30 > $savefile1 2>&1" &
  38. ssh -n $RAMEN_SSH_P0_SSHOPTS $RAMEN_SSH_P0_USERHOST "cd $RAMEN_SSH_P0_DIR && $RAMEN_NUMA_P0 stdbuf -o 0 ./target/release/examples/bench_doram -a $naccess -i 0 -s $lognitems -l 0.0.0.0 -p 8000 -c 1:$p1addr:7000 --connect-timeout-seconds 30 > $savefile0 2>&1" &
  39. wait
  40. echo ===== P0 output
  41. ssh -n $RAMEN_SSH_P0_SSHOPTS $RAMEN_SSH_P0_USERHOST "cd $RAMEN_SSH_P0_DIR && cat $savefile0 && rm -f $savefile0"
  42. echo ===== P1 output
  43. ssh -n $RAMEN_SSH_P1_SSHOPTS $RAMEN_SSH_P1_USERHOST "cd $RAMEN_SSH_P1_DIR && cat $savefile1 && rm -f $savefile1"
  44. echo ===== P2 output
  45. ssh -n $RAMEN_SSH_P2_SSHOPTS $RAMEN_SSH_P2_USERHOST "cd $RAMEN_SSH_P2_DIR && cat $savefile2 && rm -f $savefile2"
  46. date "+===== End %s %F %T"