1212##########################
1313# appmx, etc.
1414
15- def find_approxmc_time_cnt (fname ):
16- t = None
17- cnt = None
18- with open (fname , "r" ) as f :
19- for line in f :
20- line = line .strip ()
21- if "c [appmc+arjun] Total time" in line :
22- t = float (line .split ()[4 ])
23- if "s mc" in line :
24- if len (line .split ()[2 ]) > 1000 : cnt = len (line .split ()[2 ])
25- else : cnt = decimal .Decimal (line .split ()[2 ]).log10 ()
26-
27- return [t ,cnt ]
28-
29- def find_exactmc_time_cnt (fname ):
30- t = None
31- cnt = None
32- with open (fname , "r" ) as f :
33- for line in f :
34- line = line .strip ()
35- if "Total time cost" in line :
36- t = float (line .split ()[3 ])
37- if "Number of models" in line :
38- if len (line .split ()[3 ]) > 1000 : cnt = len (line .split ()[3 ])
39- cnt = decimal .Decimal (line .split ()[3 ]).log10 ()
40-
41- return [t ,cnt ]
42-
43- def find_minic2d_time_cnt (fname ):
44- t = None
45- cnt = None
46- with open (fname , "r" ) as f :
47- for line in f :
48- line = line .strip ()
49- if "Total Time" in line :
50- t = float (line .split ()[2 ].strip ("s" ))
51- if "Counting..." in line :
52- if len (line .split ()[1 ]) > 1000 : cnt = len (line .split ()[1 ])
53- else : cnt = decimal .Decimal (line .split ()[1 ]).log10 ()
54-
55- return [t ,cnt ]
56-
57- def find_d4_time_cnt (fname ):
58- t = None
59- cnt = None
60- with open (fname , "r" ) as f :
61- for line in f :
62- line = line .strip ()
63- if "c [COUNTER] Elapsed time:" in line :
64- t = float (line .split ()[4 ])
65- if "c exact arb int" in line :
66- cnt = decimal .Decimal (line .split ()[5 ]).log10 ()
67- if "c s exact quadruple int" in line :
68- cnt = decimal .Decimal (line .split ()[5 ]).log10 ()
69-
70- # print("t:", t, "cnt: ", cnt)
71- return [t ,cnt ]
72-
7315#c o Components = 339421
7416#c o conflicts = 291050 (count 287680, sat 3370)
7517#c o decisions = 643616 (count 335433, sat 308183)
@@ -99,45 +41,6 @@ def find_gpmc_time_cnt(fname):
9941
10042 return t ,cnt ,compsK ,conflicts ,decisionsK
10143
102- def find_dsharp_time_cnt (fname ):
103- t = None
104- cnt = None
105- with open (fname , "r" ) as f :
106- for line in f :
107- line = line .strip ()
108- if "Runtime: " in line :
109- t = float (line .split (":" )[1 ].strip ("s" ))
110- if "#SAT (full)" in line :
111- if len (line .split ()[2 ]) > 1000 : cnt = len (line .split ()[2 ])
112- else : cnt = decimal .Decimal (line .split ()[2 ]).log10 ()
113-
114- return [t ,cnt ]
115-
116- # when only preprocessing finds an answer, we don't have "c o Solved"
117- # Instead, we have only "c o Preprocessed. 469.010186778s Vars: 0 Clauses: 0 Free vars: 1"
118- def find_sharpsat_time_cnt (fname ):
119- t = None
120- cnt = None
121- prepro_t = None
122- with open (fname , "r" ) as f :
123- for line in f :
124- line = line .strip ()
125- if "c o Solved." in line :
126- t = float (line .split ()[3 ])
127- if "c o Preprocessed." in line :
128- d = line .split ()[3 ]
129- d = d .strip ('s' )
130- prepro_t = float (d )
131- if "c s exact arb int" in line :
132- if len (line .split ()[5 ]) > 1000 : cnt = len (line .split ()[5 ])
133- else : cnt = decimal .Decimal (line .split ()[5 ]).log10 ()
134- if "c s exact arb float" in line :
135- cnt = decimal .Decimal (line .split ()[5 ]).log10 ()
136-
137- if cnt is not None and t is None :
138- t = prepro_t
139- return [t ,cnt ]
140-
14144def approxmc_version (fname ):
14245 aver = None
14346 cver = None
@@ -322,15 +225,22 @@ def collect_cache_data(fname):
322225
323226def timeout_parse (fname ):
324227 t = None
325- m = None
228+ signal = None
229+ mem = None
326230 call = None
231+ solver = None
232+ page_faults = None
327233 with open (fname , "r" ) as f :
328234 for line in f :
329235 line = line .strip ()
236+ if "Command terminated by signal" in line :
237+ signal = int (line .split ()[4 ])
238+ if "Minor (reclaiming a frame) page faults:" in line :
239+ page_faults = int (line .split ()[6 ])
330240 if "User time (seconds)" in line :
331241 t = float (line .split ()[3 ])
332242 if "Maximum resident set size (kbytes)" in line :
333- m = float (line .split ()[5 ])/ (1000 ) # get it in MB
243+ mem = float (line .split ()[5 ])/ (1000 ) # get it in MB
334244 if "Command being timed" in line :
335245 call = " " .join (line .split ()[3 :])
336246 if "mc2022" in call :
@@ -346,15 +256,29 @@ def timeout_parse(fname):
346256 call = call .split ("doalarm 60" )[1 ]
347257 else :
348258 call = call .split ("doalarm 900" )[1 ]
259+
260+ if "./ganak " in call : solver = "ganak"
261+ if "./d4" in call : solver = "d4"
262+ if "./approxmc" in call : solver = "approxmc"
263+ if "./gpmc" in call : solver = "gpmc"
264+ if "./gpmc-complex" in call : solver = "gpmc"
265+ if "./KCBox" in call : solver = "exactmc"
266+ if "./sharpSAT" in call : solver = "sharptd"
267+
349268 call = call .replace ("././ganak " , "" )
350269 call = call .replace ("././d4-1d9cc6146f18b8 " , "" )
351270 call = call .replace ("././approxmc " , "" )
352271 call = call .replace ("././gpmc " , "" )
272+ call = call .replace ("././gpmc-complex " , "" )
353273 call = call .replace ("././KCBox-371eb601f2aa" , "" )
354274 call = call .replace ("././sharpSAT" , "" )
355275 call = call .strip ()
356276
357- return [t , m , call ]
277+ if signal is not None :
278+ t = None
279+ if signal is None :
280+ signal = ""
281+ return [t , mem , call , solver , page_faults , signal ]
358282
359283# c o width 45
360284# c o CMD: timeout 60.000000s ./flow_cutter_pace17 <tmp/instance1709332682043115_14040_59941_1.tmp >tmp/instance1709332682043118_14040_59941_2.tmp 2>/dev/null
@@ -459,13 +383,19 @@ def find_mem_out(fname):
459383 # print("Dealing with dir: %s fname: %s" % (dirname, full_fname))
460384
461385 if f .endswith (".timeout" ) or ".timeout_" in f :
462- files [base ]["solvertout" ] = timeout_parse (f )
386+ timeout_t , timeout_mem , timeout_call , timeout_solver , page_faults , signal = timeout_parse (f )
387+ files [base ]["timeout_t" ] = timeout_t
388+ files [base ]["timeout_mem" ] = timeout_mem
389+ files [base ]["timeout_call" ] = timeout_call
390+ files [base ]["page_faults" ] = page_faults
391+ files [base ]["signal" ] = signal
392+ if "solver" not in files [base ] or files [base ]["solver" ] is None :
393+ files [base ]["solver" ] = timeout_solver
463394
464395 files [base ]["mem_out" ] = find_mem_out (f )
465396 if f .endswith (".out_ganak" ) or f .endswith (".out" ):
466397 files [base ]["solver" ] = "ganak"
467398 ver , conflicts , decisionsK , t , cnt , bdd_called = ganak_conflicts (f )
468- files [base ]["solvertime" ] = [t , cnt ]
469399 files [base ]["solverver" ] = ver
470400 files [base ]["decisionsK" ] = decisionsK
471401 files [base ]["conflicts" ] = conflicts
@@ -501,73 +431,64 @@ def find_mem_out(fname):
501431 files [base ]["primal_edge_var_ratio" ] = edge_var_ratio
502432 if ".out_approxmc" in f :
503433 files [base ]["solver" ] = "approxmc"
504- files [base ]["solvertime" ] = find_approxmc_time_cnt (f )
505434 files [base ]["solverver" ] = approxmc_version (f )
506435 if ".out_gpmc" in f :
507436 files [base ]["solver" ] = "gpmc"
508437 t ,cnt ,compsK ,conflicts ,decisionsK = find_gpmc_time_cnt (f )
509- files [base ]["solvertime" ] = [t , cnt ]
510438 files [base ]["conflicts" ] = conflicts
511439 files [base ]["compsK" ] = compsK
512440 files [base ]["decisionsK" ] = decisionsK
513441 files [base ]["solverver" ] = ["gpmc" , "gpmc" ]
514442 if ".out_sharptd" in f :
515443 files [base ]["solver" ] = "sharptd"
516- files [base ]["solvertime" ] = find_sharpsat_time_cnt (f )
517444 files [base ]["solverver" ] = ["sharptd" , "sharptd" ]
518445 td = sstd_treewidth (f )
519446 files [base ]["td_width" ] = td [0 ]
520447 files [base ]["td_time" ] = td [1 ]
521448 if ".out_d4" in f :
522449 files [base ]["solver" ] = "d4"
523- files [base ]["solvertime" ] = find_d4_time_cnt (f )
524450 files [base ]["solverver" ] = ["d4" , "d4" ]
525451 if ".out_dsharp" in f :
526452 files [base ]["solver" ] = "dsharp"
527- files [base ]["solvertime" ] = find_dsharp_time_cnt (f )
528453 files [base ]["solverver" ] = ["dsharp" , "dsharp" ]
529454 if ".out_minic2d" in f :
530455 files [base ]["solver" ] = "minic2d"
531- files [base ]["solvertime" ] = find_minic2d_time_cnt (f )
532456 files [base ]["solverver" ] = ["minic2d" , "minic2d" ]
533457 if ".out_exactmc" in f :
534458 files [base ]["solver" ] = "exactmc"
535- files [base ]["solvertime" ] = find_exactmc_time_cnt (f )
536459 files [base ]["solverver" ] = ["exactmc" ,"exactmc" ]
537460
538461
539462with open ("mydata.csv" , "w" ) as out :
540463 cols = "dirname,fname,"
541- cols += "ganak_time,ganak_tout_t, ganak_mem_MB,ganak_call,ganak_ver,conflicts,decisionsK,compsK,primal_density,primal_edge_var_ratio,td_width,td_time,arjun_time,backboneT,backwardT,indepsz,optindepsz,origprojsz,new_nvars,unknsz,cache_del_time,cache_miss_rate,bdd_called,sat_called,sat_rst,rst,cubes_orig,cubes_final,mem_out,gates_extended,gates_extend_t,padoa_extended,padoa_extend_t"
464+ cols += "ganak_time,ganak_mem_MB,ganak_call,page_faults,signal ,ganak_ver,conflicts,decisionsK,compsK,primal_density,primal_edge_var_ratio,td_width,td_time,arjun_time,backboneT,backwardT,indepsz,optindepsz,origprojsz,new_nvars,unknsz,cache_del_time,cache_miss_rate,bdd_called,sat_called,sat_rst,rst,cubes_orig,cubes_final,mem_out,gates_extended,gates_extend_t,padoa_extended,padoa_extend_t"
542465 out .write (cols + "\n " )
543466 for _ , f in files .items ():
544467 toprint = ""
545468 toprint += f ["dirname" ] + ","
546469 toprint += f ["fname" ] + ","
547470
548- # ganak_t
471+ # check solver parsed
549472 if "solver" not in f :
550- print ("oops" )
473+ print ("oops, solver not found, that's wrong " )
551474 print (f )
552- continue
553-
554- # ganak_time
555- if f ["solvertime" ][0 ] is None :
556- toprint += ","
557- else :
558- toprint += "%s," % f ["solvertout" ][0 ]
559- # toprint += "%s," % f["solvertime"][0]
560-
561- #ganak_tout_t, ganak_mem_MB, ganak_call
562- if f ["solvertout" ] == [None , None , None ]:
563- toprint += ",,,"
475+ exit (- 1 )
476+ if "timeout_t" not in f :
477+ print ("timeout not parsed for f: " , f )
478+ exit (- 1 )
479+
480+ #timeout_t, timeout_mem, timeout_call
481+ if f ["timeout_t" ] == None :
482+ toprint += ",,,,,"
564483 else :
565- toprint += "%s," % f ["solvertout" ][0 ]
566- toprint += "%s," % f ["solvertout" ][1 ]
567- toprint += "%s," % f ["solvertout" ][2 ]
484+ toprint += "%s," % f ["timeout_t" ]
485+ toprint += "%s," % f ["timeout_mem" ]
486+ toprint += "%s," % f ["timeout_call" ]
487+ toprint += "%s," % f ["page_faults" ]
488+ toprint += "%s," % f ["signal" ]
568489
569490 #ganak_ver
570- if f ["solverver" ] == [None , None ]:
491+ if "solverver" not in f or f ["solverver" ] == [None , None ]:
571492 toprint += ","
572493 else :
573494 toprint += "%s-%s," % (f ["solverver" ][0 ], f ["solverver" ][1 ])
0 commit comments