-
Notifications
You must be signed in to change notification settings - Fork 0
/
multi-experiments.py
executable file
·37 lines (25 loc) · 1.22 KB
/
multi-experiments.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import os
from dotenv import load_dotenv
from multiprocessing import Pool
from multiprocessing import Process
load_dotenv()
sim_params = {
'cores': int(os.getenv('cores')), # number of CPU cores
'users': int(os.getenv('Users')), # 15
'rep': int(os.getenv('Repetition')), # number of simulations repetitions
'stopTime': int(os.getenv('StopTime')), # Simulation duration
'protocol': os.getenv('AdaptationLogicToUse'), # RateBasedAdaptationLogic RateAndBufferBasedAdaptationLogic
}
def start_simulation(seed):
# os.system('./waf --run \'dash-btree-botup --stopTime=%d --Client=%d --seed=%d --AdaptationLogicToUse=\'%s\'\'' %
# (sim_params['stopTime'], sim_params['users'], seed, sim_params['protocol']))
os.system('./waf --run \'binary-tree-scenario --stopTime=%d --Client=%d --seed=%d --HASLogic=\"dash::player::%s\"\'' %
(sim_params['stopTime'], sim_params['users'], seed, sim_params['protocol']))
def main():
print("Starting users:", sim_params['users'])
q = [i for i in range(sim_params['rep'])]
with Pool(sim_params['cores']) as p:
p.map(start_simulation, q)
print("Done.")
if __name__ == '__main__':
main()