timer.py 823 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/env python
  2. import sys
  3. sys.path.append("../../src/")
  4. import time
  5. sys.setrecursionlimit(10000)
  6. tests = ["AT", "CACR", "NO", "CA"]
  7. loads = range(5000, 45000, 5000)
  8. iters = int(sys.argv[1])
  9. for relocator in tests:
  10. f = open("dist_activity_citylayout/results_%s" % relocator, 'w')
  11. for load in loads:
  12. total = 0.0
  13. for _ in range(iters):
  14. command = "mpirun -np 3 python dist_activity_citylayout/test_city_%s.py %s" % (relocator, load)
  15. output = open("/tmp/output", 'w')
  16. import subprocess
  17. start = time.time()
  18. subprocess.call(command, shell=True, stdout=output)
  19. output.close()
  20. total += (time.time() - start)
  21. f.write("%s %s\n" % (load, total/iters))
  22. print("%s %s" % (load, total/iters))
  23. f.close()