253 opts, args = getopt.getopt(
265 except getopt.GetOptError:
267 "python3 analyze-benchmark.py -s <sample dir> -r <reference dir> -e <epsilon> -a <attribute> -p"
271 dir_artifact_sample =
""
272 dir_artifact_ref =
""
275 "query_exec_trimmed_avg"
280 for opt, arg
in opts:
281 if opt
in (
"-h",
"--help"):
284 -s/--sample:\t\t\t directory of the results for the benchmarked sample branch
285 -r/--reference:\t\t\t directory of the results for the benchmarked reference branch
286 -e/--epsilon:\t\t\t ratio tolerance for reporting results outside this range
287 -a/--attribute:\t\t\t attribute to be used for benchmark comparison (default: query_total_avg)
288 -p/--print:\t\t\t\t print all the results
293 if opt
in (
"-s",
"--sample"):
294 dir_artifact_sample = arg
295 assert os.path.isdir(dir_artifact_sample)
296 elif opt
in (
"-r",
"--reference"):
297 dir_artifact_ref = arg
298 assert os.path.isdir(dir_artifact_ref)
299 elif opt
in (
"-e",
"--epsilon"):
301 elif opt
in (
"-a",
"--attribute"):
302 query_attribute = arg
303 elif opt
in (
"-p",
"--print"):
306 assert dir_artifact_ref !=
""
307 assert dir_artifact_sample !=
""
310 GPU_list_ref = listdir(dir_artifact_ref)
311 GPU_list_sample = listdir(dir_artifact_sample)
313 for gpu
in GPU_list_ref:
314 dir_name_ref = dir_artifact_ref +
"/" + gpu +
"/Benchmarks"
315 filename_list_ref = listdir(dir_name_ref)
320 if gpu
in GPU_list_sample:
321 dir_name_sample = dir_artifact_sample +
"/" + gpu +
"/Benchmarks"
322 filename_list_sample = listdir(dir_name_sample)
323 dir_name_sample +=
"/"
326 dir_name_sample, filename_list_sample
329 for index
in range(len(filename_list_ref)):
330 refBench.load(filename_list_ref[index])
331 if filename_list_ref[index]
in filename_list_sample:
332 sampleBench.load(filename_list_ref[index])
335 "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
337 print(
"++++ " + sampleBench.getGpuName())
340 + refBench.getFrontAttribute(
"run_label")
342 + refBench.getFrontAttribute(
"run_version")
346 + sampleBench.getFrontAttribute(
"run_label")
348 + sampleBench.getFrontAttribute(
"run_version")
351 "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
356 refBench, sampleBench, query_attribute
358 analyzer.findAnomaliesRatio(epsilon)
361 refBench, sampleBench, query_attribute
363 printer.printAttribute()
366 "No sample results for table "
367 + refBench.getRunTableName()
371 "======================================================================="
376 "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
378 print(
"++++ No sample results for GPU " + gpu +
" were found.")
380 "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"