timer.py 716 B

12345678910111213141516171819202122232425262728
  1. #!/bin/env python
  2. import sys
  3. sys.path.append("../../src/")
  4. import time
  5. sys.setrecursionlimit(10000)
  6. loads = range(10000, 100000, 5000)
  7. iters = int(sys.argv[1])
  8. import subprocess
  9. output = open('/tmp/output', 'w')
  10. for memo in [True, False]:
  11. f = open("dist_memo/result_%s" % (memo), 'w')
  12. for load in loads:
  13. val = str(load)
  14. for _ in range(iters):
  15. command = "mpirun -np 2 python dist_memo/model.py %i %s"
  16. command = (command % (load, memo))
  17. start = time.time()
  18. subprocess.check_output(command, shell=True, stderr=output)
  19. val += " %s" % (round(time.time() - start, 2))
  20. f.write("%s\n" % (val))
  21. print(val)
  22. f.close()