-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecute_notebook.py
More file actions
66 lines (57 loc) · 2.75 KB
/
execute_notebook.py
File metadata and controls
66 lines (57 loc) · 2.75 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import papermill as pm
import argparse
def define_and_parse_flags(parse=True):
parser = argparse.ArgumentParser()
parser.add_argument('--C', type=int, default=1,
help='The number of CNNs.')
parser.add_argument('--N', type=int, default=50,
help='The number of nodes.')
parser.add_argument('--xm', type=float, default=15,
help='Space width as (-xm, xm).')
parser.add_argument('--dt', type=float, default=7.5,
help='Transmission range.')
parser.add_argument('--datarate', type=float, default=9241.6,
help='Datarate (measured in KB/s --> default is 72.2 Mb/s == 9241.6 KB/s)')
parser.add_argument('--Ks', type=int, default=227 * 227 * 3 * 4 / 1024,
help='Image Size (measured in KB --> default is a floating-point RGB image of size 227x227).')
parser.add_argument('--orange_p', type=float, default=0.45,
help='OrangePi Zero percentage.')
parser.add_argument('--beagle_p', type=float, default=0.45,
help='BeagleBone AI percentage.')
parser.add_argument('--pi3_p', type=float, default=0.10,
help='Raspberry PI 3B+ percentage.')
parser.add_argument('--cnn_name', type=str, default='alex',
help='The name of the CNN to place.')
parser.add_argument('--output_dir', required=True,
help='The folder in which the execute_notebook are stored. A folder named results with all the csvs will be created.')
parser.add_argument('--time_limit', type=float, default=300.0,
help='GUROBI solver time limit.')
parser.add_argument('--num_exps', type=int, default=500,
help='The number of exps to run.')
# Return the parser or the parsed values according to the parameter 'parse'.
if parse:
return parser.parse_args()
return parser
if __name__ == '__main__':
FLAGS = define_and_parse_flags()
for i in range(FLAGS.num_exps):
print('EXP {}'.format(i))
pm.execute_notebook(
'Multi Source Multi CNN-Version To Be Executed.ipynb',
'{}/exp{}.ipynb'.format(FLAGS.output_dir, i),
parameters=dict(
exp_id=i,
C=FLAGS.C,
N=FLAGS.N,
xm=FLAGS.xm,
dt=FLAGS.dt,
datarate=FLAGS.datarate,
Ks=FLAGS.Ks,
orange_p=FLAGS.orange_p,
beagle_p=FLAGS.beagle_p,
pi3_p=FLAGS.pi3_p,
cnn_name=FLAGS.cnn_name,
output_dir='{}/results'.format(FLAGS.output_dir),
time_limit=FLAGS.time_limit
)
)