d_scaling_storage.py 870 B

1234567891011121314151617181920212223242526272829303132333435
  1. import os
  2. import subprocess
  3. SENDS = 2**20
  4. USERS = 2**13
  5. THREADS = 48
  6. D_MAPS = 15
  7. RUNS = 10
  8. WARMUP = 0
  9. DATA_DIR = os.path.join(os.getcwd(), "data", "d-scaling-store")
  10. os.makedirs(DATA_DIR, exist_ok=True)
  11. SPARTA_D_DIR = os.path.join(os.getcwd(), "sparta-d")
  12. SPARTA_D_FILE = os.path.join(
  13. DATA_DIR, f"sparta-d-{SENDS}-{USERS}-{THREADS}.csv")
  14. def sparta_d_cmd(maps):
  15. cmd = ["cargo", "run", "--release", "--",
  16. str(SENDS), str(USERS), str(THREADS), str(USERS), str(maps), "-r", str(RUNS), "-w", str(WARMUP)]
  17. result = subprocess.run(cmd, capture_output=True,
  18. text=True, cwd=SPARTA_D_DIR)
  19. return result.stdout
  20. for maps in range(1, 16):
  21. print(maps)
  22. with open(SPARTA_D_FILE, "a") as sparta_d_file:
  23. output = sparta_d_cmd(maps)
  24. print("\tsparta_d:", output)
  25. sparta_d_file.write(output)