run_experiments.py 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #!/usr/bin/python3
  2. '''
  3. NOTE: This script is tailored for sizzle!
  4. Hence it does server thread allocation assuming 2 40-core processors.
  5. Currently assumes 8 threads (C72-79) are set aside for client simulator
  6. Run generate manifest with the maximum number of servers you are going to use
  7. and generate the keys for this before running experiments
  8. (Run ./App/getpubkeys to generate keys for the servers)
  9. '''
  10. import subprocess
  11. import os
  12. import sys
  13. import math
  14. from gen_manifest import generate_manifest
  15. from gen_enclave_config import generate_config
  16. ###############################################################################
  17. # CONFIGS TO SET:
  18. MANIFEST_FILE = "App/manifest.yaml"
  19. #MANIFESTS_FOLDER = "Manifests/"
  20. LOG_FOLDER = "Experiments_Plot/"
  21. RESULT_FOLDER = "Experiment_results/"
  22. # N = number of clients
  23. N = [1<<16, 1<<17, 1<<18, 1<<19, 1<<20, 1<<21]
  24. # M = number of servers
  25. M = [3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 18, 20, 24, 26, 28, 32, 36, 40, 48, 56, 64, 72]
  26. # T = threads per server instance
  27. T = [2, 4, 8, 16]
  28. # Max servers depending on number of threads
  29. M_MAX = {
  30. 1:72, # 24 in M
  31. 2:36, # 19 in M
  32. 4:18, # 13 in M
  33. 8:9, # 8 in M
  34. 16:4 # 4 in M
  35. }
  36. # B = msg_size (-u)
  37. B = 256
  38. ###############################################################################
  39. def epoch_time(n, m, t, b):
  40. # Base epoch time is 5 sec
  41. etime_base = 5
  42. clients_per_server = math.ceil(n/m)
  43. # Using 1 sec for ~50K clients in compute time
  44. etime_compute = math.ceil(clients_per_server/50000)
  45. etime_inc = math.ceil(clients_per_server/25000)
  46. etime_client = ((math.ceil(2/t))**2) * etime_inc
  47. etime = etime_base + etime_compute + etime_client
  48. return etime
  49. if __name__ == "__main__":
  50. if not os.path.exists(LOG_FOLDER):
  51. os.mkdir(LOG_FOLDER)
  52. for t in T:
  53. b = B
  54. m_start = 1
  55. # Set M_MAX depending on t
  56. m_end = M_MAX[t]
  57. for m in M:
  58. if(m < m_end):
  59. for n in N:
  60. print("\n\n Running Experiment t = %d, m = %d, n = %d \n\n" % (t, m, n))
  61. generate_manifest(n, m, t, b)
  62. generate_config(n, m, t, b)
  63. epoch_interval = epoch_time(n, m, t, b)
  64. print("Epoch_interval = %d" % epoch_interval)
  65. log_subfolder = str(n) + "_" + str(m) + "_" + str(t) + "_" + str(b) + "/"
  66. log_subfolder = LOG_FOLDER + log_subfolder
  67. if not os.path.exists(log_subfolder):
  68. os.mkdir(log_subfolder)
  69. # Since launch is invoked from App/ ; we add a ../ to subfolder before
  70. # passing it to slaunch
  71. log_subfolder = "../" + log_subfolder
  72. slaunch = []
  73. slaunch.append("./launch")
  74. slaunch.append("route_clients")
  75. slaunch.append("-l")
  76. slaunch.append(log_subfolder)
  77. slaunch.append("-n")
  78. nodes_to_include = ["-n"]
  79. for i in range(1, m+1):
  80. nodes_to_include.append("s"+str(i))
  81. slaunch.append("s"+str(i))
  82. slaunch.append("-e")
  83. slaunch.append(str(epoch_interval))
  84. os.chdir("./App")
  85. # Server outputs are captured by log files provided to each of the server
  86. # launch calls made by App/launch
  87. make = subprocess.call(["make", "-C", "..", "-j"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
  88. server_process = subprocess.run(slaunch)
  89. claunch = []
  90. claunch.append("./clientlaunch")
  91. claunch.append("-t")
  92. claunch.append("8")
  93. claunch.append("-l")
  94. claunch.append(log_subfolder+"clients.log")
  95. os.chdir("./../Client/")
  96. client_process = subprocess.call(claunch)
  97. os.chdir("./../")