submap_scaling_storage.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import os
  2. import subprocess
  3. # done
  4. SENDS = 1048576
  5. FETCHES = 8192
  6. USERS = FETCHES
  7. THREADS = 8
  8. MAP_THREADS = [(i, 8 + 8 * i) for i in range(6, int(16))]
  9. # MAP_THREADS = [(i, 8 + 8 * i) for i in range(1, int(48 / THREADS))]
  10. RUNS = 10
  11. WARMUP = 0
  12. DATA_DIR = os.path.join(os.getcwd(), "data", "submap-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}.csv")
  19. SPARTA_D_FILE = os.path.join(DATA_DIR, f"sparta-d-{FETCHES}-{THREADS}.csv")
  20. def sparta_cmd(mt):
  21. (num_maps, num_threads) = mt
  22. cmd = ["cargo", "run", "--release", "--",
  23. str(SENDS), str(FETCHES), str(num_threads),
  24. str(USERS), str(num_maps), "-r", str(RUNS), "-w", str(WARMUP)]
  25. result = subprocess.run(cmd, capture_output=True,
  26. text=True, cwd=SPARTA_DIR)
  27. return result.stdout
  28. def sparta_d_cmd(mt):
  29. (num_maps, _num_threads) = mt
  30. cmd = ["cargo", "run", "--release", "--",
  31. str(SENDS), str(FETCHES), str(48),
  32. str(USERS), str(num_maps), "-r", str(RUNS), "-w", str(WARMUP)]
  33. result = subprocess.run(cmd, capture_output=True,
  34. text=True, cwd=SPARTA_D_DIR)
  35. return result.stdout
  36. def baseline_cmd(mt):
  37. (_num_maps, num_threads) = mt
  38. cmd = ["cargo", "run", "--release", "--",
  39. str(SENDS), str(FETCHES), str(num_threads), "-r", str(RUNS), "-w", str(WARMUP)]
  40. result = subprocess.run(cmd, capture_output=True,
  41. text=True, cwd=BASELINE_DIR)
  42. return result.stdout
  43. for mt in MAP_THREADS:
  44. print(mt)
  45. # with open(SPARTA_FILE, "a") as sparta_file:
  46. # output = sparta_cmd(mt)
  47. # print("\tsparta:", output)
  48. # sparta_file.write(output)
  49. with open(SPARTA_D_FILE, "a") as sparta_d_file:
  50. output = sparta_d_cmd(mt)
  51. print("\tsparta_d:", output)
  52. sparta_d_file.write(output)
  53. # with open(BASELINE_FILE, "a") as baseline_file:
  54. # output = baseline_cmd(mt)
  55. # print("\tbaseline:", output)
  56. # baseline_file.write(output)