timer.py 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/env python
  2. import sys
  3. sys.path.append("../../src/")
  4. import time
  5. sys.setrecursionlimit(10000)
  6. loads = range(5000, 30000, 1000)
  7. termination_time = 200
  8. iters = int(sys.argv[1])
  9. import subprocess
  10. output = open('/tmp/output', 'w')
  11. for nodes, models in [(5, 150), (50, 900)]:
  12. for relocator in [True, False]:
  13. f = open("dist_activity_synthetic/result_%i_%s" % (nodes, relocator), 'w')
  14. for load in loads:
  15. f.write(str(load))
  16. for _ in range(iters):
  17. command = "mpirun -np %i -machinefile ~/machines python dist_activity_synthetic/movingcircle.py %i %i %i %s"
  18. command = (command % (nodes, models, load, termination_time, relocator))
  19. start = time.time()
  20. subprocess.check_output(command, shell=True, stderr=output)
  21. f.write(" %s" % (time.time() - start))
  22. print("%i %s" % (load, time.time() - start))
  23. f.write("\n")
  24. f.close()
  25. f = open("dist_activity_synthetic/result_%i_local" % nodes, 'w')
  26. for load in loads:
  27. f.write(str(load))
  28. for _ in range(iters):
  29. command = "python dist_activity_synthetic/movingcircle.py %i %i %i False"
  30. command = (command % (models, load, termination_time))
  31. start = time.time()
  32. subprocess.check_output(command, shell=True, stderr=output)
  33. f.write(" %s" % (time.time() - start))
  34. print("%i %s" % (load, time.time() - start))
  35. f.write("\n")
  36. f.close()
  37. for relocator in [True, False]:
  38. load = 10000
  39. models = 1500
  40. termination_time = 200
  41. f = open("dist_activity_synthetic/result_nodes_%s" % relocator, 'w')
  42. for nodes in range(3, 50):
  43. for _ in range(iters):
  44. command = "mpirun -np %i -machinefile ~/machines python dist_activity_synthetic/movingcircle.py %i %i %i %s"
  45. command = (command % (nodes, models, load, termination_time, relocator))
  46. start = time.time()
  47. subprocess.check_output(command, shell=True, stderr=output)
  48. f.write(" %s" % (time.time() - start))
  49. print("%i %s" % (nodes, time.time() - start))
  50. f.write("\n")
  51. f.close()
  52. f = open("dist_activity_synthetic/result_nodes_local", 'w')
  53. f.write("1")
  54. for _ in range(iters):
  55. command = "python dist_activity_synthetic/movingcircle.py %i %i %i False"
  56. command = (command % (models, load, termination_time))
  57. start = time.time()
  58. subprocess.check_output(command, shell=True, stderr=output)
  59. f.write(" %s" % (time.time() - start))
  60. print("1 %s" % (time.time() - start))
  61. f.write("\n")
  62. f.close()
  63. for relocator in [True, False]:
  64. try:
  65. import os
  66. os.remove("activity-log")
  67. except OSError:
  68. pass
  69. # Put the load rather high, to create a nice 'bad' distribution
  70. subprocess.check_output("mpirun -np 3 -machinefile ~/machines python dist_activity_synthetic/movingcircle.py 100 30000 400 " + str(relocator), shell=True, stderr=output)
  71. import shutil
  72. shutil.move("activity-log", "dist_activity_synthetic/activity-log_" + str("AT" if relocator else "NO"))