Skip to content
Snippets Groups Projects
Commit 8b927d2f authored by Hans-Jörg's avatar Hans-Jörg
Browse files

Finish simulator

parent db77966a
No related branches found
No related tags found
No related merge requests found
......@@ -87,11 +87,13 @@ args_parser.add_argument(
)
def writeResult(outFile, args, result, csv=False):
message(f"Writing result to {outFile}.", logics)
#with open(outFile, "w") as af:
af = stdout
if True:
def clip_inf(max):
return lambda x: max if x == float("inf") else x
def writeResult(args, result, csv=False):
message(f"Writing result to {args.output}.", logics)
with open(args.output, "w") as af:
af.write("-gridTPT report---------------\n")
af.write(f"Date : {datetime.now():%Y%m%d%H%M%S}\n")
af.write("Type : perf\n")
......@@ -100,22 +102,37 @@ def writeResult(outFile, args, result, csv=False):
af.write("Hardware : \n")
af.write(f"Executable : {args.schedule}\n")
af.write("Options : \n")
af.write("Benchmarks type : {args.logics}\n")
af.write(f"Benchmarks type : {args.logics}\n")
if args.time:
af.write(f"CPU limit : {args.time:.0f}s\n")
else:
af.write("CPU limit : 99999999s\n")
af.write("-statistics-------------------")
af.write(f"Cumulative time : 23817m (396h) ")
af.write("Total time : 0m ")
af.write("Nb of clients : 1")
af.write("Opt. Sched. time : 0m ")
af.write("-summary----------------------")
af.write(f"Total number of benchmarks : 41217")
af.write(f"Number of success : 31735")
af.write("Number of unknown : 0")
af.write(f"Number of time out : 7336")
af.write("Number of errors : 0")
af.write("-statistics-------------------\n")
time = result.map(clip_inf(args.time)).sum()
af.write(f"Cumulative time : {time/60:.0f}m ({time/(60*60):.0f}h)\n")
af.write("Total time : 0m \n")
af.write("Nb of clients : 1\n")
af.write("Opt. Sched. time : 0m \n")
af.write("-summary----------------------\n")
benchmarks = len(result)
successes = len(result.loc[result < float("inf")])
af.write(f"Total number of benchmarks : {benchmarks}\n")
af.write(f"Number of success : {successes}\n")
af.write("Number of unknown : 0\n")
af.write(f"Number of time out : {benchmarks-successes}\n")
af.write("Number of errors : 0\n")
af.write("-data-------------------------\n")
padding = max(result.index.map(len).max(), len("Name"))
af.write(f"{'Name':<{padding}} total_time result\n")
for key in result.index:
if result[key] == float("inf"):
rtime = "--"
rout = "NA"
else:
rtime = f"{result[key]:.2f}"
rout = "0"
af.write(f"{key:<{padding}} {rtime:>10} {rout:>6}\n")
af.write("-eof--------------------------\n")
if __name__ == "__main__":
......@@ -161,7 +178,9 @@ if __name__ == "__main__":
jitter = rng.normal(args.mu, args.sigma, exps.shape[0])
solved = (exps[strategy]+jitter).loc[(exps[strategy]+jitter) <= strategy_time]
solved = (exps[strategy] + jitter).loc[
(exps[strategy] + jitter) <= strategy_time
]
solving_time = solved.clip(0.0) + time
solving_time.name = sc
......@@ -174,6 +193,6 @@ if __name__ == "__main__":
exps[sc].loc[exps[sc] > timeout] = float("inf")
message("Writing output.", logics)
writeResult(args.output, exps[sc])
writeResult(args, exps[sc])
message("All done.", logics)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment