@@ -51,8 +51,6 @@ def run(nproc: int, ntask: int, version: str, memory, duration) -> dict:
51
51
"times" : times
52
52
}
53
53
54
- os .system ("g++ -O3 -o bench bench.cxx" )
55
-
56
54
57
55
@click .command ()
58
56
@click .argument ("nproc" , type = str )
@@ -61,8 +59,12 @@ def run(nproc: int, ntask: int, version: str, memory, duration) -> dict:
61
59
@click .option ("-u" , "--upload" , is_flag = True )
62
60
@click .option ("-n" , "--name" )
63
61
@click .option ("-m" , "--memory" , type = int , default = 10 )
64
- @click .option ("-d" , "--duration" , type = int , default = 10 )
65
- def main (nproc , ntask , version , upload , name , memory , duration ):
62
+ @click .option ("-d" , "--duration" , type = int , default = 100 )
63
+ @click .option ("-o" , "--optimization" , type = str , default = "O3" )
64
+ def main (nproc , ntask , version , upload , name , memory , duration , optimization ):
65
+ optimization_s = optimization .split ("," )
66
+
67
+
66
68
if '..' in nproc :
67
69
nproc_s = range (* map (int , nproc .split (".." )))
68
70
else :
@@ -74,21 +76,27 @@ def main(nproc, ntask, version, upload, name, memory, duration):
74
76
if not os .path .exists (f"reports/{ name } " ):
75
77
os .makedirs (f"reports/{ name } " )
76
78
77
- for nproc in nproc_s :
78
- for ntask in ntask_s :
79
- for version in version_s :
80
- print ("nproc" , nproc , "ntask" , ntask , "version" , version )
81
-
82
- r = run (nproc , ntask , version , memory , duration )
83
- r ["name" ] = name
84
-
85
- fn = f"reports/{ name } /{ nproc } _{ ntask } _{ version } .json"
86
- with open (fn , "w" ) as f :
87
- json .dump (r , f )
88
-
89
- if upload :
90
- r = ctadata .upload_file (fn , fn )
91
- print (r )
79
+ for optimization in optimization_s :
80
+ if optimization in ["O3" , "O2" , "O1" , "O0" ]:
81
+ os .system (f"g++ -{ optimization } -o bench bench.cxx" )
82
+ else :
83
+ os .system ("g++ -o bench bench.cxx" )
84
+
85
+ for nproc in nproc_s :
86
+ for ntask in ntask_s :
87
+ for version in version_s :
88
+ print ("nproc" , nproc , "ntask" , ntask , "version" , version )
89
+
90
+ r = run (nproc , ntask , version , memory , duration )
91
+ r ["name" ] = name
92
+
93
+ fn = f"reports/{ name } /{ nproc } _{ ntask } _{ version } .json"
94
+ with open (fn , "w" ) as f :
95
+ json .dump (r , f )
96
+
97
+ if upload :
98
+ r = ctadata .upload_file (fn , fn )
99
+ print (r )
92
100
93
101
94
102
0 commit comments