message_scaling_storage.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import os
  2. import subprocess
  3. # done
  4. SENDS = [2**i for i in range(25, 26)]
  5. FETCHES = 8192
  6. USERS = FETCHES
  7. THREADS = 48
  8. MAPS = 5
  9. D_MAPS = 15
  10. RUNS = 10
  11. WARMUP = 0
  12. DATA_DIR = os.path.join(os.getcwd(), "data", "message-scaling")
  13. os.makedirs(DATA_DIR, exist_ok=True)
  14. SPARTA_DIR = os.path.join(os.getcwd(), "sparta")
  15. SPARTA_D_DIR = os.path.join(os.getcwd(), "sparta-d")
  16. BASELINE_DIR = os.path.join(os.getcwd(), "baseline")
  17. BASELINE_FILE = os.path.join(DATA_DIR, f"baseline-{FETCHES}-{THREADS}.csv")
  18. SPARTA_FILE = os.path.join(DATA_DIR, f"sparta-{FETCHES}-{THREADS}-{MAPS}.csv")
  19. SPARTA_D_FILE = os.path.join(
  20. DATA_DIR, f"sparta-d-{FETCHES}-{THREADS}-{D_MAPS}.csv")
  21. def sparta_cmd(sends):
  22. cmd = ["cargo", "run", "--release", "--",
  23. str(sends), str(FETCHES), str(THREADS), str(USERS), str(MAPS), "-r", str(RUNS), "-w", str(WARMUP)]
  24. result = subprocess.run(cmd, capture_output=True,
  25. text=True, cwd=SPARTA_DIR)
  26. print(result.stderr)
  27. return result.stdout
  28. def sparta_d_cmd(sends):
  29. cmd = ["cargo", "run", "--release", "--",
  30. str(sends), str(FETCHES), str(THREADS), str(USERS), str(D_MAPS), "-r", str(RUNS), "-w", str(WARMUP)]
  31. result = subprocess.run(cmd, capture_output=True,
  32. text=True, cwd=SPARTA_D_DIR)
  33. print(result.stderr)
  34. return result.stdout
  35. def baseline_cmd(sends):
  36. cmd = ["cargo", "run", "--release", "--",
  37. str(sends), str(FETCHES), str(THREADS), "-r", str(RUNS), "-w", str(WARMUP)]
  38. result = subprocess.run(cmd, capture_output=True,
  39. text=True, cwd=BASELINE_DIR)
  40. return result.stdout
  41. for send in SENDS:
  42. print(send)
  43. with open(SPARTA_FILE, "a") as sparta_file:
  44. output = sparta_cmd(send)
  45. print("\tsparta:", output)
  46. sparta_file.write(output)
  47. with open(SPARTA_D_FILE, "a") as sparta_d_file:
  48. output = sparta_d_cmd(send)
  49. print("\tsparta-d:", output)
  50. sparta_d_file.write(output)
  51. with open(BASELINE_FILE, "a") as baseline_file:
  52. output = baseline_cmd(send)
  53. print("\tbaseline:", output)
  54. baseline_file.write(output)