1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- #!/usr/bin/python3
- import subprocess
- import os
- import sys
- import math
- # CONFIGS TO SET:
- MANIFEST_FILE = "App/manifest.yaml"
- '''
- Generate a manifest file with:
- N: number of clients
- M: number of servers
- T: number of threads for each server
- B: msg_size
- '''
- def generate_manifest(N, M, T, B, PRIVATE_ROUTE = True, priv_out=1, priv_in=1, pub_out=1, pub_in=1):
- mf = open(MANIFEST_FILE, 'w+')
- manifest_params = '''params:
- # The total max number of users
- user_count: {N}
- # The size of a message in bytes
- msg_size: {B}
- # The number of private messages each user can send per epoch
- priv_out: {pro}
- # The number of private messages each user can receive per epoch
- priv_in: {pri}
- # The number of public messages each user can send per epoch
- pub_out: {puo}
- # The number of public messages each user can receive per epoch
- pub_in: {pui}
- # Private or public routing protocol selection
- private_routing: {PRIVATE_ROUTE}
- # A hardcoded master secret for generating keys to bootstrap
- # client -> server communications
- master_secret: \"AHardCodedAESKey\"\n'''.format(N = str(N), B = str(B), PRIVATE_ROUTE=str(PRIVATE_ROUTE),\
- pro = str(priv_out), pri = str(priv_in), puo = str(pub_out), pui = str(pub_in))
- # print (manifest_params)
- mf.write(manifest_params)
- server_params = '''\ns{i}:
- sprvfile: keys/priv.seal.s{i}
- pubfile: keys/pub.s{i}
- weight: 1
- listen: 127.0.0.{i}:12500
- clisten: 127.0.0.{i}:13000
- slisten: 127.0.0.{i}:13001
- launchprefix: numactl {nstring}
- args: -t {T}
- roles: 7\n'''
- # Assign server threads starting at 0
- numa_base = 0
- # Do not assign servers threads that are across the processors
- numa_limit = 36
- numa_start = numa_base
- for s in range(1, M+1):
- numa_end = numa_start + T -1
- if(numa_start <= numa_limit and numa_end > numa_limit):
- numa_start = 40
- numa_end = numa_start + T
- numa_string = "-C{s}-{e}".format(s = str(numa_start), e = str(numa_end))
- numa_start = numa_end + 1
- curr_params = server_params.format(i = str(s), nstring = numa_string, T = str(T))
- # print(curr_params)
- mf.write(curr_params)
- mf.close()
- if __name__ == "__main__":
- if(len(sys.argv)!=5):
- print("Incorrect usage!\n Expects 4 parameters. n,m,t,b")
- exit()
- n = int(sys.argv[1])
- m = int(sys.argv[2])
- t = int(sys.argv[3])
- b = int(sys.argv[4])
- generate_manifest(n, m, t, b)
|