#!/usr/bin/python3 ''' NOTE: This script is tailored for a machine with 2 40-core processors. Currently assumes 8 threads (C36-39,76-79) are set aside for client simulator; change this by setting "prefix" in Client/clientlaunch and the -t option to clientlaunch below. Similarly, the use of cores C0-35,40-75 for the TEEMS servers can be changed in the gen_manifest.py program. If you have a different number of cores available for servers, also change M_MAX below. ''' import subprocess import os import sys import math from gen_manifest import generate_manifest from gen_enclave_config import generate_config ############################################################################### # CONFIGS TO SET: MANIFEST_FILE = "App/manifest.yaml" LOG_FOLDER = "Experiments_test/" # N = number of clients # M = number of servers # T = threads per server instance ## A large grid of many combinations # N = [1<<16, 1<<17, 1<<18, 1<<19, 1<<20] # M = [72, 64, 48, 36, 32, 24, 16, 8, 4, 2, 1] # T = [16, 8, 4, 2, 1] ## Figure 7 N = [1<<15, 1<<16, 1<<17, 1<<18, 1<<19, 1<<20] M = [4] T = [1] ## Figure 8 # N = [1<<20] # M = [72, 64, 48, 36, 32, 24, 16, 8, 4, 2, 1] # T = [1] # Max servers depending on number of threads (assuming 72 available # cores for servers) M_MAX = { 1:72, 2:36, 4:18, 8:9, 16:4 } # B = message size (bytes) B = 256 ############################################################################### def epoch_time(n, m, t, b): # Base epoch time is 15 sec etime_base = 15 clients_per_server = math.ceil(n/m) # Using 1 sec for ~50K clients in compute time # Using 8 sec for 2^20 clients in route_compute time as the base for calculations below # (About 1 sec actual route, 6.5 sec for storage generate_tokens # and process_msgs) etime_route_compute = 0.8 * math.ceil(clients_per_server/100000) etime_precompute = 1.5 * math.ceil(clients_per_server/100000) # Costs for Waksman network precompute # Public routing needs 5 WN, private routing needs 3 WNs etime_precompute *=5 # Client time: # Takes about 30 sec for handling 2^20 clients etime_client = math.ceil(clients_per_server/100000) * 5 etime = etime_base + etime_precompute + etime_route_compute + etime_client return int(etime) if __name__ == "__main__": if not os.path.exists(LOG_FOLDER): os.mkdir(LOG_FOLDER) for t in T: b = B m_start = 1 # Set M_MAX depending on t m_end = M_MAX[t] for m in M: if(m <= m_end): for n in N: print("\n\n Running Experiment t = %d, m = %d, n = %d \n\n" % (t, m, n)) generate_manifest(n, m, t, b) generate_config(n, m, t, b) epoch_interval = epoch_time(n, m, t, b) print("Epoch_interval = %d" % epoch_interval) log_subfolder = str(n) + "_" + str(m) + "_" + str(t) + "_" + str(b) + "/" log_subfolder = LOG_FOLDER + log_subfolder if not os.path.exists(log_subfolder): os.mkdir(log_subfolder) # Since launch is invoked from App/ ; we add a ../ to subfolder before # passing it to slaunch log_subfolder = "../" + log_subfolder slaunch = [] slaunch.append("./launch") slaunch.append("route_clients") slaunch.append("-l") slaunch.append(log_subfolder) slaunch.append("-n") nodes_to_include = ["-n"] for i in range(1, m+1): nodes_to_include.append("s"+str(i)) slaunch.append("s"+str(i)) slaunch.append("-e") slaunch.append(str(epoch_interval)) os.chdir("./App") # Server outputs are captured by log files provided to each of the server # launch calls made by App/launch make = subprocess.call(["make", "-C", "..", "-j"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) try: os.mkdir("keys") except: # It's OK if it already exists pass pubkeys = subprocess.call(["./getpubkeys"]) server_process = subprocess.run(slaunch) claunch = [] claunch.append("./clientlaunch") claunch.append("-t") claunch.append("8") claunch.append("-l") claunch.append(log_subfolder+"clients.log") os.chdir("./../Client/") client_process = subprocess.call(claunch) os.chdir("./../")